view data fixes
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 7m11s
Contract Testing / contract-snapshot (pull_request) Has been skipped

This commit is contained in:
2026-01-24 23:29:55 +01:00
parent c1750a33dd
commit 1b0a1f4aee
134 changed files with 10380 additions and 415 deletions

View File

@@ -9,16 +9,27 @@ export interface TeamLeaderboardPageData {
}
export class TeamLeaderboardPageQuery implements PageQuery<TeamLeaderboardPageData, void> {
private readonly service: TeamService;
constructor(service?: TeamService) {
this.service = service || new TeamService();
}
async execute(): Promise<Result<TeamLeaderboardPageData, PresentationError>> {
try {
const service = new TeamService();
const service = this.service;
const result = await service.getAllTeams();
if (result.isErr()) {
return Result.err(mapToPresentationError(result.getError()));
}
const teams = result.unwrap().map((t: any) => new TeamSummaryViewModel(t));
const teams = result.unwrap().map((t: any) => {
const vm = new TeamSummaryViewModel(t as any);
// Ensure it's a plain object for comparison in tests if needed,
// but here we just need it to match the expected viewData structure.
return vm;
});
return Result.ok({ teams });
} catch (error) {