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.
30 lines
1.4 KiB
SQL
30 lines
1.4 KiB
SQL
-- +mixmaker Up
|
|
ALTER TABLE discord_managed_roles DROP CONSTRAINT IF EXISTS discord_managed_roles_kind_check;
|
|
ALTER TABLE discord_managed_roles ADD CONSTRAINT discord_managed_roles_kind_check CHECK (
|
|
kind IN ('tank', 'damage', 'support', 'team', 'captain', 'registered', 'going', 'maybe', 'not_going')
|
|
);
|
|
|
|
ALTER TABLE discord_role_sync_jobs DROP CONSTRAINT IF EXISTS discord_role_sync_jobs_action_check;
|
|
ALTER TABLE discord_role_sync_jobs ADD CONSTRAINT discord_role_sync_jobs_action_check CHECK (
|
|
action IN ('reconcile', 'rsvp', 'teardown')
|
|
);
|
|
|
|
-- +mixmaker Down
|
|
DELETE FROM discord_role_assignments
|
|
WHERE discord_role_id IN (
|
|
SELECT discord_role_id FROM discord_managed_roles
|
|
WHERE kind IN ('registered', 'going', 'maybe', 'not_going')
|
|
);
|
|
DELETE FROM discord_managed_roles
|
|
WHERE kind IN ('registered', 'going', 'maybe', 'not_going');
|
|
DELETE FROM discord_role_sync_jobs WHERE action='rsvp';
|
|
|
|
ALTER TABLE discord_managed_roles DROP CONSTRAINT IF EXISTS discord_managed_roles_kind_check;
|
|
ALTER TABLE discord_managed_roles ADD CONSTRAINT discord_managed_roles_kind_check CHECK (
|
|
kind IN ('tank', 'damage', 'support', 'team', 'captain')
|
|
);
|
|
ALTER TABLE discord_role_sync_jobs DROP CONSTRAINT IF EXISTS discord_role_sync_jobs_action_check;
|
|
ALTER TABLE discord_role_sync_jobs ADD CONSTRAINT discord_role_sync_jobs_action_check CHECK (
|
|
action IN ('reconcile', 'teardown')
|
|
);
|