mirror of
https://github.com/IS1DI/x0gp.git
synced 2026-07-16 20:47:55 +00:00
Add leaderboard for all tracks and track calendar
This commit is contained in:
@@ -1078,6 +1078,54 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/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.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"leaderboard"
|
||||
],
|
||||
"summary": "Track Calendar Leaderboards",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Year. Defaults to current year.",
|
||||
"name": "year",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Current driver ID. Defaults to driver-seed-001 (mock Alice).",
|
||||
"name": "X-Driver-Id",
|
||||
"in": "header"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Calendar leaderboards list",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/transport.TrackCalendarLeaderboardResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid input",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/races": {
|
||||
"get": {
|
||||
"description": "Returns one keyset page of races. Live races (status lobby|racing) come from in-memory lobby.Service; finished races come from Postgres. The two sources are merged and ordered by (started_ms DESC, id ASC). The cursor is opaque: pass back the next_cursor verbatim from a previous page.\n## Filters\n- ` + "`" + `status` + "`" + ` (comma-separated, e.g. \"racing,finished\"). Recognised values: all, lobby, racing, finished.\n- ` + "`" + `track_id` + "`" + ` (exact match against a physical track id; custom lobbies are not supported in this build).\n- ` + "`" + `limit` + "`" + ` (1..200, default 50)",
|
||||
@@ -1586,6 +1634,123 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/tracks/calendar": {
|
||||
"get": {
|
||||
"description": "Returns the full calendar of track active periods.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"tracks"
|
||||
],
|
||||
"summary": "Get Track Calendar",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of scheduled active periods",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/transport.TrackCalendarResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "Schedules an active period for a physical track.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"tracks"
|
||||
],
|
||||
"summary": "Schedule Track Active Period",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Calendar entry details",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/transport.TrackCalendarCreateRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created calendar entry",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/transport.TrackCalendarEntry"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid input",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Track not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/tracks/calendar/{id}": {
|
||||
"delete": {
|
||||
"description": "Deletes a scheduled active period by ID.",
|
||||
"tags": [
|
||||
"tracks"
|
||||
],
|
||||
"summary": "Delete Scheduled Period",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Calendar Entry ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/tracks/{id}": {
|
||||
"get": {
|
||||
"description": "Dispatches on HTTP method. The id is taken from the URL path (` + "`" + `/api/tracks/{id}` + "`" + `). System tracks are immutable and cannot be updated or deleted.",
|
||||
@@ -2913,6 +3078,100 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"transport.TrackCalendarCreateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"end_at": {
|
||||
"type": "string",
|
||||
"example": "2026-07-30T00:00:00Z"
|
||||
},
|
||||
"start_at": {
|
||||
"type": "string",
|
||||
"example": "2026-07-15T00:00:00Z"
|
||||
},
|
||||
"track_id": {
|
||||
"type": "string",
|
||||
"example": "monaco"
|
||||
}
|
||||
}
|
||||
},
|
||||
"transport.TrackCalendarEntry": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"end_at": {
|
||||
"type": "string",
|
||||
"example": "2026-07-30T00:00:00Z"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"start_at": {
|
||||
"type": "string",
|
||||
"example": "2026-07-15T00:00:00Z"
|
||||
},
|
||||
"track_id": {
|
||||
"type": "string",
|
||||
"example": "monaco"
|
||||
}
|
||||
}
|
||||
},
|
||||
"transport.TrackCalendarLeaderboard": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"current_driver": {
|
||||
"$ref": "#/definitions/transport.LeaderboardEntry"
|
||||
},
|
||||
"end_at": {
|
||||
"type": "string",
|
||||
"example": "2026-07-30T00:00:00Z"
|
||||
},
|
||||
"podium": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/transport.LeaderboardEntry"
|
||||
}
|
||||
},
|
||||
"start_at": {
|
||||
"type": "string",
|
||||
"example": "2026-07-15T00:00:00Z"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"example": "active"
|
||||
},
|
||||
"track_id": {
|
||||
"type": "string",
|
||||
"example": "monaco"
|
||||
},
|
||||
"track_name": {
|
||||
"type": "string",
|
||||
"example": "Monaco"
|
||||
}
|
||||
}
|
||||
},
|
||||
"transport.TrackCalendarLeaderboardResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/transport.TrackCalendarLeaderboard"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"transport.TrackCalendarResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/transport.TrackCalendarEntry"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"transport.TrackCreateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3023,6 +3282,10 @@ const docTemplate = `{
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"lane_width_m": {
|
||||
"type": "number"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user