model

package
v0.0.0-...-f96b8b0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 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 Article

type Article struct {
	ID        int64     `gorm:"primaryKey" json:"id"`
	UserID    uuid.UUID `gorm:"column:user_id" json:"userId"`
	Title     string    `gorm:"column:title" form:"title" json:"title" validate:"required,min=2,max=64"`
	Text      string    `gorm:"column:text" form:"text" json:"text" validate:"required,min=10,max=10000"`
	DateAdded time.Time `gorm:"column:date_added;type:timestamp(0) without time zone;autoCreateTime" json:"dateAdded"`
}

func (*Article) Validate

func (a *Article) Validate() error

type ArticleDto

type ArticleDto struct {
	ID         int64     `gorm:"primaryKey" json:"id"`
	UserID     uuid.UUID `gorm:"column:user_id" json:"userId"`
	UserAvatar string    `json:"userAvatar"`
	Username   string    `json:"username"`
	Title      string    `json:"title"`
	Text       string    `json:"text"`
	DateAdded  time.Time `json:"dateAdded"`
}

type Comment

type Comment struct {
	ID        int64     `gorm:"primaryKey" json:"id"`
	UserID    uuid.UUID `gorm:"column:user_id" json:"userId"`
	ArticleID int64     `gorm:"column:article_id" form:"articleId" json:"articleId" validate:"required"`
	Body      string    `gorm:"column:body" form:"body" json:"body" validate:"required,min=1,max=512"`
	DateAdded time.Time `gorm:"column:date_added;type:timestamp(0) without time zone;autoCreateTime" json:"dateAdded"`
}

func (*Comment) Validate

func (c *Comment) Validate() error

type CommentDto

type CommentDto struct {
	ID         int64     `gorm:"primaryKey" json:"id"`
	UserID     uuid.UUID `gorm:"column:user_id" json:"userId"`
	UserAvatar string    `json:"userAvatar"`
	Username   string    `json:"username"`
	ArticleID  int64     `json:"articleId"`
	Body       string    `json:"body"`
	DateAdded  time.Time `json:"dateAdded"`
}

type ResetPasswordToken

type ResetPasswordToken struct {
	ID        int64     `gorm:"primaryKey" json:"id"`
	UserEmail string    `gorm:"column:user_email;unique" json:"userEmail" binding:"required,email"`
	Token     string    `gorm:"column:token;unique" json:"token"`
	Expiry    time.Time `gorm:"column:expiry" json:"expiry"`
}

type User

type User struct {
	ID             uuid.UUID `gorm:"primaryKey" json:"id"`
	Username       string    `gorm:"column:username;unique" form:"username" json:"username" validate:"required,min=3,max=20"`
	Email          string    `gorm:"column:email;unique" form:"email" json:"email" validate:"required,email"`
	Password       string    `gorm:"column:password" form:"password" json:"password" validate:"required,min=8,max=24"`
	Avatar         string    `gorm:"column:avatar" json:"avatar"`
	Activated      bool      `gorm:"column:activated" json:"activated"`
	ActivationLink *string   `gorm:"column:activation_link;unique" json:"activationLink"`
	DateAdded      time.Time `gorm:"column:date_added;type:timestamp(0) without time zone;autoCreateTime" json:"dateAdded"`
}

func (*User) DTO

func (u *User) DTO() *User

func (*User) Validate

func (u *User) Validate() error

Jump to

Keyboard shortcuts

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