feat: initial commit
This commit is contained in:
26
models/quiz.go
Normal file
26
models/quiz.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user