models

package
v0.0.0-...-057e48f Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blacklist

type Blacklist struct {
	Id           string    `json:"id,omitempty"`
	AuthToken    string    `json:"auth_token,omitempty"`
	LastModified time.Time `json:"last_modified,omitempty"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
}

Blacklist is a root struct that is used to store the json encoded data for/from a mongodb blacklist doc.

type File

type File struct {
	Id           string    `json:"id,omitempty"`
	OwnerId      string    `json:"owner_id,omitempty"`
	OwnerType    string    `json:"owner_type,omitempty"`
	GridFSId     string    `json:"gridfs_id,omitempty"`
	BucketName   string    `json:"bucket_name,omitempty"`
	BucketType   string    `json:"bucket_type,omitempty"`
	Name         string    `json:"name,omitempty"`
	FileType     string    `json:"file_type,omitempty"`
	Size         int       `json:"size,omitempty"`
	LastModified time.Time `json:"last_modified,omitempty"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
	DeletedAt    time.Time `json:"deleted_at,omitempty"`
}

File is a root struct that is used to store the json encoded data for/from a mongodb file doc.

func UsersToFiles

func UsersToFiles(users []*User) []*File

UsersToFiles converts an input slice of user to a slice of file

func (*File) BuildBucketName

func (g *File) BuildBucketName() error

BuildBucketName returns a current name for the bucket of a GridFS File

func (*File) BuildFilter

func (g *File) BuildFilter() (*File, error)

BuildFilter is a function that setups the base user struct during a File modification request

func (*File) BuildUpdate

func (g *File) BuildUpdate(cur *File)

BuildUpdate is a function that setups the base file struct during a file modification request

func (*File) CheckID

func (g *File) CheckID(chkId string) bool

CheckID determines whether a specified ID is set or not

func (*File) Validate

func (g *File) Validate(valCase string) (err error)

Validate a File for different scenarios such as creating new File, or updating a File

type Group

type Group struct {
	Id           string    `json:"id,omitempty"`
	Name         string    `json:"name,omitempty"`
	RootAdmin    bool      `json:"root_admin,omitempty"`
	LastModified time.Time `json:"last_modified,omitempty"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
	DeletedAt    time.Time `json:"deleted_at,omitempty"`
}

Group is a root struct that is used to store the json encoded data for/from a mongodb group doc.

func (*Group) CheckID

func (g *Group) CheckID(chkId string) bool

CheckID determines whether a specified ID is set or not

func (*Group) Validate

func (g *Group) Validate(valCase string) (err error)

Validate a Group for different scenarios such as loading TokenData, creating new Group, or updating a Group

type Task

type Task struct {
	Id           string     `json:"id,omitempty"`
	Name         string     `json:"name,omitempty"`
	Status       TaskStatus `json:"status,omitempty"`
	Due          time.Time  `json:"due,omitempty"`
	Description  string     `json:"description,omitempty"`
	UserId       string     `json:"user_id,omitempty"`
	GroupId      string     `json:"group_id,omitempty"`
	LastModified time.Time  `json:"last_modified,omitempty"`
	CreatedAt    time.Time  `json:"created_at,omitempty"`
	DeletedAt    time.Time  `json:"deleted_at,omitempty"`
}

Task is a root struct that is used to store the json encoded data for/from a mongodb group doc.

func (*Task) BuildUpdate

func (g *Task) BuildUpdate(cur *Task)

BuildUpdate is a function that setups the base task struct during a user modification request

func (*Task) CheckID

func (g *Task) CheckID(chkId string) bool

CheckID determines whether a specified ID is set or not

func (*Task) LoadScope

func (g *Task) LoadScope(scopeUser *User)

LoadScope scopes the Task struct

func (*Task) Validate

func (g *Task) Validate(valCase string) (err error)

Validate a Group for different scenarios such as loading TokenData, creating new Group, or updating a Group

type TaskStatus

type TaskStatus string
const (
	NOTSTARTED TaskStatus = "NOT_STARTED"
	INPROGRESS TaskStatus = "IN_PROGRESS"
	COMPLETED  TaskStatus = "COMPLETED"
)

type User

type User struct {
	Id           string    `json:"id,omitempty"`
	Username     string    `json:"username,omitempty"`
	Password     string    `json:"password,omitempty"`
	FirstName    string    `json:"firstname,omitempty"`
	LastName     string    `json:"lastname,omitempty"`
	Email        string    `json:"email,omitempty"`
	Role         string    `json:"role,omitempty"`
	RootAdmin    bool      `json:"root_admin,omitempty"`
	GroupId      string    `json:"group_id,omitempty"`
	ImageId      string    `json:"image_id,omitempty"`
	LastModified time.Time `json:"last_modified,omitempty"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
	DeletedAt    time.Time `json:"deleted_at,omitempty"`
}

User is a root struct that is used to store the json encoded data for/from a mongodb user doc.

func (*User) Authenticate

func (g *User) Authenticate(checkPassword string) error

Authenticate compares an input password with the hashed password stored in the User model

func (*User) BuildFilter

func (g *User) BuildFilter() (*User, error)

BuildFilter is a function that setups the base user struct during a user modification request

func (*User) BuildUpdate

func (g *User) BuildUpdate(curUser *User)

BuildUpdate is a function that setups the base user struct during a user modification request

func (*User) CheckID

func (g *User) CheckID(chkId string) bool

CheckID determines whether a specified ID is set or not

func (*User) HashPassword

func (g *User) HashPassword() error

HashPassword hashes a user password and associates it with the user struct

func (*User) LoadScope

func (g *User) LoadScope(scopeUser *User, valCase string)

LoadScope scopes the User struct

func (*User) Validate

func (g *User) Validate(valCase string) (err error)

Validate a User for different scenarios such as loading TokenData, creating new User, or updating a User

Jump to

Keyboard shortcuts

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