models

package
v0.0.0-...-3f65518 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) string

Types

type Accessory

type Accessory struct {
	ID          *primitive.ObjectID `bson:"_id, omitempty" json:"id, omitempty"`
	Name        string              `bson:"name" json:"name" form:"name" validate:"required"`
	Task        int32               `bson:"task" json:"task" form:"task" validate:"required,accessory_task"`
	Description string              `bson:"description" json:"description" form:"description" validate:"required"`
	Icon        string              `bson:"icon" json:"icon"`
	PinId       uint8               `bson:"pin_id" json:"pin_id" validate:"required"`
	PinType     uint8               `bson:"pin_type" json:"pin_type" form:"pin_id" validate:"required"`
	IsActive    bool                `bson:"is_active" json:"is_active"`
	IsPublic    bool                `bson:"is_public" json:"is_public" form:"is_public"`
	UserId      *primitive.ObjectID `bson:"user_id, omitempty" json:"user_id, omitempty"`
	CreatedAt   time.Time           `bson:"created_at, omitempty" json:"created_at, omitempty"`
	UpdatedAt   time.Time           `bson:"updated_at, omitempty" json:"updated_at, omitempty"`
}

type AccessoryUser

type AccessoryUser struct {
	ID          *primitive.ObjectID `bson:"_id, omitempty" json:"id, omitempty"`
	UserId      *primitive.ObjectID `bson:"user_id, omitempty" json:"user_id, omitempty"`
	AccessoryID *primitive.ObjectID `bson:"accessory_id, omitempty" json:"accessory_id, omitempty"`
	CreatedAt   time.Time           `bson:"created_at, omitempty" json:"created_at, omitempty"`
	UpdatedAt   time.Time           `bson:"updated_at, omitempty" json:"updated_at, omitempty"`
}

type Log

type Log struct {
	ID          *primitive.ObjectID `bson:"_id, omitempty" json:"id, omitempty"`
	UserId      *primitive.ObjectID `bson:"user_id, omitempty" json:"user_id, omitempty"`
	AccessoryID *primitive.ObjectID `bson:"accessory_id, omitempty" json:"accessory_id, omitempty"`

	Read bool `bson:"read, omitempty" json:"checked"`

	CreatedAt time.Time `bson:"created_at, omitempty" json:"created_at, omitempty"`
	UpdatedAt time.Time `bson:"updated_at, omitempty" json:"updated_at, omitempty"`
}

type RefreshedToken

type RefreshedToken struct {
	ID     *primitive.ObjectID `bson:"_id, omitempty" json:"id, omitempty"`
	UserId *primitive.ObjectID `bson:"user_id, omitempty" json:"user_id, omitempty"`
	Token  string              `bson:"token, omitempty" json:"-, omitempty"`

	Valid bool   `bson:"valid, omitempty" json:"valid, omitempty"`
	Csrf  string `bson:"csrf, omitempty" json:"csrf, omitempty"`

	CreatedAt time.Time `bson:"created_at, omitempty" json:"created_at, omitempty"`
	ExpiresAt time.Time `bson:"expires_at, omitempty" json:"expires_at, omitempty"`
}

type Role

type Role struct {
	Title string `bson:"title, omitempty" json:"title, omitempty"`
}

func (*Role) IsAdmin

func (r *Role) IsAdmin() bool

func (*Role) IsUser

func (r *Role) IsUser() bool

type User

type User struct {
	ID        *primitive.ObjectID `bson:"_id, omitempty" json:"id, omitempty"`
	Fullname  string              `bson:"fullname, omitempty" json:"fullname, omitempty"`
	Username  string              `bson:"username, omitempty" json:"username, omitempty"`
	Hash      string              `bson:"user_hash, omitempty" json:"hash, omitempty"`
	Email     string              `bson:"email, omitempty" json:"email, omitempty"`
	Password  string              `bson:"password, omitempty" json:"-, omitempty"`
	IsActive  bool                `bson:"is_active, omitempty" json:"is_active, omitempty"`
	Avatar    string              `bson:"avatar, omitempty" json:"avatar, omitempty"`
	RoleId    uint64              `bson:"role_id, omitempty" json:"role_id, omitempty"`
	LastLogin time.Time           `bson:"last_login, omitempty" json:"last_login, omitempty"`
	JoinedAt  time.Time           `bson:"joined_at, omitempty" json:"joined_at, omitempty"`
	UpdatedAt time.Time           `bson:"updated_at, omitempty" json:"updated_at, omitempty"`
}

func (*User) SetPassword

func (user *User) SetPassword(password string)

func (*User) ValidatePassword

func (user *User) ValidatePassword(password string) bool

Jump to

Keyboard shortcuts

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