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:
@@ -837,6 +837,23 @@ func (s *Service) GetLastFinished(ctx context.Context) (FinishedRace, error) {
|
||||
return s.pg.GetLastFinished(ctx)
|
||||
}
|
||||
|
||||
// GetDriverProfileStats returns the driver stats and summaries of their last and best races.
|
||||
func (s *Service) GetDriverProfileStats(ctx context.Context, driverID string) (DriverStats, *DriverRaceSummary, *DriverRaceSummary, error) {
|
||||
stats, err := s.pg.GetDriverStats(ctx, driverID)
|
||||
if err != nil {
|
||||
return DriverStats{}, nil, nil, err
|
||||
}
|
||||
last, err := s.pg.GetDriverLastRace(ctx, driverID)
|
||||
if err != nil {
|
||||
return DriverStats{}, nil, nil, err
|
||||
}
|
||||
best, err := s.pg.GetDriverBestRace(ctx, driverID)
|
||||
if err != nil {
|
||||
return DriverStats{}, nil, nil, err
|
||||
}
|
||||
return stats, last, best, nil
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Scheduler
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user