Enha: state to hold room_id instead of whole room

This commit is contained in:
Grail Finder
2025-05-08 10:25:38 +03:00
parent 3ade7310a7
commit b20f7ac6b7
12 changed files with 110 additions and 35 deletions

View File

@ -42,12 +42,12 @@ func StrToUserRole(s string) UserRole {
type UserState struct {
Username string
Room Room
RoomID string
Team UserTeam
Role UserRole
}
func MakeTestState() *UserState {
func MakeTestState() *FullInfo {
cards := []WordCard{
{Word: "hamster", Color: "blue"},
{Word: "child", Color: "red"},
@ -75,17 +75,21 @@ func MakeTestState() *UserState {
{Word: "tomato", Color: "red"},
{Word: "cloud", Color: "white"},
}
room := Room{
room := &Room{
ID: "test-id",
CreatedAt: time.Now(),
CreatorName: "test-name",
Cards: cards,
}
return &UserState{
us := &UserState{
Username: "test-name",
Team: UserTeamNone,
Role: UserRoleNone,
Room: room,
RoomID: "test-id",
}
return &FullInfo{
State: us,
Room: room,
}
}