25 lines
613 B
Go
25 lines
613 B
Go
|
package models
|
||
|
|
||
|
import "time"
|
||
|
|
||
|
type GameCursor struct {
|
||
|
User *User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
|
||
|
UserID uint `gorm:"primaryKey"`
|
||
|
Game *Game `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
|
||
|
GameID uint `gorm:"primaryKey"`
|
||
|
Task *Task `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
|
||
|
TaskID uint `gorm:"primaryKey"`
|
||
|
CreatedAt time.Time
|
||
|
FinishedAt *time.Time
|
||
|
Status CursorStatus
|
||
|
Codes []*Code `gorm:"many2many:passing_codes;"`
|
||
|
}
|
||
|
|
||
|
type CursorStatus int
|
||
|
|
||
|
const (
|
||
|
TaskStarted CursorStatus = iota
|
||
|
TaskFinished
|
||
|
TaskCanceled
|
||
|
)
|