Add leaderboard for all tracks and track calendar

This commit is contained in:
2026-07-15 11:53:35 +04:00
parent 4a894a4399
commit a56841237d
20 changed files with 1394 additions and 25 deletions
+180
View File
@@ -644,6 +644,71 @@ definitions:
width_m:
type: number
type: object
transport.TrackCalendarCreateRequest:
properties:
end_at:
example: "2026-07-30T00:00:00Z"
type: string
start_at:
example: "2026-07-15T00:00:00Z"
type: string
track_id:
example: monaco
type: string
type: object
transport.TrackCalendarEntry:
properties:
end_at:
example: "2026-07-30T00:00:00Z"
type: string
id:
example: 1
type: integer
start_at:
example: "2026-07-15T00:00:00Z"
type: string
track_id:
example: monaco
type: string
type: object
transport.TrackCalendarLeaderboard:
properties:
current_driver:
$ref: '#/definitions/transport.LeaderboardEntry'
end_at:
example: "2026-07-30T00:00:00Z"
type: string
podium:
items:
$ref: '#/definitions/transport.LeaderboardEntry'
type: array
start_at:
example: "2026-07-15T00:00:00Z"
type: string
status:
example: active
type: string
track_id:
example: monaco
type: string
track_name:
example: Monaco
type: string
type: object
transport.TrackCalendarLeaderboardResponse:
properties:
items:
items:
$ref: '#/definitions/transport.TrackCalendarLeaderboard'
type: array
type: object
transport.TrackCalendarResponse:
properties:
items:
items:
$ref: '#/definitions/transport.TrackCalendarEntry'
type: array
type: object
transport.TrackCreateRequest:
properties:
track:
@@ -716,6 +781,9 @@ definitions:
type: string
id:
type: string
is_active:
example: true
type: boolean
lane_width_m:
type: number
length_m:
@@ -1505,6 +1573,39 @@ paths:
summary: Leaderboard
tags:
- leaderboard
/api/leaderboard/tracks:
get:
description: Returns the list of scheduled tracks with their status (finished/active/planned),
top 3 drivers, and current driver position, sorted by calendar start date.
parameters:
- description: Year. Defaults to current year.
in: query
name: year
type: integer
- description: Current driver ID. Defaults to driver-seed-001 (mock Alice).
in: header
name: X-Driver-Id
type: string
produces:
- application/json
responses:
"200":
description: Calendar leaderboards list
schema:
$ref: '#/definitions/transport.TrackCalendarLeaderboardResponse'
"400":
description: Invalid input
schema:
additionalProperties: true
type: object
"500":
description: Internal server error
schema:
additionalProperties: true
type: object
summary: Track Calendar Leaderboards
tags:
- leaderboard
/api/races:
get:
description: |-
@@ -2024,6 +2125,85 @@ paths:
summary: Get / update / delete a track by id
tags:
- tracks
/api/tracks/calendar:
get:
description: Returns the full calendar of track active periods.
produces:
- application/json
responses:
"200":
description: List of scheduled active periods
schema:
$ref: '#/definitions/transport.TrackCalendarResponse'
"500":
description: Internal error
schema:
additionalProperties: true
type: object
summary: Get Track Calendar
tags:
- tracks
post:
consumes:
- application/json
description: Schedules an active period for a physical track.
parameters:
- description: Calendar entry details
in: body
name: payload
required: true
schema:
$ref: '#/definitions/transport.TrackCalendarCreateRequest'
produces:
- application/json
responses:
"201":
description: Created calendar entry
schema:
$ref: '#/definitions/transport.TrackCalendarEntry'
"400":
description: Invalid input
schema:
additionalProperties: true
type: object
"404":
description: Track not found
schema:
additionalProperties: true
type: object
"500":
description: Internal error
schema:
additionalProperties: true
type: object
summary: Schedule Track Active Period
tags:
- tracks
/api/tracks/calendar/{id}:
delete:
description: Deletes a scheduled active period by ID.
parameters:
- description: Calendar Entry ID
in: path
name: id
required: true
type: integer
responses:
"204":
description: No Content
"404":
description: Not found
schema:
additionalProperties: true
type: object
"500":
description: Internal error
schema:
additionalProperties: true
type: object
summary: Delete Scheduled Period
tags:
- tracks
/api/version:
get:
description: Returns the current server version.