Enha: state to hold room_id instead of whole room
This commit is contained in:
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user