31 lines
696 B
Go
31 lines
696 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Game struct {
|
|
ID uuid.UUID `gorm:"primarykey" json:"id"`
|
|
Visible bool `gorm:"index"`
|
|
Title string
|
|
Description string
|
|
Tasks []*Task `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
|
Authors []*User `gorm:"many2many:game_authors"`
|
|
Type GameType
|
|
Points int
|
|
Icon *File `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
|
IconID *uuid.UUID
|
|
CreatedAt time.Time `json:"-"`
|
|
UpdatedAt time.Time `json:"-"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
}
|
|
|
|
type GameType int
|
|
|
|
const (
|
|
VirtualGame GameType = iota
|
|
CityGame
|
|
)
|