models

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 8 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 Activity

type Activity struct {
	ID       *primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Activity string              `bson:"activity,omitempty" json:"activity,omitempty"`
}

type Connection

type Connection struct {
	ID             *primitive.ObjectID   `bson:"_id" json:"id,omitempty"`
	ServiceUserId  string                `bson:"service_user_id" json:"service_user_id,omitempty"`
	Name           string                `bson:"name" json:"name,omitempty"`
	Type           proto.Connection_Type `bson:"type" json:"type,omitempty"`
	AccessToken    string                `bson:"access_token" json:"access_token,omitempty"`
	RefreshedToken string                `bson:"refreshed_token" json:"-"`
	ShowActivity   bool                  `bson:"show_activity,omitempty" json:"show_activity,omitempty"`
	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"`
}

func (*Connection) ToProto

func (c *Connection) ToProto() *proto.Connection

Convert connection model to protobuf

type Follow

type Follow struct {
	ID                *primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	TheaterId         *primitive.ObjectID `bson:"theater_id,omitempty" json:"theater_id,omitempty"`
	UserId            *primitive.ObjectID `bson:"user_id,omitempty" json:"user_id,omitempty"`
	EmailNotification bool                `bson:"email_notification,omitempty" json:"email_notification,omitempty"`
	PushNotification  bool                `bson:"push_notification,omitempty" json:"push_notification,omitempty"`
	CreatedAt         time.Time           `bson:"created_at,omitempty" json:"created_at,omitempty"`
	UpdatedAt         time.Time           `bson:"updated_at,omitempty" json:"updated_at,omitempty"`
}

type Friend

type Friend struct {
	ID        *primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	FriendId  *primitive.ObjectID `bson:"friend_id,omitempty" json:"friend_id,omitempty"`
	UserId    *primitive.ObjectID `bson:"user_id,omitempty" json:"user_id,omitempty"`
	Accepted  bool                `bson:"accepted,omitempty" json:"accepted,omitempty"`
	CreatedAt time.Time           `bson:"created_at,omitempty" json:"created_at,omitempty"`
	UpdatedAt time.Time           `bson:"updated_at,omitempty" json:"updated_at,omitempty"`
}

func (*Friend) ToProto

func (f *Friend) ToProto() *proto.Friend

type MediaSource

type MediaSource struct {
	ID        *primitive.ObjectID    `bson:"_id, omitempty" json:"id,omitempty"`
	UserId    *primitive.ObjectID    `bson:"user_id,omitempty" json:"user_id,omitempty"`
	Title     string                 `bson:"title" json:"title"`
	Type      proto.MediaSource_Type `bson:"type" json:"type,omitempty"`
	Banner    string                 `bson:"banner" json:"banner,omitempty"`
	Uri       string                 `bson:"uri" json:"uri,omitempty"`
	Length    int64                  `bson:"length" json:"length,omitempty"`
	Artist    string                 `bson:"artist" json:"artist,omitempty"`
	Subtitles []*Subtitle            `json:"subtitles,omitempty"`
	CreatedAt time.Time              `bson:"created_at,omitempty" json:"created_at,omitempty"`
	UpdatedAt time.Time              `bson:"updated_at,omitempty" json:"updated_at,omitempty"`
}

type Message

type Message struct {
	ID         *primitive.ObjectID `bson:"_id" json:"id"`
	Content    string              `bson:"content" json:"content"`
	SenderId   *primitive.ObjectID `bson:"sender_id" json:"sender_id"`
	ReceiverId *primitive.ObjectID `bson:"receiver_id" json:"receiver_id"`
	Edited     bool                `bson:"edited" json:"edited"`
	Deleted    bool                `bson:"deleted" json:"deleted"`
	CreatedAt  time.Time           `bson:"created_at" json:"created_at"`
	UpdatedAt  time.Time           `bson:"updated_at" json:"updated_at"`
	DeletedAt  time.Time           `bson:"deleted_at" json:"deleted_at"`
}

func (*Message) ToProto

func (m *Message) ToProto(db *mongo.Database) (*proto.Message, error)

type Notification

type Notification struct {
	ID         *primitive.ObjectID                  `bson:"_id,omitempty" json:"id,omitempty"`
	Type       proto.Notification_NOTIFICATION_TYPE `bson:"type,omitempty" json:"type,omitempty"`
	Extra      *primitive.ObjectID                  `bson:"extra,omitempty" json:"extra,omitempty"`
	Read       bool                                 `bson:"read,omitempty" json:"read,omitempty"`
	FromUserId *primitive.ObjectID                  `bson:"from_user_id,omitempty" json:"from,omitempty"`
	ToUserId   *primitive.ObjectID                  `bson:"to_user_id,omitempty" json:"to,omitempty"`
	ReadAt     time.Time                            `bson:"read_at,omitempty" json:"read_at,omitempty"`
	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 Subtitle

type Subtitle struct {
	ID            *primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	MediaSourceId *primitive.ObjectID `bson:"media_source_id,omitempty" json:"media_source_id,omitempty"`
	Lang          string              `bson:"lang" json:"size"`
	File          string              `bson:"file" json:"file"`
	CreatedAt     time.Time           `bson:"created_at,omitempty" json:"created_at,omitempty"`
	UpdatedAt     time.Time           `bson:"updated_at,omitempty" json:"updated_at,omitempty"`
}

type Theater

type Theater struct {
	ID                *primitive.ObjectID       `bson:"_id,omitempty" json:"id,omitempty"`
	Description       string                    `bson:"description,omitempty" json:"description,omitempty"`
	Privacy           proto.PRIVACY             `bson:"privacy,omitempty" json:"privacy,omitempty"`
	VideoPlayerAccess proto.VIDEO_PLAYER_ACCESS `bson:"video_player_access,omitempty" json:"video_player_access,omitempty"`
	UserId            *primitive.ObjectID       `bson:"user_id,omitempty" json:"user_id,omitempty"`
	MediaSourceId     *primitive.ObjectID       `bson:"media_source_id,omitempty" json:"media_source_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 TheaterMember

type TheaterMember struct {
	ID        *primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	TheaterId *primitive.ObjectID `bson:"theater_id,omitempty" json:"theater_id,omitempty"`
	UserId    *primitive.ObjectID `bson:"user_id,omitempty" json:"user_id,omitempty"`
}

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"`
	Verified             bool                 `bson:"verified,omitempty" json:"verified,omitempty"`
	IsActive             bool                 `bson:"is_active,omitempty" json:"is_active,omitempty"`
	IsStaff              bool                 `bson:"is_staff,omitempty" json:"is_staff,omitempty"`
	EmailVerified        bool                 `bson:"email_verified,omitempty" json:"email_verified,omitempty"`
	EmailToken           string               `bson:"email_token,omitempty" json:"-"`
	TwoFactorAuthEnabled bool                 `bson:"two_fa_enabled,omitempty" json:"two_fa_enabled"`
	TwoFactorAuthToken   string               `bson:"two_fa_token,omitempty" json:"_"`
	State                proto.PERSONAL_STATE `bson:"state,omitempty" json:"state,omitempty"`
	Avatar               string               `bson:"avatar,omitempty" json:"avatar,omitempty"`
	RoleId               uint                 `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 (u *User) SetPassword(password string)

func (*User) ToProto

func (u *User) ToProto() *proto.User

func (*User) ValidatePassword

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

Jump to

Keyboard shortcuts

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