2026-04-15 11:50:47 +08:00
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type UserProfileContentType string
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
UserProfileContentTypeAvatar UserProfileContentType = "avatar"
|
|
|
|
|
UserProfileContentTypeCover UserProfileContentType = "cover"
|
|
|
|
|
UserProfileContentTypeBio UserProfileContentType = "bio"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type UserProfileAuditStatus string
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
UserProfileAuditStatusPending UserProfileAuditStatus = "pending"
|
|
|
|
|
UserProfileAuditStatusApproved UserProfileAuditStatus = "approved"
|
|
|
|
|
UserProfileAuditStatusRejected UserProfileAuditStatus = "rejected"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type UserProfileAudit struct {
|
|
|
|
|
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
|
|
|
|
UserID string `json:"user_id" gorm:"type:varchar(36);index;not null"`
|
|
|
|
|
ContentType UserProfileContentType `json:"content_type" gorm:"type:varchar(20);index;not null"`
|
|
|
|
|
Content string `json:"content" gorm:"type:text;not null"`
|
|
|
|
|
Status UserProfileAuditStatus `json:"status" gorm:"type:varchar(20);default:pending;index"`
|
|
|
|
|
ReviewedAt *time.Time `json:"reviewed_at" gorm:"type:timestamp"`
|
|
|
|
|
ReviewedBy string `json:"reviewed_by" gorm:"type:varchar(50)"`
|
|
|
|
|
RejectReason string `json:"reject_reason" gorm:"type:text"`
|
|
|
|
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
|
|
|
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
|
|
|
|
|
|
|
|
|
User *User `json:"user" gorm:"foreignKey:UserID"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (a *UserProfileAudit) BeforeCreate(tx *gorm.DB) error {
|
2026-05-04 13:07:03 +08:00
|
|
|
SetUUIDIfEmpty(&a.ID)
|
2026-04-15 11:50:47 +08:00
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (UserProfileAudit) TableName() string {
|
|
|
|
|
return "user_profile_audits"
|
|
|
|
|
}
|