Add RSVP role synchronization and localization support for Discord
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / compose (push) Has been cancelled

This commit introduces functionality for managing event-specific RSVP roles in Discord, including roles for "Registered", "Going", "Maybe", and "Not Going". The `RoleWorker` has been enhanced to handle these roles based on user registrations, with localization support for role names in Russian and English. Additionally, the database schema has been updated to accommodate new role types and actions, and the service layer has been modified to trigger role synchronization upon relevant event updates. Tests have been added to ensure the correct behavior of the new RSVP handling logic.
This commit is contained in:
2026-07-19 11:42:40 +03:00
parent c3624376b0
commit 966c81ba12
12 changed files with 373 additions and 40 deletions

View File

@@ -215,6 +215,7 @@ func (s *Service) UpdateEvent(ctx context.Context, actor domain.Account, eventID
if err == nil {
_ = s.Store.AppendAudit(ctx, actor.ID, "event.updated", eventID, out)
s.Bus.Publish("events", out)
s.enqueueDiscordRoleSync(ctx, eventID, DiscordRoleActionRSVP)
}
return out, err
}
@@ -248,6 +249,7 @@ func (s *Service) SetRSVP(ctx context.Context, actor domain.Account, actorPlayer
if err == nil {
_ = s.Store.AppendAudit(ctx, actor.ID, "rsvp.set", eventID, out)
s.Bus.Publish("event:"+eventID, out)
s.enqueueDiscordRoleSync(ctx, eventID, DiscordRoleActionRSVP)
}
return out, err
}
@@ -268,6 +270,7 @@ func (s *Service) RemoveParticipant(ctx context.Context, actor domain.Account, e
}
_ = s.Store.AppendAudit(ctx, actor.ID, "participant.removed", eventID, map[string]string{"playerId": playerID})
s.Bus.Publish("event:"+eventID, map[string]string{"removedPlayerId": playerID})
s.enqueueDiscordRoleSync(ctx, eventID, DiscordRoleActionRSVP)
return nil
}
@@ -313,6 +316,7 @@ func (s *Service) CreateParticipant(ctx context.Context, actor domain.Account, e
_ = s.Store.AppendAudit(ctx, actor.ID, "participant.created", eventID, map[string]any{"player": player, "rsvp": rsvp})
s.Bus.Publish("event:"+eventID, rsvp)
s.Bus.Publish("players", player)
s.enqueueDiscordRoleSync(ctx, eventID, DiscordRoleActionRSVP)
}
return player, rsvp, err
}