mirror of
https://github.com/IS1DI/x0gp.git
synced 2026-07-19 05:47:02 +00:00
Add driver profile stats API, nickname update editing, and security checks
This commit is contained in:
@@ -674,11 +674,42 @@ type DriverCreateRequest struct {
|
||||
|
||||
// DriverUpdateRequest is the body of PUT /api/drivers/{id}.
|
||||
type DriverUpdateRequest struct {
|
||||
Name string `json:"name,omitempty" example:"Alice"`
|
||||
AvatarURL string `json:"avatar_url,omitempty" example:"https://cdn.example.com/u/ace.png"`
|
||||
Nickname string `json:"nickname,omitempty" example:"ALI"`
|
||||
Name string `json:"name,omitempty" example:"Alice"`
|
||||
AvatarURL string `json:"avatar_url,omitempty" example:"https://cdn.example.com/u/ace.png"`
|
||||
ClanID *string `json:"clan_id,omitempty" example:"clan-1782000-1"`
|
||||
}
|
||||
|
||||
// DriverProfileResponse is the body returned by GET /api/drivers/{id}/profile.
|
||||
type DriverProfileResponse struct {
|
||||
Driver Driver `json:"driver"`
|
||||
Stats DriverStats `json:"stats"`
|
||||
LastRace *DriverRaceSummary `json:"last_race"`
|
||||
BestRace *DriverRaceSummary `json:"best_race"`
|
||||
}
|
||||
|
||||
// DriverStats contains aggregate driver statistics.
|
||||
type DriverStats struct {
|
||||
TotalRacesStarted int64 `json:"total_races_started" example:"10"`
|
||||
TotalRacesFinished int64 `json:"total_races_finished" example:"8"`
|
||||
Wins int64 `json:"wins" example:"2"`
|
||||
Podiums int64 `json:"podiums" example:"5"`
|
||||
BestLapMs int64 `json:"best_lap_ms" example:"12345"`
|
||||
TotalPlaytimeMs int64 `json:"total_playtime_ms" example:"1200000"`
|
||||
}
|
||||
|
||||
// DriverRaceSummary describes one race result in a driver's profile.
|
||||
type DriverRaceSummary struct {
|
||||
RaceID string `json:"race_id" example:"race-123"`
|
||||
RaceName string `json:"race_name" example:"Monaco Grand Prix"`
|
||||
FinishedMs int64 `json:"finished_ms" example:"1700000000000"`
|
||||
Position int `json:"position" example:"1"`
|
||||
TotalTimeMs int64 `json:"total_time_ms" example:"123456"`
|
||||
BestLapMs int64 `json:"best_lap_ms" example:"12345"`
|
||||
TrackID string `json:"track_id" example:"monaco"`
|
||||
TrackName string `json:"track_name" example:"Monaco"`
|
||||
}
|
||||
|
||||
// DriverListResponse is the body returned by GET /api/drivers.
|
||||
type DriverListResponse struct {
|
||||
Items []Driver `json:"items"`
|
||||
|
||||
Reference in New Issue
Block a user