Feat: card_mark repo

This commit is contained in:
Grail Finder
2025-07-05 09:14:45 +03:00
parent 56845e6141
commit 413edae4b6
8 changed files with 70 additions and 35 deletions

View File

@ -201,7 +201,6 @@ func HandleMarkCard(w http.ResponseWriter, r *http.Request) {
abortWithError(w, err.Error())
return
}
// color, exists := fi.Room.WCMap[word]
color, exists := fi.Room.FindColor(word)
log.Debug("got mark-card request", "word", word, "color", color)
if !exists {
@ -221,7 +220,7 @@ func HandleMarkCard(w http.ResponseWriter, r *http.Request) {
// Check if the current user already has an active mark on this card
found := false
var newMarks []models.CardMark
for _, mark := range card.Mark {
for _, mark := range card.Marks {
if mark.Username == fi.State.Username && mark.Active {
found = true
} else {
@ -234,7 +233,7 @@ func HandleMarkCard(w http.ResponseWriter, r *http.Request) {
Active: true,
})
}
fi.Room.Cards[i].Mark = newMarks
fi.Room.Cards[i].Marks = newMarks
cardword = fi.Room.Cards[i]
}
if err := saveFullInfo(r.Context(), fi); err != nil {