Some checks failed
CI / Lint + Build (push) Has been cancelled
变更模型: - Post: 嵌入 BaseModel,移除手动 ID/CreatedAt/UpdatedAt/DeletedAt - Comment: 嵌入 BaseModel,保留 is_deleted 自定义软删除 - Announcement: 嵌入 BaseModel - Category: 嵌入 BaseModel - Folder + FolderItem: 嵌入 BaseModel - CommunityFund: primaryKey → primarykey (统一小写)
30 lines
915 B
Go
30 lines
915 B
Go
package model
|
|
|
|
// time imported by common.go
|
|
|
|
// Folder 收藏夹
|
|
type Folder struct {
|
|
BaseModel
|
|
|
|
UserID uint `gorm:"index;not null" json:"user_id"`
|
|
Name string `gorm:"type:varchar(50);not null" json:"name"`
|
|
Description string `gorm:"type:varchar(200);default:''" json:"description"`
|
|
IsPublic bool `gorm:"default:false" json:"is_public"`
|
|
IsDefault bool `gorm:"default:false" json:"is_default"`
|
|
|
|
// 联表查询填充(非数据库字段)
|
|
ItemCount int64 `gorm:"-:migration;<-:false;column:item_count" json:"item_count,omitempty"`
|
|
}
|
|
|
|
// FolderItem 收藏记录
|
|
type FolderItem struct {
|
|
BaseModel
|
|
|
|
FolderID uint `gorm:"index;not null" json:"folder_id"`
|
|
PostID uint `gorm:"index;not null" json:"post_id"`
|
|
UserID uint `gorm:"index;not null" json:"user_id"`
|
|
|
|
// 联表查询填充
|
|
PostTitle string `gorm:"-:migration;<-:false;column:post_title" json:"post_title,omitempty"`
|
|
}
|