Files
backend/internal/model/verification.go

41 lines
1.3 KiB
Go
Raw Normal View History

package model
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
type VerificationRecord struct {
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
UserID string `json:"user_id" gorm:"type:varchar(36);index;not null"`
Identity UserIdentity `json:"identity" gorm:"type:varchar(20);not null"`
Status VerificationStatus `json:"status" gorm:"type:varchar(20);default:pending"`
RealName string `json:"real_name" gorm:"type:varchar(100)"`
StudentID string `json:"student_id" gorm:"type:varchar(50)"`
EmployeeID string `json:"employee_id" gorm:"type:varchar(50)"`
Department string `json:"department" gorm:"type:varchar(200)"`
ProofMaterials string `json:"proof_materials" gorm:"type:text"`
ReviewedAt *time.Time `json:"reviewed_at" gorm:"type:timestamp"`
ReviewedBy *string `json:"reviewed_by" gorm:"type:varchar(36)"`
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"`
}
func (v *VerificationRecord) BeforeCreate(tx *gorm.DB) error {
if v.ID == "" {
v.ID = uuid.New().String()
}
return nil
}
func (VerificationRecord) TableName() string {
return "verification_records"
}