nquest/pkg/models/cursor.go

30 lines
686 B
Go
Raw Permalink Normal View History

2024-01-05 03:50:33 +03:00
package models
import (
"time"
"github.com/google/uuid"
)
2024-01-05 03:50:33 +03:00
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"`
2024-01-05 03:50:33 +03:00
CreatedAt time.Time
FinishedAt *time.Time
Status CursorStatus
Codes []*Code `gorm:"many2many:passing_codes;"`
Finish bool
2024-01-05 03:50:33 +03:00
}
type CursorStatus int
const (
TaskStarted CursorStatus = iota
TaskFinished
TaskCanceled
)