Add player profiles and community settings
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / compose (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-19 21:43:48 +03:00
parent 5e0825f43f
commit fa4edc0df5
23 changed files with 1280 additions and 57 deletions

View File

@@ -10,6 +10,7 @@ security:
tags:
- name: Auth
- name: Players
- name: Community
- name: Events
- name: Teams
- name: Series
@@ -110,6 +111,56 @@ paths:
type: array
items:
$ref: "#/components/schemas/Player"
/api/players/{playerId}:
get:
tags: [Players]
operationId: getPlayerProfile
parameters:
- $ref: "#/components/parameters/PlayerId"
responses:
"200":
description: Public-safe player profile, aggregate statistics, and recent completed matches
content:
application/json:
schema:
$ref: "#/components/schemas/PlayerProfile"
"404":
$ref: "#/components/responses/NotFound"
/api/community/settings:
get:
tags: [Community]
operationId: getCommunitySettings
responses:
"200":
description: Community settings
content:
application/json:
schema:
$ref: "#/components/schemas/CommunitySettings"
put:
tags: [Community]
operationId: updateCommunitySettings
description: Admin only. Moderators are forbidden.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [discordInviteUrl]
properties:
discordInviteUrl:
type: string
description: Empty, or an official discord.gg / discord.com/invite HTTPS URL.
responses:
"200":
description: Updated community settings
content:
application/json:
schema:
$ref: "#/components/schemas/CommunitySettings"
"403":
$ref: "#/components/responses/Forbidden"
/api/accounts:
get:
tags: [Admin]
@@ -960,7 +1011,7 @@ components:
description: Bronze 5 = 1, Champion 1 = 40
Player:
type: object
required: [id, accountId, displayName, ratings, preferredRoles, preferredPlayerIds, avoidedPlayerIds, updatedAt]
required: [id, accountId, displayName, battleTag, ratings, preferredRoles, preferredPlayerIds, avoidedPlayerIds, updatedAt]
properties:
id:
type: string
@@ -970,6 +1021,12 @@ components:
format: uuid
displayName:
type: string
minLength: 2
maxLength: 32
battleTag:
type: string
pattern: '^(|[^#\s]{2,20}#[0-9]{3,12})$'
description: Optional; an empty string clears the BattleTag.
ratings:
$ref: "#/components/schemas/Ratings"
preferredRoles:
@@ -1000,6 +1057,11 @@ components:
properties:
displayName:
type: string
minLength: 2
maxLength: 32
battleTag:
type: string
description: Empty string clears the BattleTag.
ratings:
$ref: "#/components/schemas/Ratings"
preferredRoles:
@@ -1017,6 +1079,58 @@ components:
maxItems: 3
items:
type: string
PublicPlayer:
type: object
required: [id, displayName, battleTag, ratings, isGuest]
properties:
id: { type: string }
displayName: { type: string, minLength: 2, maxLength: 32 }
battleTag: { type: string }
ratings: { $ref: "#/components/schemas/Ratings" }
isGuest: { type: boolean }
PlayerStatsSummary:
type: object
required: [seriesPlayed, seriesWon, seriesLost, winRate, mapsPlayed, mapsWon, mapsLost, mapsDrawn]
properties:
seriesPlayed: { type: integer }
seriesWon: { type: integer }
seriesLost: { type: integer }
winRate: { type: number, minimum: 0, maximum: 1 }
mapsPlayed: { type: integer }
mapsWon: { type: integer }
mapsLost: { type: integer }
mapsDrawn: { type: integer }
PlayerMatchHistory:
type: object
required: [seriesId, eventId, eventName, eventDate, ownTeamId, ownTeamName, opponentTeamId, opponentTeamName, ownScore, opponentScore, outcome]
properties:
seriesId: { type: string }
eventId: { type: string }
eventName: { type: string }
eventDate: { type: string, format: date-time }
ownTeamId: { type: string }
ownTeamName: { type: string }
opponentTeamId: { type: string }
opponentTeamName: { type: string }
ownScore: { type: integer }
opponentScore: { type: integer }
outcome: { type: string, enum: [win, loss] }
PlayerProfile:
type: object
required: [player, summary, recentMatches]
properties:
player: { $ref: "#/components/schemas/PublicPlayer" }
summary: { $ref: "#/components/schemas/PlayerStatsSummary" }
recentMatches:
type: array
items: { $ref: "#/components/schemas/PlayerMatchHistory" }
CommunitySettings:
type: object
required: [discordInviteUrl, updatedAt, updatedBy]
properties:
discordInviteUrl: { type: string }
updatedAt: { type: string, format: date-time }
updatedBy: { type: string }
EventInput:
type: object
required: [name, startsAt, endsAt, registrationDeadline]