nquest/pkg/models/task.go

30 lines
512 B
Go

package models
type Task struct {
Model
Title string
Text string
MaxTime int
GameID uint
Solutions []*Solution `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Codes []*Code `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Next *Task `gorm:"foreignKey:NextID"`
NextID *uint
}
type Solution struct {
Model
TaskID uint
After int
Text string
}
type Code struct {
Model
TaskID uint
Code string `gorm:"index"`
Description string
}