Enha: sse update on actions
This commit is contained in:
		| @@ -7,4 +7,6 @@ var ( | ||||
| 	// cache | ||||
| 	CacheRoomPrefix  = "room#" | ||||
| 	CacheStatePrefix = "state-" | ||||
| 	// sse | ||||
| 	NotifyRoomUpdatePrefix = "roomupdate_" | ||||
| ) | ||||
|   | ||||
| @@ -34,6 +34,7 @@ func StrToWordColor(s string) WordColor { | ||||
| type Team struct { | ||||
| 	Guessers []string | ||||
| 	Mime     string | ||||
| 	Color    string | ||||
| } | ||||
|  | ||||
| type Room struct { | ||||
| @@ -109,6 +110,14 @@ func (r *Room) RevealAllCards() { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (r *Room) RevealSpecificWord(word string) { | ||||
| 	for i, card := range r.Cards { | ||||
| 		if card.Word == word { | ||||
| 			r.Cards[i].Revealed = true | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| type WordCard struct { | ||||
| 	Word     string | ||||
| 	Color    WordColor | ||||
|   | ||||
| @@ -75,8 +75,8 @@ func MakeTestState(creatorName string) *FullInfo { | ||||
| 		{Word: "tomato", Color: "red"}, | ||||
| 		{Word: "cloud", Color: "white"}, | ||||
| 	} | ||||
| 	redTeam := Team{Guessers: []string{"Adam", "Eve"}, Mime: "Serpent"} | ||||
| 	blueTeam := Team{Guessers: []string{"Abel", "Kain"}} | ||||
| 	redTeam := Team{Guessers: []string{"Adam", "Eve"}, Mime: "Serpent", Color: "red"} | ||||
| 	blueTeam := Team{Guessers: []string{"Abel", "Kain"}, Color: "blue"} | ||||
| 	room := &Room{ | ||||
| 		ID:          "test-id", | ||||
| 		CreatedAt:   time.Now(), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder