nquest/pkg/models/game.go

32 lines
640 B
Go
Raw Normal View History

2023-11-01 23:21:12 +03:00
package models
2024-01-28 22:19:41 +03:00
import (
"time"
2024-01-20 21:37:49 +03:00
2024-01-28 22:19:41 +03:00
"github.com/google/uuid"
"gorm.io/gorm"
)
2023-11-01 23:21:12 +03:00
2024-01-28 22:19:41 +03:00
type Game struct {
ID uuid.UUID `gorm:"primarykey" json:"id"`
Visible bool `gorm:"index"`
2023-11-01 23:21:12 +03:00
Title string
Description string
2024-01-05 03:50:33 +03:00
Tasks []*Task `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
2023-11-19 22:54:54 +03:00
Authors []*User `gorm:"many2many:game_authors"`
2024-01-05 03:50:33 +03:00
Type GameType
Points int
2024-01-20 21:37:49 +03:00
Icon *File
IconID uuid.UUID
2024-01-28 22:19:41 +03:00
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
2023-11-01 23:21:12 +03:00
}
2024-01-05 03:50:33 +03:00
type GameType int
2023-11-01 23:21:12 +03:00
const (
2024-01-05 03:50:33 +03:00
VirtualGame GameType = iota
CityGame
2023-11-01 23:21:12 +03:00
)