models

package module
v0.0.0-...-1fd546a Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 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 AvatarStyle

type AvatarStyle string

AvatarStyle define the avatar style

const (
	// Gravatar is an avatar image generated from email
	Gravatar AvatarStyle = "gravatar"

	// Manual is an avatar uploaded by user
	Manual AvatarStyle = "manual"
)

type Comment

type Comment struct {
	gorm.Model
	Version int
	PostId  Post
	Creator User
	Text    string
	Score   int
}

Comment data model

type Pool

type Pool struct {
	gorm.Model
	Version     int
	Names       pq.StringArray `gorm:"type:text[]"`
	Category    PoolCategory
	Posts       []Post
	Description string
}

Pool data model

type PoolCategory

type PoolCategory struct {
	gorm.Model
	Version   int
	Name      string
	Color     string
	Usages    int
	IsDefault bool
}

PoolCategory data model

type Post

type Post struct {
	gorm.Model
	Version            int
	Safety             PostSafety
	Source             string
	Type               PostType
	Checksum           string
	ChecksumMd5        string
	CanvasWidth        int
	CanvasHeight       int
	ContentUrl         string
	ThumbnailUrl       string
	Tags               []Tag  `gorm:"many2many:post_tags"`
	Relations          []Post `gorm:"many2many:post_relations"`
	Creator            User
	Score              int
	TagCount           int
	FavouriteCount     int
	CommentCount       int
	RelationCount      int
	HasCustomThumbnail bool
	Comments           []Comment
	Pools              []Pool `gorm:"many2many:post_pools"`
}

type PostSafety

type PostSafety string
const (
	Safe    PostSafety = "safe"
	Sketchy PostSafety = "sketchy"
	Unsafe  PostSafety = "unsafe"
)

type PostType

type PostType string
const (
	Image     PostType = "image"
	Animation PostType = "animation"
	Video     PostType = "video"
	Flash     PostType = "flash"
	Youtube   PostType = "youtube"
)

type Rank

type Rank string

Rank defines the user permission

const (
	Restricted    Rank = "restricted"
	Regular       Rank = "regular"
	Power         Rank = "power"
	Moderator     Rank = "moderator"
	Administrator Rank = "administrator"
)

type Tag

type Tag struct {
	gorm.Model
	Version      int
	Names        pq.StringArray `gorm:"type:text[]"`
	Category     TagCategory
	Implications []Tag `gorm:"many2many:tag_implications"`
	Suggestions  []Tag `gorm:"many2many:tag_suggestions"`
	Usages       int
	Description  string
}

Tag data model

type TagCategory

type TagCategory struct {
	gorm.Model
	Version   int `gorm:"default:1"`
	Name      string
	Color     string
	Usages    int
	Order     int
	IsDefault bool
}

TagCategory data model

type User

type User struct {
	gorm.Model
	Username           string
	Email              string
	Rank               Rank
	LastLoginTime      time.Time
	AvatarStyle        AvatarStyle
	AvatarUrl          string
	CommentCount       int
	UploadedPostCount  int
	LikedPostCount     int
	DislikedPostCount  int
	FavouritePostCount int
	Version            int
}

User data model

Jump to

Keyboard shortcuts

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