Chore: actions methods rename

This commit is contained in:
Grail Finder
2025-07-04 14:30:13 +03:00
parent 705881f1ea
commit 2a2bf4e23d
5 changed files with 23 additions and 20 deletions

View File

@ -68,6 +68,11 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) {
WordColor: string(color),
Action: models.ActionTypeGuess,
Word: word,
RoomID: fi.Room.ID,
}
if err := repo.ActionCreate(r.Context(), &action); err != nil {
abortWithError(w, err.Error())
return
}
fi.Room.ActionHistory = append(fi.Room.ActionHistory, action)
// if opened card is of color of opp team, change turn

View File

@ -200,7 +200,7 @@ func HandleStartGame(w http.ResponseWriter, r *http.Request) {
// Save action history
action.RoomID = fi.Room.ID
action.CreatedAt = time.Now()
if err := repo.CreateAction(ctx, &action); err != nil {
if err := repo.ActionCreate(ctx, &action); err != nil {
if err := tx.Rollback(); err != nil {
log.Error("failed to rollback transaction", "error", err)
}
@ -338,7 +338,7 @@ func HandleGiveClue(w http.ResponseWriter, r *http.Request) {
Number: num,
}
fi.Room.ActionHistory = append(fi.Room.ActionHistory, action)
if err := repo.CreateAction(r.Context(), &action); err != nil {
if err := repo.ActionCreate(r.Context(), &action); err != nil {
abortWithError(w, err.Error())
return
}