Add Discord event announcement functionality to backend
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / compose (push) Has been cancelled

This commit introduces a new Discord event announcer to the backend, allowing for event announcements via Discord. It includes the addition of new environment variables for Discord configuration in `.env.example` and `compose.yaml`. The `main.go` file has been updated to initialize the announcer, and a new `discord` package has been created, containing the announcer logic and tests. Additionally, the service layer has been modified to support bracket draft management, enhancing the overall event workflow. Integration tests have been updated to ensure proper functionality of the new features.
This commit is contained in:
2026-07-19 11:21:11 +03:00
parent b7a78b4384
commit ae19c03542
31 changed files with 1632 additions and 88 deletions

View File

@@ -246,6 +246,47 @@ paths:
responses:
"200": { description: Live tournament bracket, content: { application/json: { schema: { $ref: "#/components/schemas/Tournament" } } } }
"404": { $ref: "#/components/responses/NotFound" }
/api/events/{eventId}/bracket-draft:
get:
tags: [Tournaments]
operationId: getBracketDraft
parameters: [{ $ref: "#/components/parameters/EventId" }]
responses:
"200": { description: Editable bracket graph, content: { application/json: { schema: { $ref: "#/components/schemas/BracketDraft" } } } }
put:
tags: [Tournaments]
operationId: updateBracketDraft
parameters: [{ $ref: "#/components/parameters/EventId" }]
requestBody:
required: true
content: { application/json: { schema: { $ref: "#/components/schemas/BracketUpdateCommand" } } }
responses:
"200": { description: Updated graph, content: { application/json: { schema: { $ref: "#/components/schemas/BracketDraft" } } } }
"409": { $ref: "#/components/responses/Conflict" }
/api/events/{eventId}/bracket-draft/initialize:
post:
tags: [Tournaments]
operationId: initializeBracketDraft
parameters: [{ $ref: "#/components/parameters/EventId" }]
requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/VersionCommand" } } } }
responses:
"201": { description: Default bracket graph, content: { application/json: { schema: { $ref: "#/components/schemas/BracketDraft" } } } }
/api/events/{eventId}/bracket-draft/reset:
post:
tags: [Tournaments]
operationId: resetBracketDraft
parameters: [{ $ref: "#/components/parameters/EventId" }]
requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/VersionCommand" } } } }
responses:
"200": { description: Reset bracket graph, content: { application/json: { schema: { $ref: "#/components/schemas/BracketDraft" } } } }
/api/events/{eventId}/bracket-draft/confirm:
post:
tags: [Tournaments]
operationId: confirmBracketDraft
parameters: [{ $ref: "#/components/parameters/EventId" }]
requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/VersionCommand" } } } }
responses:
"200": { description: Confirmed bracket graph, content: { application/json: { schema: { $ref: "#/components/schemas/BracketDraft" } } } }
/api/events/{eventId}/rsvps:
get:
tags: [Events]
@@ -1012,7 +1053,7 @@ components:
format: date-time
state:
type: string
enum: [RegistrationOpen, RegistrationClosed, Balancing, RostersDraft, RostersConfirmed, Live, Completed, Cancelled]
enum: [RegistrationOpen, RegistrationClosed, Balancing, RostersDraft, RostersConfirmed, BracketDraft, Live, Completed, Cancelled]
version: { type: integer }
rulesetId: { type: string }
activeSeriesId: { type: string }
@@ -1229,9 +1270,45 @@ components:
type: object
version:
type: integer
BracketSlotSource:
type: object
required: [kind]
properties:
kind: { type: string, enum: [Team, Winner, Loser] }
teamId: { type: string }
matchId: { type: string }
BracketMatch:
type: object
required: [id, round, order, slotA, slotB]
properties:
id: { type: string }
round: { type: integer, minimum: 0 }
order: { type: integer, minimum: 0 }
slotA: { $ref: "#/components/schemas/BracketSlotSource" }
slotB: { $ref: "#/components/schemas/BracketSlotSource" }
seriesId: { type: string }
teamAId: { type: string }
teamBId: { type: string }
winnerTeamId: { type: string }
series: { $ref: "#/components/schemas/Series" }
BracketDraft:
type: object
required: [eventId, teamIds, matches, version, confirmed]
properties:
eventId: { type: string }
teamIds: { type: array, items: { type: string } }
matches: { type: array, items: { $ref: "#/components/schemas/BracketMatch" } }
version: { type: integer }
confirmed: { type: boolean }
BracketUpdateCommand:
type: object
required: [matches, expectedVersion]
properties:
matches: { type: array, items: { $ref: "#/components/schemas/BracketMatch" } }
expectedVersion: { type: integer }
Tournament:
type: object
required: [id, eventId, name, winnerTeamId, teamIds, rounds]
required: [id, eventId, name, winnerTeamId, teamIds, matches, rounds, version]
properties:
id:
type: string
@@ -1245,12 +1322,17 @@ components:
type: array
items:
type: string
matches:
type: array
items:
$ref: "#/components/schemas/BracketMatch"
rounds:
type: array
items:
type: array
items:
$ref: "#/components/schemas/Series"
version: { type: integer }
Problem:
type: object
required: [error]