/
Lobby.go
28 lines (26 loc) · 1.2 KB
/
Lobby.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package model
import (
"github.com/ably-labs/word-game/word-game-be/entity"
"time"
)
type Lobby struct {
ID *int64 `gorm:"primarykey" json:"-"`
// Poor JS gets upset with numbers this big, so we need to pass it as a string rather than an int64
IdStr string `gorm:"-" json:"id"`
Name string `json:"name"`
CreatorID *uint32 `json:"creatorId"`
CreatedAt time.Time `json:"createdAt"`
State entity.LobbyState `json:"state"`
Private bool `json:"private"`
Joinable bool `json:"joinable"`
CurrentPlayers uint8 `json:"currentPlayers"`
MaxPlayers uint8 `json:"maxPlayers"`
GameTypeID uint32 `json:"-"`
PlayerTurnID *uint32 `json:"playerTurnId"`
GameType GameType `json:"gameType"`
Members []LobbyMember `json:"-" gorm:"constraint:OnDelete:CASCADE;"`
Messages []Message `json:"-" gorm:"constraint:OnDelete:CASCADE;"`
Creator DisplayUser `json:"creator" gorm:"foreignKey:id;references:creator_id"`
Board entity.SquareSet `json:"-"`
Bag entity.SquareSet `json:"-"`
}