package models import ( "time" "github.com/google/uuid" "gorm.io/gorm" ) type Quiz struct { ID uuid.UUID `gorm:"type:uuid;primaryKey;default:uuid_generate_v4()" json:"id"` Name string `gorm:"not null" json:"name"` Config interface{} `gorm:"type:jsonb" json:"config"` CreatedBy uuid.UUID `gorm:"type:uuid;not null" json:"created_by"` UpdatedBy uuid.UUID `gorm:"type:uuid" json:"updated_by"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Creator User `gorm:"foreignKey:CreatedBy;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"creator,omitempty"` Updater User `gorm:"foreignKey:UpdatedBy;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"updater,omitempty"` } func (Quiz) TableName() string { return "quizzes" }