nquest/pkg/models/cursor.go

29 lines
686 B
Go

package models
import (
"time"
"github.com/google/uuid"
)
type GameCursor struct {
User *User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
UserID uuid.UUID `gorm:"primaryKey"`
Game *Game `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
GameID uuid.UUID `gorm:"primaryKey"`
Task *Task `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
TaskID uuid.UUID `gorm:"primaryKey"`
CreatedAt time.Time
FinishedAt *time.Time
Status CursorStatus
Codes []*Code `gorm:"many2many:passing_codes;"`
Finish bool
}
type CursorStatus int
const (
TaskStarted CursorStatus = iota
TaskFinished
TaskCanceled
)