user

package
v0.0.0-...-e9e834b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMembership

func AddMembership(userid uint64, groupid uint64, role string, collection string, emailfrequency int, eventsallowed int, volunteeringallowed int) bool

func GetExpectedReplies

func GetExpectedReplies(id uint64) []uint64

func GetLatLng

func GetLatLng(id uint64) utils.LatLng

func GetLoveJunkUser

func GetLoveJunkUser(ljuserid uint64, partnerkey string, firstname *string, lastname *string) (*fiber.Error, uint64)

func GetPublicLocation

func GetPublicLocation(c *fiber.Ctx) error

func GetSearchesForUser

func GetSearchesForUser(c *fiber.Ctx) error

func GetUser

func GetUser(c *fiber.Ctx) error

func NewAuthMiddleware

func NewAuthMiddleware(config Config) fiber.Handler

func ProfileSetPath

func ProfileSetPath(profileid uint64, url string, archived int, profile *UserProfile)

func WhoAmI

func WhoAmI(c *fiber.Ctx) uint64

Types

type Aboutme

type Aboutme struct {
	Text      string    `json:"text"`
	Timestamp time.Time `json:"timestamp"`
}

type Config

type Config struct{}

type Membership

type Membership struct {
	MembershipTable
	Nameshort                string `json:"nameshort"`
	Namefull                 string `json:"namefull"`
	Namedisplay              string `json:"namedisplay"`
	Bbox                     string `json:"bbox"`
	Microvolunteeringallowed int    `json:"microvolunteeringallowed"`
}

This is the membership we return to the client. It includes some information not stored in the DB.

func GetMemberships

func GetMemberships(id uint64) []Membership

type MembershipHistory

type MembershipHistory struct {
	ID                 uint64    `json:"id" gorm:"primary_key"`
	Groupid            uint64    `json:"groupid"`
	Userid             uint64    `json:"userid"`
	Added              time.Time `json:"added"`
	Collection         string    `json:"collection"`
	Processingrequired bool      `json:"processingrequired"`
}

func (MembershipHistory) TableName

func (MembershipHistory) TableName() string

type MembershipTable

type MembershipTable struct {
	ID                  uint64    `json:"id" gorm:"primary_key"`
	Groupid             uint64    `json:"groupid"`
	Userid              uint64    `json:"userid"`
	Added               time.Time `json:"added"`
	Collection          string    `json:"collection"`
	Emailfrequency      int       `json:"emailfrequency"`
	Eventsallowed       int       `json:"eventsallowed"`
	Volunteeringallowed int       `json:"volunteeringallowed"`
	Role                string    `json:"role"`
}

func (MembershipTable) TableName

func (MembershipTable) TableName() string

This corresponds to the DB table.

type PersistentToken

type PersistentToken struct {
	ID     uint64 `json:"id"`
	Series uint64 `json:"series"`
	Token  string `json:"token"`
}

type Phone

type Phone struct {
	ID          uint64     `json:"id" gorm:"primary_key"`
	Number      string     `json:"number"`
	Lastclicked *time.Time `json:"lastclicked"`
	Lastsent    *time.Time `json:"lastsent"`
}

func (Phone) TableName

func (Phone) TableName() string

type Publiclocation

type Publiclocation struct {
	Display   string `json:"display"`
	Groupid   uint64 `json:"groupid"`
	Groupname string `json:"groupname"`
	Location  string `json:"location"`
}

type Ratings

type Ratings struct {
	Up   uint64
	Down uint64
	Mine string
}
type Search struct {
	ID         uint64    `json:"id" gorm:"primary_key"`
	Date       time.Time `json:"date"`
	Userid     uint64    `json:"userid"`
	Term       string    `json:"term"`
	Maxmsg     uint64    `json:"maxmsg"`
	Locationid uint64    `json:"locationid"`
}

type Tabler

type Tabler interface {
	TableName() string
}

type User

type User struct {
	ID              uint64      `json:"id" gorm:"primary_key"`
	Firstname       *string     `json:"firstname"`
	Lastname        *string     `json:"lastname"`
	Fullname        *string     `json:"fullname"`
	Displayname     string      `json:"displayname" gorm:"-"`
	Profile         UserProfile `json:"profile" gorm:"-"`
	Lastaccess      time.Time   `json:"lastaccess"`
	Info            UserInfo    `json:"info" gorm:"-"`
	Supporter       bool        `json:"supporter" gorm:"-"`
	Donated         *time.Time  `json:"donated" gorm:"-"`
	Spammer         bool        `json:"spammer" gorm:"-"`
	Showmod         bool        `json:"showmod" gorm:"-"`
	Lat             float32     `json:"lat" gorm:"-"` // Exact for logged in user, approx for others.
	Lng             float32     `json:"lng" gorm:"-"`
	Aboutme         Aboutme     `json:"aboutme" gorm:"-"`
	Phone           string      `json:"phone" gorm:"-"`
	Added           time.Time   `json:"added"`
	Lastclicked     *time.Time  `json:"phonelastclicked" gorm:"-"`
	Lastsent        *time.Time  `json:"phonelastsent" gorm:"-"`
	ExpectedReplies int         `json:"expectedreplies" gorm:"-"`
	ExpectedChats   []uint64    `json:"expectedchats" gorm:"-"`
	Ljuserid        *uint64     `json:"ljuserid"`
	Deleted         *time.Time  `json:"deleted"`

	// Only returned for logged-in user.
	Email              string          `json:"email" gorm:"-"`
	Emails             []UserEmail     `json:"emails" gorm:"-"`
	Memberships        []Membership    `json:"memberships" gorm:"-"`
	Systemrole         string          `json:"systemrole""`
	Settings           json.RawMessage `json:"settings"` // This is JSON stored in the DB as a string.
	Relevantallowed    bool            `json:"relevantallowed"`
	Newslettersallowed bool            `json:"newslettersallowed"`
	Bouncing           bool            `json:"bouncing"`
	Trustlevel         *string         `json:"trustlevel"`
	Marketingconsent   bool            `json:"marketingconsent"`
}

func GetUserById

func GetUserById(id uint64, myid uint64) User

type UserEmail

type UserEmail struct {
	ID        uint64     `json:"id" gorm:"primary_key"`
	Added     time.Time  `json:"added"`
	Bounced   *time.Time `json:"bounced"`
	Ourdomain int        `json:"ourdomain"`
	Preferred int        `json:"preferred"`
	Email     string     `json:"email"`
}

type UserInfo

type UserInfo struct {
	Replies       uint64  `json:"replies"`
	Taken         uint64  `json:"taken"`
	Reneged       uint64  `json:"reneged"`
	Collected     uint64  `json:"collected"`
	Offers        uint64  `json:"offers"`
	Wanteds       uint64  `json:"wanteds"`
	Openoffers    uint64  `json:"openoffers"`
	Openwanteds   uint64  `json:"openwanteds"`
	Expectedreply uint64  `json:"expectedreply"`
	Openage       uint64  `json:"openage"`
	Replytime     uint64  `json:"replytime"`
	Ratings       Ratings `json:"ratings" gorm:"-"`
}

func GetUserInfo

func GetUserInfo(id uint64, myid uint64) UserInfo

type UserProfile

type UserProfile struct {
	ID        uint64 `json:"id" gorm:"primary_key"`
	Userid    uint64 `json:"-"`
	Path      string `json:"path"`
	Paththumb string `json:"paththumb"`
	Ours      bool   `json:"ours"`
}

type UserProfileRecord

type UserProfileRecord struct {
	ID         uint64 `json:"id" gorm:"primary_key"`
	Profileid  uint64
	Url        string
	Archived   int
	Useprofile bool `json:"-"`
}

func GetProfileRecord

func GetProfileRecord(id uint64) UserProfileRecord

func (UserProfileRecord) TableName

func (UserProfileRecord) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL