model

package
v0.0.0-...-e328feb Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        uint64     `json:"id" gorm:"column:id;" db:"id"`
	CreatedAt *time.Time `json:"created_at,omitempty" gorm:"column:created_at;" db:"created_at"`
	UpdatedAt *time.Time `json:"updated_at,omitempty" gorm:"column:updated_at;" db:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at,omitempty" gorm:"column:deleted_at;" db:"deleted_at"`
}

type Category

type Category struct {
	Base
	Name        string `json:"name" gorm:"column:name;"`
	Description string `json:"description" gorm:"column:description;omitempty"`
}

func (Category) TableName

func (Category) TableName() string

type Comment

type Comment struct {
	Base
	Content string `json:"content" gorm:"column:content;"`
	VideoID int64  `json:"video_id" gorm:"column:video_id;"`
	UserID  int64  `json:"user_id" gorm:"column:user_id;"`
}

func (Comment) TableName

func (Comment) TableName() string

type CreateCategoryParams

type CreateCategoryParams struct {
	Name        string `json:"name" binding:"required"`
	Description string `json:"description,omitempty" `
}

type CreateUserParams

type CreateUserParams struct {
	Username string `json:"username" binding:"required,alphanum"`
	Password string `json:"password" binding:"required,min=8"`
	FullName string `json:"full_name" binding:"required"`
	Email    string `json:"email" binding:"required"`
}

type CreateVideoParams

type CreateVideoParams struct {
	Title       string   `form:"title" binding:"required"`
	Description string   `form:"description,omitempty"`
	CategoryIDs []uint64 `form:"category_ids" binding:"required"`
}

type LoginParams

type LoginParams struct {
	Username string `json:"username" binding:"required,alphanum"`
	Password string `json:"password" binding:"required,min=8"`
}

type LoginResponse

type LoginResponse struct {
	SessionID             uuid.UUID    `json:"session_id"`
	AccessToken           string       `json:"access_token"`
	AccessTokenExpiresAt  time.Time    `json:"access_token_expires_at"`
	RefreshToken          string       `json:"refresh_token"`
	RefreshTokenExpiresAt time.Time    `json:"refresh_token_expires_at"`
	User                  UserResponse `json:"user"`
}

type Session

type Session struct {
	ID           uuid.UUID `json:"id" gorm:"column:id;"`
	OwnerID      uint64    `json:"owner_id" gorm:"column:owner_id;"`
	RefreshToken string    `json:"refresh_token" gorm:"column:refresh_token;"`
	UserAgent    string    `json:"user_agent" gorm:"column:user_agent;"`
	ClientIp     string    `json:"client_ip" gorm:"column:client_ip;"`
	IsBlocked    bool      `json:"is_blocked" gorm:"column:is_blocked;"`
	ExpiresAt    time.Time `json:"expires_at" gorm:"column:expires_at;"`
	CreatedAt    time.Time `json:"created_at" gorm:"column:created_at;"`
}

func (Session) TableName

func (Session) TableName() string

type User

type User struct {
	Base
	Username          string    `json:"username" gorm:"column:username;"`
	HashedPassword    string    `json:"-" gorm:"column:hashed_password;"`
	Salt              string    `json:"-" gorm:"column:salt;"`
	FullName          string    `json:"full_name" gorm:"column:full_name;"`
	Email             string    `json:"email" gorm:"column:email;"`
	PasswordChangedAt time.Time `json:"password_changed_at" gorm:"column:password_changed_at;"`
}

func (User) TableName

func (User) TableName() string

type UserResponse

type UserResponse struct {
	Username          string    `json:"username"`
	FullName          string    `json:"full_name"`
	Email             string    `json:"email"`
	PasswordChangedAt time.Time `json:"password_changed_at"`
	CreatedAt         time.Time `json:"created_at"`
}

type Video

type Video struct {
	Base
	Title       string             `json:"title" gorm:"column:title;"`
	Description string             `json:"description" gorm:"column:description;"`
	Status      common.VideoStatus `json:"status" gorm:"column:status;default:ACTIVE;"`
	OldStatus   common.VideoStatus `json:"-" gorm:"column:old_status;default:null"`
	OwnerID     uint64             `json:"owner_id" gorm:"column:owner_id;"`
}

func (Video) TableName

func (Video) TableName() string

type VideoCategory

type VideoCategory struct {
	ID         uint64     `json:"id" gorm:"column:id;" db:"id"`
	VideoID    uint64     `json:"video_id" gorm:"column:video_id;"`
	CategoryID uint64     `json:"category_id" gorm:"column:category_id;"`
	Category   Category   `json:"category" gorm:"foreignKey:CategoryID;"`
	CreatedAt  *time.Time `json:"created_at,omitempty" gorm:"column:created_at;" db:"created_at"`
}

func (VideoCategory) TableName

func (VideoCategory) TableName() string

type VideoFile

type VideoFile struct {
	ID         uint64          `json:"id" gorm:"column:id;" db:"id"`
	VideoID    uint64          `json:"video_id" gorm:"column:video_id;"`
	OriginName string          `json:"origin_name" gorm:"column:origin_name;"`
	Name       string          `json:"name" gorm:"column:name;"`
	Path       string          `json:"path" gorm:"column:path;"`
	Format     string          `json:"format" gorm:"column:format;"`
	Provider   common.Provider `json:"provider" gorm:"column:provider;default:LOCAL;"`
	MaxSegment int             `json:"max_segment" gorm:"column:max_segment;"`
	CreatedAt  *time.Time      `json:"created_at,omitempty" gorm:"column:created_at;" db:"created_at"`
	DeletedAt  *time.Time      `json:"deleted_at,omitempty" gorm:"column:deleted_at;" db:"deleted_at"`
}

func (VideoFile) TableName

func (VideoFile) TableName() string

type VideoFilter

type VideoFilter struct {
	UserID uint64 `json:"user_id" form:"user_id"`
	Status string `json:"status" form:"status"`
}

Jump to

Keyboard shortcuts

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