model

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminModel

type AdminModel struct {
	UserID      int64              `bson:"user_id" json:"user_id"`
	Permissions []types.Permission `bson:"permissions" json:"permissions"`
	GrantBy     int64              `bson:"grant_by" json:"grant_by"`
	SuperAdmin  bool               `bson:"super_admin" json:"super_admin"`
}

func (*AdminModel) HasPermission

func (a *AdminModel) HasPermission(p types.Permission) bool

type ArtistModel

type ArtistModel struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Name     string             `bson:"name" json:"name"`
	Type     types.SourceType   `bson:"type" json:"type"`
	UID      string             `bson:"uid" json:"uid"`
	Username string             `bson:"username" json:"username"`
}

func (*ArtistModel) ToArtist

func (artist *ArtistModel) ToArtist() *types.Artist

type ArtworkModel

type ArtworkModel struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Title       string             `bson:"title" json:"title"`
	Description string             `bson:"description" json:"description"`
	R18         bool               `bson:"r18" json:"r18"`
	CreatedAt   primitive.DateTime `bson:"created_at" json:"created_at"`
	SourceType  types.SourceType   `bson:"source_type" json:"source_type"`
	SourceURL   string             `bson:"source_url" json:"source_url"`
	LikeCount   uint               `bson:"like_count" json:"like_count"`

	ArtistID primitive.ObjectID   `bson:"artist_id" json:"artist_id"`
	Tags     []primitive.ObjectID `bson:"tags" json:"tags"`
	Pictures []primitive.ObjectID `bson:"pictures" json:"pictures"`
}

type CachedArtworksModel

type CachedArtworksModel struct {
	ID        primitive.ObjectID  `bson:"_id,omitempty" json:"id,omitempty"`
	SourceURL string              `bson:"source_url" json:"source_url"`
	CreatedAt primitive.DateTime  `bson:"created_at" json:"created_at"`
	Artwork   *types.Artwork      `bson:"artwork" json:"artwork"`
	Status    types.ArtworkStatus `bson:"status" json:"status"`
}

type CallbackDataModel

type CallbackDataModel struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	Data      string             `bson:"data" json:"data"`
	CreatedAt primitive.DateTime `bson:"created_at" json:"created_at"`
}

type DeletedModel

type DeletedModel struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	ArtworkID primitive.ObjectID `bson:"artwork_id" json:"artwork_id"`
	SourceURL string             `bson:"source_url" json:"source_url"`
	DeletedAt primitive.DateTime `bson:"deleted_at" json:"deleted_at"`
}

type FavoriteModel

type FavoriteModel struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	ArtworkID primitive.ObjectID `bson:"artwork_id"`
	UserID    primitive.ObjectID `bson:"user_id"`
}

type LikeModel

type LikeModel struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	ArtworkID primitive.ObjectID `bson:"artwork_id"`
	UserID    primitive.ObjectID `bson:"user_id"`
}

type PictureModel

type PictureModel struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	ArtworkID primitive.ObjectID `bson:"artwork_id" json:"artwork_id"`
	Index     uint               `bson:"index" json:"index"`
	Thumbnail string             `bson:"thumbnail" json:"thumbnail"`
	Original  string             `bson:"original" json:"original"`
	Width     uint               `bson:"width" json:"width"`
	Height    uint               `bson:"height" json:"height"`
	Hash      string             `bson:"hash" json:"hash"`
	BlurScore float64            `bson:"blur_score" json:"blur_score"`

	TelegramInfo *types.TelegramInfo `bson:"telegram_info" json:"telegram_info"`
	StorageInfo  *types.StorageInfo  `bson:"storage_info" json:"storage_info"`
}

func (*PictureModel) ToPicture

func (picture *PictureModel) ToPicture() *types.Picture

type TagModel

type TagModel struct {
	ID   primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	Name string             `bson:"name" json:"name"`
}

type UnauthUserModel

type UnauthUserModel struct {
	ID         primitive.ObjectID `bson:"_id,omitempty"`
	Code       string             `bson:"code"` // 注册验证码
	Username   string             `bson:"username"`
	TelegramID int64              `bson:"telegram_id"`
	Email      string             `bson:"email"`
	AuthMethod types.AuthMethod   `bson:"auth_method"`
	CreatedAt  primitive.DateTime `bson:"created_at"`
}

type UserModel

type UserModel struct {
	ID         primitive.ObjectID `bson:"_id,omitempty"`
	Username   string             `bson:"username"`
	Password   string             `bson:"password"`
	Email      string             `bson:"email"`
	TelegramID int64              `bson:"telegram_id"`
	Blocked    bool               `bson:"blocked"`
	UpdatedAt  primitive.DateTime `bson:"updated_at"`
	DeletedAt  primitive.DateTime `bson:"deleted_at,omitempty"`

	// Settings
	Settings *UserSettings `bson:"settings" json:"settings"`
}

type UserSettings

type UserSettings struct {
	Language string `bson:"language" json:"language"`
	Theme    string `bson:"theme" json:"theme"`
	R18      bool   `bson:"r18" json:"r18"`
}

Jump to

Keyboard shortcuts

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