feat(publish): 正式表加发布状态与公开只读视图
This commit is contained in:
17
internal/model/content_status.go
Normal file
17
internal/model/content_status.go
Normal file
@ -0,0 +1,17 @@
|
||||
package model
|
||||
|
||||
// 内容发布状态(单表发布模型)。
|
||||
//
|
||||
// 历史上「爬虫草稿」与「正式记录」是两张表,审核 = 从草稿晋升到正式表。
|
||||
// 现在合并为一张表,审核态由本字段承载:
|
||||
// - pending:刚入库,等待审核;公开视图不可见
|
||||
// - published:已通过,对外可见
|
||||
// - rejected:已驳回,留在库中备查;公开视图不可见
|
||||
//
|
||||
// 新增记录默认 pending(见各自模型的 gorm default),漏赋值的结果是「不可见」,
|
||||
// 即 fail-closed,而不是意外对外发布。
|
||||
const (
|
||||
StatusPending = "pending"
|
||||
StatusPublished = "published"
|
||||
StatusRejected = "rejected"
|
||||
)
|
||||
@ -22,6 +22,12 @@ type BrandRunway struct {
|
||||
CollectionType string `gorm:"column:collection_type;size:16;not null;default:''" json:"collection_type"` // rtw/menswear/couture/resort/pre_fall
|
||||
Season string `gorm:"column:season;size:8" json:"season"` // spring/fall/null
|
||||
SeasonCode string `gorm:"column:season_code;size:8;not null;default:''" json:"season_code"` // SS26/FW25/RES26/PF25
|
||||
|
||||
// 审核态与溯源(单表发布模型;列由 db/migrations/2026-09-22-01-single-table-publish.sql 添加)。
|
||||
Status string `gorm:"column:status;size:16;not null;default:'pending'" json:"status"`
|
||||
JobID uint32 `gorm:"column:job_id;not null;default:0" json:"job_id"` // 关联 ingest_jobs.id(重跑溯源)
|
||||
Reviewer string `gorm:"column:reviewer;size:64;not null;default:''" json:"reviewer"` // 审核人(admin 账号)
|
||||
RejectReason string `gorm:"column:reject_reason;size:255;not null;default:''" json:"reject_reason"`
|
||||
}
|
||||
|
||||
// TableName 指定表名。
|
||||
@ -43,6 +49,7 @@ type RunwayRow struct {
|
||||
CollectionType string `gorm:"column:collection_type"`
|
||||
Season string `gorm:"column:season"`
|
||||
SeasonCode string `gorm:"column:season_code"`
|
||||
Status string `gorm:"column:status"`
|
||||
CreatedAt uint32 `gorm:"column:created_at"`
|
||||
BrandNameEn string `gorm:"column:brand_name_en"`
|
||||
BrandNameCn string `gorm:"column:brand_name_cn"`
|
||||
|
||||
@ -15,7 +15,14 @@ type StreetSnap struct {
|
||||
ImageCount uint16 `gorm:"column:image_count" json:"image_count"`
|
||||
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
|
||||
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
|
||||
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
|
||||
|
||||
// 审核态与溯源(单表发布模型;列由 db/migrations/2026-09-22-01-single-table-publish.sql 添加)。
|
||||
Status string `gorm:"column:status;size:16;not null;default:'pending'" json:"status"`
|
||||
JobID uint32 `gorm:"column:job_id;not null;default:0" json:"job_id"`
|
||||
Reviewer string `gorm:"column:reviewer;size:64;not null;default:''" json:"reviewer"`
|
||||
RejectReason string `gorm:"column:reject_reason;size:255;not null;default:''" json:"reject_reason"`
|
||||
|
||||
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
|
||||
}
|
||||
|
||||
// TableName 指定主表名。
|
||||
|
||||
Reference in New Issue
Block a user