view models
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
import { RacesApiClient } from '../../api/races/RacesApiClient';
|
||||
import { RaceResultsDetailViewModel } from '../../view-models/RaceResultsDetailViewModel';
|
||||
import { RaceWithSOFViewModel } from '../../view-models/RaceWithSOFViewModel';
|
||||
import { ImportRaceResultsSummaryViewModel } from '../../view-models/ImportRaceResultsSummaryViewModel';
|
||||
|
||||
// TODO: Move these types to apps/website/lib/types/generated when available
|
||||
type ImportRaceResultsInputDto = { raceId: string; results: Array<any> };
|
||||
// TODO: Move this type to apps/website/lib/types/generated when available
|
||||
type ImportRaceResultsInputDto = { raceId: string; results: Array<unknown> };
|
||||
|
||||
// Note: RaceWithSOFViewModel and ImportRaceResultsSummaryViewModel are defined in presenters
|
||||
// These will need to be converted to proper view models
|
||||
type RaceWithSOFViewModel = any; // TODO: Create proper view model
|
||||
type ImportRaceResultsSummaryViewModel = any; // TODO: Create proper view model
|
||||
// TODO: Move this type to apps/website/lib/types/generated when available
|
||||
type ImportRaceResultsSummaryDto = {
|
||||
raceId: string;
|
||||
importedCount: number;
|
||||
errors: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Race Results Service
|
||||
@@ -29,20 +33,18 @@ export class RaceResultsService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get race with strength of field calculation
|
||||
* TODO: Create RaceWithSOFViewModel and use it here
|
||||
*/
|
||||
async getWithSOF(raceId: string): Promise<RaceWithSOFViewModel> {
|
||||
const dto = await this.apiClient.getWithSOF(raceId);
|
||||
return dto; // TODO: return new RaceWithSOFViewModel(dto);
|
||||
}
|
||||
* Get race with strength of field calculation
|
||||
*/
|
||||
async getWithSOF(raceId: string): Promise<RaceWithSOFViewModel> {
|
||||
const dto = await this.apiClient.getWithSOF(raceId);
|
||||
return new RaceWithSOFViewModel(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Import race results and get summary
|
||||
* TODO: Create ImportRaceResultsSummaryViewModel and use it here
|
||||
*/
|
||||
async importResults(raceId: string, input: ImportRaceResultsInputDto): Promise<ImportRaceResultsSummaryViewModel> {
|
||||
const dto = await this.apiClient.importResults(raceId, input);
|
||||
return dto; // TODO: return new ImportRaceResultsSummaryViewModel(dto);
|
||||
}
|
||||
* Import race results and get summary
|
||||
*/
|
||||
async importResults(raceId: string, input: ImportRaceResultsInputDto): Promise<ImportRaceResultsSummaryViewModel> {
|
||||
const dto = await this.apiClient.importResults(raceId, input) as ImportRaceResultsSummaryDto;
|
||||
return new ImportRaceResultsSummaryViewModel(dto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user