Feat: switch team; team model

This commit is contained in:
Grail Finder
2025-05-08 15:36:25 +03:00
parent 21948b23f4
commit 3cc2ecb93d
8 changed files with 122 additions and 60 deletions

View File

@ -31,19 +31,26 @@ func StrToWordColor(s string) WordColor {
}
}
type Team struct {
Guessers []string
Mime string
}
type Room struct {
ID string `json:"id" db:"id"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
// RoomName string `json:"room_name"`
RoomPass string `json:"room_pass"`
RoomLink string
CreatorName string `json:"creator_name"`
PlayerList []string `json:"player_list"`
TeamTurn string
RedMime string
BlueMime string
RedGuessers []string
BlueGuessers []string
RoomPass string `json:"room_pass"`
RoomLink string
CreatorName string `json:"creator_name"`
PlayerList []string `json:"player_list"`
TeamTurn string
RedTeam Team
BlueTeam Team
// RedMime string
// BlueMime string
// RedGuessers []string
// BlueGuessers []string
Cards []WordCard
GameSettings *GameSettings `json:"settings"`
Result uint8 // 0 for unknown; 1 is win for red; 2 if for blue;

View File

@ -75,13 +75,15 @@ func MakeTestState() *FullInfo {
{Word: "tomato", Color: "red"},
{Word: "cloud", Color: "white"},
}
redTeam := Team{Guessers: []string{"Adam", "Eve"}, Mime: "Serpent"}
blueTeam := Team{Guessers: []string{"Abel", "Kain"}}
room := &Room{
ID: "test-id",
CreatedAt: time.Now(),
CreatorName: "test-name",
Cards: cards,
RedGuessers: []string{"Adam", "Eve"},
BlueGuessers: []string{"Abel", "Kain"},
ID: "test-id",
CreatedAt: time.Now(),
CreatorName: "test-name",
Cards: cards,
RedTeam: redTeam,
BlueTeam: blueTeam,
}
us := &UserState{
Username: "test-name",