feat: add content report governance

This commit is contained in:
2026-01-16 11:36:04 +08:00
parent 3af3c854c9
commit 609ca7b980
18 changed files with 2480 additions and 101 deletions

View File

@@ -0,0 +1,67 @@
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
package models
import (
"context"
"time"
"go.ipao.vip/gen"
)
const TableNameContentReport = "content_reports"
// ContentReport mapped from table <content_reports>
type ContentReport struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键ID。" json:"id"` // 主键ID。
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null;comment:租户ID用途跨租户筛选与归属约束必须存在。" json:"tenant_id"` // 租户ID用途跨租户筛选与归属约束必须存在。
ContentID int64 `gorm:"column:content_id;type:bigint;not null;comment:内容ID用途定位被举报内容约束必须存在。" json:"content_id"` // 内容ID用途定位被举报内容约束必须存在。
ReporterID int64 `gorm:"column:reporter_id;type:bigint;not null;comment:举报用户ID用途追溯举报来源约束必须存在。" json:"reporter_id"` // 举报用户ID用途追溯举报来源约束必须存在。
Reason string `gorm:"column:reason;type:character varying(64);not null;comment:举报原因;用途:快速分类;约束:建议前端枚举。" json:"reason"` // 举报原因;用途:快速分类;约束:建议前端枚举。
Detail string `gorm:"column:detail;type:text;not null;comment:举报描述;用途:补充说明与证据描述;可为空字符串。" json:"detail"` // 举报描述;用途:补充说明与证据描述;可为空字符串。
Status string `gorm:"column:status;type:character varying(32);not null;default:pending;comment:处置状态用途pending/approved/rejected约束默认 pending。" json:"status"` // 处置状态用途pending/approved/rejected约束默认 pending。
HandledBy int64 `gorm:"column:handled_by;type:bigint;not null;comment:处理人ID用途审计追踪默认 0 表示未处理。" json:"handled_by"` // 处理人ID用途审计追踪默认 0 表示未处理。
HandledAction string `gorm:"column:handled_action;type:character varying(32);not null;comment:处理动作;用途:记录处置动作如 block/unpublish/ignore可为空字符串。" json:"handled_action"` // 处理动作;用途:记录处置动作如 block/unpublish/ignore可为空字符串。
HandledReason string `gorm:"column:handled_reason;type:character varying(255);not null;comment:处理说明;用途:超管处理备注;可为空字符串。" json:"handled_reason"` // 处理说明;用途:超管处理备注;可为空字符串。
HandledAt time.Time `gorm:"column:handled_at;type:timestamp with time zone;comment:处理时间;用途:追踪处理时效;未处理为空。" json:"handled_at"` // 处理时间;用途:追踪处理时效;未处理为空。
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;not null;default:now();comment:创建时间;用途:统计与排序。" json:"created_at"` // 创建时间;用途:统计与排序。
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;not null;default:now();comment:更新时间;用途:状态变化追踪。" json:"updated_at"` // 更新时间;用途:状态变化追踪。
}
// Quick operations without importing query package
// Update applies changed fields to the database using the default DB.
func (m *ContentReport) Update(ctx context.Context) (gen.ResultInfo, error) {
return Q.ContentReport.WithContext(ctx).Updates(m)
}
// Save upserts the model using the default DB.
func (m *ContentReport) Save(ctx context.Context) error {
return Q.ContentReport.WithContext(ctx).Save(m)
}
// Create inserts the model using the default DB.
func (m *ContentReport) Create(ctx context.Context) error {
return Q.ContentReport.WithContext(ctx).Create(m)
}
// Delete removes the row represented by the model using the default DB.
func (m *ContentReport) Delete(ctx context.Context) (gen.ResultInfo, error) {
return Q.ContentReport.WithContext(ctx).Delete(m)
}
// ForceDelete permanently deletes the row (ignores soft delete) using the default DB.
func (m *ContentReport) ForceDelete(ctx context.Context) (gen.ResultInfo, error) {
return Q.ContentReport.WithContext(ctx).Unscoped().Delete(m)
}
// Reload reloads the model from database by its primary key and overwrites current fields.
func (m *ContentReport) Reload(ctx context.Context) error {
fresh, err := Q.ContentReport.WithContext(ctx).GetByID(m.ID)
if err != nil {
return err
}
*m = *fresh
return nil
}