feat: execute competition result commands atomically
This commit is contained in:
1 parent
3b274b4ec2
commit
0c31a78df0
3 files changed
+984
No files matched your search
@@ -0,0 +1,23 @@
|
||||
export type CompetitionCommandErrorCode =
|
||||
| 'COMPETITION_NOT_FOUND'
|
||||
| 'COMPETITION_TRANSACTION_UNAVAILABLE'
|
||||
| 'IDEMPOTENCY_KEY_CONFLICT'
|
||||
| 'INVALID_COMPETITION_COMMAND'
|
||||
| 'STALE_COMPETITION_REVISION'
|
||||
| 'TOURNAMENT_CODE_ASSIGNMENT_CONFLICT';
|
||||
|
||||
/**
|
||||
* Transport-neutral command failure. Controllers may translate `httpStatus`
|
||||
* directly while command handlers remain usable by jobs and migrations.
|
||||
*/
|
||||
export class CompetitionCommandError extends Error {
|
||||
constructor(
|
||||
public readonly code: CompetitionCommandErrorCode,
|
||||
message: string,
|
||||
public readonly httpStatus: 404 | 409 | 412 | 422 | 500,
|
||||
public readonly details?: Readonly<Record<string, unknown>>,
|
||||
) {
|
||||
super(message);
|
||||
this.name = 'CompetitionCommandError';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user