model

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        uint `gorm:"primaryKey"`
	UserID    uint
	VideoID   uint
	CreatedAt time.Time
	Content   string `gorm:"not null"`
}

type JwtBlacklist

type JwtBlacklist struct {
	ID  uint `gorm:"primaryKey"`
	Jwt string
}

Login Struct

type Like

type Like struct {
	ID      uint `gorm:"primaryKey"`
	VideoID uint
	UserID  uint
}

type SearchResult

type SearchResult struct {
	Users  []UserDetailsPublic
	Videos []VideoPublic
}

type User

type User struct {
	gorm.Model
	Name        string
	Email       string
	Password    string
	Picture_ID  string
	Description string
	Verified    bool
	Videos      []Video   `gorm:"ForeignKey:UserID"`
	Comments    []Comment `gorm:"ForeignKey:UserID"`
	Likes       []Like    `gorm:"ForeignKey:UserID"`
}

User struct for DB and backend stuff

func (User) GetPrivateUser

func (user User) GetPrivateUser() UserDetailsPrivate

func (User) GetPublicUser

func (user User) GetPublicUser() UserDetailsPublic

type UserClaim

type UserClaim struct {
	jwt.StandardClaims
	User_ID    uint
	User_email string
}

Struct for Users JWT Token

type UserDetailsPrivate

type UserDetailsPrivate struct {
	UserID      uint
	Name        string
	Email       string
	Description string
	Picture_ID  string
	Verified    bool
	Videos      []VideoPublic
	Comments    []Comment
	Likes       []Like
}

UserDetails for Private Endpoints (Settings etc.)

type UserDetailsPublic

type UserDetailsPublic struct {
	UserID      uint
	Name        string
	Description string
	Picture_ID  string
	Videos      []VideoPublic
}

UserDetails for Public Endpoints (Profile Page etc)

type UserLogin

type UserLogin struct {
	Email    string
	Password string
}

Login Struct

type VerificationCode added in v1.0.2

type VerificationCode struct {
	ID     uint `gorm:"primaryKey"`
	UserID uint
	Code   string
	Expiry time.Time
}

VerificationCode struct

type Video

type Video struct {
	gorm.Model
	UUID           uuid.UUID //`gorm:"primary_key; unique; type:uuid; column:id;"`
	VideoContentID string
	Title          string
	Description    string
	UploadDate     time.Time
	Views          int
	UserID         uint
	Comments       []Comment `gorm:"ForeignKey:VideoID"`
	Likes          []Like    `gorm:"ForeignKey:VideoID"`
}

type VideoContent

type VideoContent struct {
	ObjectID primitive.ObjectID     `bson:"_id,omitempty"`
	Video    map[string]interface{} `bson:"video"`
}

type VideoFull

type VideoFull struct {
	VideoStats   Video
	VideoContent VideoContent
}

type VideoPublic

type VideoPublic struct {
	UUID        uuid.UUID
	Title       string
	Description string
	UploadDate  time.Time
	Views       int
	Likes       int
	UserID      uint
}

func GetPublicVideo

func GetPublicVideo(video Video) VideoPublic

Jump to

Keyboard shortcuts

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