code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
import { NumberFormatter } from '@/lib/formatters/NumberFormatter';
|
||||
import { RatingFormatter } from '@/lib/formatters/RatingFormatter';
|
||||
import type { GetAllTeamsOutputDTO } from '@/lib/types/generated/GetAllTeamsOutputDTO';
|
||||
import type { TeamListItemDTO } from '@/lib/types/generated/TeamListItemDTO';
|
||||
import type { TeamSummaryData, TeamsViewData } from '@/lib/view-data/TeamsViewData';
|
||||
|
||||
import { ViewDataBuilder } from "../../contracts/builders/ViewDataBuilder";
|
||||
|
||||
type TeamsApiDto = {
|
||||
teams: TeamListItemDTO[];
|
||||
};
|
||||
|
||||
export class TeamsViewDataBuilder {
|
||||
/**
|
||||
* Transform API DTO to ViewData
|
||||
*
|
||||
*
|
||||
* @param apiDto - The DTO from the service
|
||||
* @returns ViewData for the teams page
|
||||
*/
|
||||
public static build(apiDto: GetAllTeamsOutputDTO): TeamsViewData {
|
||||
public static build(apiDto: TeamsApiDto): TeamsViewData {
|
||||
const teams: TeamSummaryData[] = (apiDto.teams || []).map((team: TeamListItemDTO): TeamSummaryData => ({
|
||||
teamId: team.id,
|
||||
teamName: team.name,
|
||||
@@ -35,4 +38,4 @@ export class TeamsViewDataBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
TeamsViewDataBuilder satisfies ViewDataBuilder<GetAllTeamsOutputDTO, TeamsViewData>;
|
||||
TeamsViewDataBuilder satisfies ViewDataBuilder<TeamsApiDto, TeamsViewData>;
|
||||
|
||||
Reference in New Issue
Block a user