Fix: actions to have room_id
This commit is contained in:
@ -173,6 +173,8 @@ func HandleStartGame(w http.ResponseWriter, r *http.Request) {
|
||||
fi.Room.UpdateCounter()
|
||||
fi.Room.TeamWon = ""
|
||||
action := models.Action{
|
||||
RoomID: fi.Room.ID,
|
||||
CreatedAt: time.Now(),
|
||||
Actor: fi.State.Username,
|
||||
ActorColor: string(fi.State.Team),
|
||||
WordColor: string(fi.State.Team),
|
||||
@ -188,8 +190,6 @@ func HandleStartGame(w http.ResponseWriter, r *http.Request) {
|
||||
// return
|
||||
// }
|
||||
// Save action history
|
||||
action.RoomID = fi.Room.ID
|
||||
action.CreatedAt = time.Now()
|
||||
if err := repo.ActionCreate(ctx, &action); err != nil {
|
||||
if err := tx.Rollback(); err != nil {
|
||||
log.Error("failed to rollback transaction", "error", err)
|
||||
|
Reference in New Issue
Block a user