nquest/pkg/models/cursor.go

25 lines
613 B
Go
Raw Normal View History

2024-01-05 03:50:33 +03:00
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
)