The tournament host (and anyone with the necessary permissions) must be able to have a flexible system to cover different tournament formats.
How?
For each procedure:
Take the tournament's ID as input.
Apply rate limit middleware.
Error if the tournament has concluded or is marked as deleted.
If the create and update procedures end up being too complex to implement as a single procedure, each operation can be divided into three procedures, for each type of round (so instead of (createRound, you'd have createStandardRound, createQualifiersRound, createBattleRoyaleRound).
Create round
Insert a record into the Round table.
Input:name, type, targetStarRating, tournamentId and config.
Conditions
The value for order must be one greater than the amount of staff roles in that tournament.
The value for config field depends on the value of type. If type is groups, swiss, single_elim or double_elim then config must be of type StandardRoundConfig; if type is qualifiers then QualifierRoundConfig and if battle_royale then BattleRoyaleRoundConfig.
The unique constraint uni_round_name_tournament_id violation must be caught for the frontend to display as an error.
Error if there's already 12 rounds in the tournament.
Error if the player regs. are closed (after they've been open).
Update round
Update the Round record by Round.id.
Input:name, targetStarRating and playtestingPool, publishPool, publishSchedules, publishStats and config.
Conditions
The unique constraint uni_round_name_tournament_id violation must be caught for the frontend to display as an error.
As stated previously, config can be updated in this procedure, but the config must match the corresponding type (as defined in the "Create round" section above this one). This means that you can update the config of the round, but without changing it's type, so, a round that was created with a StandardRoundConfig can be overwritten by a config with the same type but it can't be updated to QualifierRoundConfig or BattleRoyaleRoundConfig.
config can't be updated once publishSchedules is equal to true.
Swap round order
The order field dictates the order in which the rounds are displayed within the tournament. The procedure must take as input the Round.id of the two roles to swap the orders of and execute a transaction that updates the order field values accordingly.
Conditions
Error if the player regs. are closed (after they've been open).
Delete round
Delete the Round record by Round.id. The value for order must also be updated for whatever round had its order value greater than the round that will be deleted.
Conditions
Error if the player regs. are closed (after they've been open).
Why?
The tournament host (and anyone with the necessary permissions) must be able to have a flexible system to cover different tournament formats.
How?
For each procedure:
If the create and update procedures end up being too complex to implement as a single procedure, each operation can be divided into three procedures, for each type of round (so instead of (
createRound
, you'd havecreateStandardRound
,createQualifiersRound
,createBattleRoyaleRound
).Create round
Insert a record into the Round table.
Input:
name
,type
,targetStarRating
,tournamentId
andconfig
.Conditions
order
must be one greater than the amount of staff roles in that tournament.config
field depends on the value oftype
. Iftype
isgroups
,swiss
,single_elim
ordouble_elim
thenconfig
must be of typeStandardRoundConfig
; iftype
isqualifiers
thenQualifierRoundConfig
and ifbattle_royale
thenBattleRoyaleRoundConfig
.uni_round_name_tournament_id
violation must be caught for the frontend to display as an error.Update round
Update the Round record by Round.id.
Input:
name
,targetStarRating
andplaytestingPool
,publishPool
,publishSchedules
,publishStats
andconfig
.Conditions
uni_round_name_tournament_id
violation must be caught for the frontend to display as an error.config
can be updated in this procedure, but the config must match the correspondingtype
(as defined in the "Create round" section above this one). This means that you can update the config of the round, but without changing it's type, so, a round that was created with aStandardRoundConfig
can be overwritten by a config with the same type but it can't be updated toQualifierRoundConfig
orBattleRoyaleRoundConfig
.config
can't be updated oncepublishSchedules
is equal to true.Swap round order
The
order
field dictates the order in which the rounds are displayed within the tournament. The procedure must take as input the Round.id of the two roles to swap the orders of and execute a transaction that updates the order field values accordingly.Conditions
Delete round
Delete the Round record by Round.id. The value for
order
must also be updated for whatever round had its order value greater than the round that will be deleted.Conditions