models

package
v0.0.0-...-b46446b Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginInput

type LoginInput struct {
	Email    string
	Password string
}

LoginInput is what the user sends on login

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

LoginResponse contains a token used for auth

type RegisterUserInput

type RegisterUserInput struct {
	Username string
	Email    string
	Password string
}

RegisterUserInput is the input for a new user account

type User

type User struct {
	ID        string         `gorm:"unique;index;primaryKey;default:uuid_generate_v4()" json:"id"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`

	Role          string `json:"role"`
	Password      string `json:"password"`
	Nickname      string `json:"nickname"`
	Email         string `gorm:"unique" json:"email"`
	Username      string `gorm:"unique" json:"username"`
	Plan          string `gorm:"default:alpha" json:"plan"`
	EmailVerified bool   `gorm:"default:true" json:"emailVerified"`
	Avatar        string `gorm:"default:https://cdn.bken.io/files/favicon.png" json:"avatar"`
}

User is a user 👴

type UserTokenClaims

type UserTokenClaims struct {
	ID       string `json:"id"`
	Email    string `json:"email"`
	Avatar   string `json:"avatar"`
	Username string `json:"username"`
	jwt.StandardClaims
}

UserTokenClaims is the JWT that is sent to the user

type Video

type Video struct {
	ID        string         `gorm:"primaryKey;default:uuid_generate_v4()" json:"id"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`

	URL        string  `json:"url"`
	Title      string  `json:"title"`
	Duration   float32 `json:"duration"`
	UserID     string  `gorm:"index" json:"userId"`
	Views      int     `gorm:"default:0" json:"views"`
	Visibility string  `gorm:"default:unlisted" json:"visibility"`
	Thumbnail  string  `gorm:"default:https://cdn.bken.io/files/default-thumbnail-sm.jpg" json:"thumbnail"`
}

Video is the video struct 🤷‍♂️

type VideoVersion

type VideoVersion struct {
	Name             string `json:"name"`
	Status           string `json:"status"`
	PercentCompleted uint8  `json:"percentCompleted"`
}

VideoVersion is the representation of a single preset ▶

type VideoView

type VideoView struct {
	ID        uint           `gorm:"primaryKey" json:"id"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`

	IP      string `json:"ip"`
	UserID  string `json:"userId"`
	VideoID string `json:"videoId"`
}

VideoView 🎥

Jump to

Keyboard shortcuts

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