Add event management features to API, including event cancellation, deletion, registration closure, and workflow balance generation. Introduce new roster management endpoints and enhance participant handling with avoided player preferences. Update database schema and service logic to support these changes.
This commit is contained in:
30
backend/migrations/006_event_workflow.sql
Normal file
30
backend/migrations/006_event_workflow.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- +mixmaker Up
|
||||
ALTER TABLE events
|
||||
ADD COLUMN IF NOT EXISTS state text NOT NULL DEFAULT 'RegistrationOpen',
|
||||
ADD COLUMN IF NOT EXISTS version integer NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS ruleset_id text NOT NULL DEFAULT 'standard-control-hybrid-control',
|
||||
ADD COLUMN IF NOT EXISTS active_series_id text NOT NULL DEFAULT '',
|
||||
ADD COLUMN IF NOT EXISTS tournament_id text NOT NULL DEFAULT '';
|
||||
|
||||
ALTER TABLE events
|
||||
DROP CONSTRAINT IF EXISTS events_state_check,
|
||||
ADD CONSTRAINT events_state_check CHECK (state IN (
|
||||
'RegistrationOpen', 'RegistrationClosed', 'Balancing',
|
||||
'RostersDraft', 'RostersConfirmed', 'Live', 'Completed'
|
||||
));
|
||||
|
||||
CREATE TABLE IF NOT EXISTS event_rosters (
|
||||
event_id text PRIMARY KEY REFERENCES events(id) ON DELETE CASCADE,
|
||||
body jsonb NOT NULL,
|
||||
version integer NOT NULL DEFAULT 0,
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- +mixmaker Down
|
||||
DROP TABLE IF EXISTS event_rosters;
|
||||
ALTER TABLE events
|
||||
DROP COLUMN IF EXISTS tournament_id,
|
||||
DROP COLUMN IF EXISTS active_series_id,
|
||||
DROP COLUMN IF EXISTS ruleset_id,
|
||||
DROP COLUMN IF EXISTS version,
|
||||
DROP COLUMN IF EXISTS state;
|
||||
7
backend/migrations/007_player_avoids.sql
Normal file
7
backend/migrations/007_player_avoids.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- +mixmaker Up
|
||||
ALTER TABLE players
|
||||
ADD COLUMN IF NOT EXISTS avoided_player_ids jsonb NOT NULL DEFAULT '[]'::jsonb;
|
||||
|
||||
-- +mixmaker Down
|
||||
ALTER TABLE players
|
||||
DROP COLUMN IF EXISTS avoided_player_ids;
|
||||
14
backend/migrations/008_cancelled_events.sql
Normal file
14
backend/migrations/008_cancelled_events.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- +mixmaker Up
|
||||
ALTER TABLE events DROP CONSTRAINT IF EXISTS events_state_check;
|
||||
ALTER TABLE events ADD CONSTRAINT events_state_check CHECK (state IN (
|
||||
'RegistrationOpen', 'RegistrationClosed', 'Balancing',
|
||||
'RostersDraft', 'RostersConfirmed', 'Live', 'Completed', 'Cancelled'
|
||||
));
|
||||
|
||||
-- +mixmaker Down
|
||||
UPDATE events SET state = 'Completed' WHERE state = 'Cancelled';
|
||||
ALTER TABLE events DROP CONSTRAINT IF EXISTS events_state_check;
|
||||
ALTER TABLE events ADD CONSTRAINT events_state_check CHECK (state IN (
|
||||
'RegistrationOpen', 'RegistrationClosed', 'Balancing',
|
||||
'RostersDraft', 'RostersConfirmed', 'Live', 'Completed'
|
||||
));
|
||||
Reference in New Issue
Block a user