models

package
v0.0.0-...-18354f7 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Purpose_EmailVerification = "email-verification"
View Source
const Purpose_PasswordReset = "password-reset"
View Source
const Purpose_SignIn = "sign-in"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	ID     uint `gorm:"primaryKey,autoIncrement"`
	UserId uint `gorm:"index"`

	Name  string `gorm:"type:varchar(255)"`
	Token string `gorm:"type:varchar(255); uniqueIndex"`

	CreatedAt time.Time
	UpdatedAt time.Time
}

type Follow

type Follow struct {
	ID uint `gorm:"primaryKey,autoIncrement"`

	FollowedId uint         `gorm:"index"`
	FollowerId uint         `gorm:"index"`
	AcceptedAt sql.NullTime `gorm:"index"`

	CreatedAt time.Time
	UpdatedAt time.Time
}

type Like

type Like struct {
	ID   uint      `gorm:"primaryKey,autoIncrement" json:"-"`
	UUID uuid.UUID `gorm:"type:varchar(60); uniqueIndex" json:"uuid"`

	UserId uint `gorm:"index" json:"-"`
	PostId uint `gorm:"index" json:"-"`

	Meta      string    `json:"-"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*Like) BeforeCreate

func (like *Like) BeforeCreate(tx *gorm.DB) (err error)

type Notification

type Notification struct {
	ID     uint `gorm:"primaryKey,autoIncrement"`
	UserId uint `gorm:"index"`

	TargetPostId   uint `gorm:"index"`
	TargetUserId   uint `gorm:"index"`
	TargetFollowId uint `gorm:"index"`

	Type    string `gorm:"type:varchar(255); index"`
	Message string `gorm:"type:varchar(255)"`
	Link    string `gorm:"type:varchar(255)"`

	CreatedAt time.Time
	UpdatedAt time.Time
}

type Post

type Post struct {
	ID        uint          `gorm:"primaryKey,autoIncrement" json:"-"`
	UUID      uuid.UUID     `gorm:"type:varchar(60); uniqueIndex" json:"uuid"`
	UserId    uint          `gorm:"index" json:"-"`
	ReplyToId sql.NullInt64 `gorm:"index" json:"-"`

	Content string `json:"content"`
	Media   string `json:"media"`

	Meta      string    `json:"-"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*Post) BeforeCreate

func (post *Post) BeforeCreate(tx *gorm.DB) (err error)

type User

type User struct {
	ID   uint      `gorm:"primaryKey,autoIncrement" json:"-"`
	UUID uuid.UUID `gorm:"type:varchar(60); uniqueIndex" json:"uuid"`

	Username string `gorm:"type:varchar(255); uniqueIndex" json:"username"`
	Name     string `gorm:"type:varchar(255)" json:"name"`
	Email    string `gorm:"type:varchar(255); uniqueIndex" json:"email"`
	Password string `gorm:"type:varchar(255)" json:"-"`

	Image    string       `json:"image"`
	Birthday sql.NullTime `json:"birthday"`
	Bio      string       `json:"bio"`
	Link     string       `json:"link"`

	IsPrivate bool   `gorm:"index" json:"is_private"`
	Role      string `gorm:"type:varchar(50); default:user"`

	ActivatedAt sql.NullTime `gorm:"index" json:"activated_at"`
	VerifiedAt  sql.NullTime `gorm:"index" json:"verified_at"`

	Meta      string    `json:"-"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*User) BeforeCreate

func (user *User) BeforeCreate(tx *gorm.DB) (err error)

type VerificationCode

type VerificationCode struct {
	ID     uint      `gorm:"primaryKey,autoIncrement"`
	UUID   uuid.UUID `gorm:"type:varchar(60); uniqueIndex" json:"uuid"`
	UserId uint      `gorm:"index"`

	Code      string `gorm:"type:varchar(50);"`
	Token     string `gorm:"type:varchar(255);"`
	Purpose   string `gorm:"type:varchar(255);"`
	Attempts  uint   `gorm:"type:tinyint;"`
	ExpiresAt time.Time

	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*VerificationCode) BeforeCreate

func (vc *VerificationCode) BeforeCreate(tx *gorm.DB) (err error)

Jump to

Keyboard shortcuts

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