pixlUser

package
v2.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ShareUserID = "shared"

A special shared user ID so code knows if it's referring to this...

Variables

This section is empty.

Functions

func StripAuth0UserID added in v2.0.8

func StripAuth0UserID(userid string) string

Types

type APIObjectItem

type APIObjectItem struct {
	Shared              bool     `json:"shared"`
	Creator             UserInfo `json:"creator"`
	CreatedUnixTimeSec  int64    `json:"create_unix_time_sec,omitempty"`
	ModifiedUnixTimeSec int64    `json:"mod_unix_time_sec,omitempty"`
}

APIObjectItem API endpoints send around versions of this struct (with extra fields depending on the data type) TODO: maybe need to move this to its own API structures place? It's currently used in more places than just API handlers though.

type Method added in v2.0.8

type Method struct {
	UI    bool `json:"ui"`
	Sms   bool `json:"sms"`
	Email bool `json:"email"`
}

Method - Notification Methods

type NotificationConfig added in v2.0.8

type NotificationConfig struct {
	Method `json:"method"`
}

NotificationConfig - Config specifically for notifications

type Notifications added in v2.0.8

type Notifications struct {
	Topics          []Topics             `json:"topics"`
	Hints           []string             `json:"hints"`
	UINotifications []UINotificationItem `json:"uinotifications"`
}

Notifications - Object for notification settings

type Topics added in v2.0.8

type Topics struct {
	Name   string             `json:"name"`
	Config NotificationConfig `json:"config"`
}

Topics - Notification Topics'

type UINotificationItem added in v2.0.8

type UINotificationItem struct {
	Topic     string    `json:"topic"`
	Message   string    `json:"message"`
	Timestamp time.Time `json:"timestamp"`
	UserID    string    `json:"userid"`
}

UINotificationItem - A single UI Notification

type UserDetails added in v2.0.8

type UserDetails struct {
	Name           string `json:"name"`
	Email          string `json:"email"`
	Cell           string `json:"cell"`
	DataCollection string `json:"data_collection"`
}

Config - config options for user

type UserDetailsLookup added in v2.0.8

type UserDetailsLookup struct {
	// contains filtered or unexported fields
}

func MakeUserDetailsLookup added in v2.0.8

func MakeUserDetailsLookup(mongoClient *mongo.Client, envName string) UserDetailsLookup

func (*UserDetailsLookup) GetCurrentCreatorDetails added in v2.0.8

func (u *UserDetailsLookup) GetCurrentCreatorDetails(userID string) (UserInfo, error)

Getting JUST UserDetails (so it goes through our in-memory cache). This is useful for the many places in the code that only require user name+email to ensure we're sending out up-to-date "creator" aka "APIObjectItem" structures

func (*UserDetailsLookup) GetUser added in v2.0.8

func (u *UserDetailsLookup) GetUser(userid string) (UserStruct, error)

func (*UserDetailsLookup) GetUserEnsureExists added in v2.0.8

func (u *UserDetailsLookup) GetUserEnsureExists(userid string, name string, email string) (UserStruct, error)

func (*UserDetailsLookup) WriteUser added in v2.0.8

func (u *UserDetailsLookup) WriteUser(user UserStruct) error

type UserInfo

type UserInfo struct {
	Name        string          `json:"name"`
	UserID      string          `json:"user_id"`
	Email       string          `json:"email"`
	Permissions map[string]bool `json:"-" bson:"-"` // This is a lookup - we don't want this in JSON sent out of API though!
}

UserInfo - Anything we need to identify a user

type UserStruct added in v2.0.8

type UserStruct struct {
	Userid        string        `json:"userid"`
	Notifications Notifications `json:"notifications"`
	Config        UserDetails   `json:"userconfig"`
}

UserStruct - Structure for user configuration

Jump to

Keyboard shortcuts

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