From 6f2ab9fc565272d83ec190ff1db44da7e6733753 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Fri, 9 Jan 2026 00:06:53 +0100 Subject: [PATCH] fix seeds --- apps/api/src/domain/league/LeagueService.ts | 18 +++++++++++++----- .../use-cases/UpdateLeagueMemberRoleUseCase.ts | 8 ++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/apps/api/src/domain/league/LeagueService.ts b/apps/api/src/domain/league/LeagueService.ts index 9c50f7791..4c087e402 100644 --- a/apps/api/src/domain/league/LeagueService.ts +++ b/apps/api/src/domain/league/LeagueService.ts @@ -288,9 +288,7 @@ export class LeagueService { throw new Error(err.code); } - // The use case calls presenter.present() internally - // The presenter now handles logo resolution synchronously - // Just get the view model which contains the resolved logo URLs + this.allLeaguesWithCapacityAndScoringPresenter.present(result.unwrap()); return this.allLeaguesWithCapacityAndScoringPresenter.getViewModel(); } @@ -481,6 +479,7 @@ export class LeagueService { throw new Error(err.code); } + this.removeLeagueMemberPresenter.present(result.unwrap()); return this.removeLeagueMemberPresenter.getViewModel()!; } @@ -518,6 +517,7 @@ export class LeagueService { throw new Error(err.code); } + this.updateLeagueMemberRolePresenter.present(result.unwrap()); return this.updateLeagueMemberRolePresenter.getViewModel()!; } @@ -535,7 +535,11 @@ export class LeagueService { this.logger.debug('Getting league full config', { query }); try { - await this.getLeagueFullConfigUseCase.execute(query); + const result = await this.getLeagueFullConfigUseCase.execute(query); + if (result.isErr()) { + throw new Error(result.unwrapErr().code); + } + this.leagueConfigPresenter.present(result.unwrap()); return this.leagueConfigPresenter.getViewModel(); } catch (error) { this.logger.error('Error getting league full config', error instanceof Error ? error : new Error(String(error))); @@ -814,7 +818,11 @@ export class LeagueService { this.logger.debug('Getting league scoring config', { leagueId }); try { - await this.getLeagueScoringConfigUseCase.execute({ leagueId }); + const result = await this.getLeagueScoringConfigUseCase.execute({ leagueId }); + if (result.isErr()) { + throw new Error(result.unwrapErr().code); + } + this.leagueScoringConfigPresenter.present(result.unwrap()); return this.leagueScoringConfigPresenter.getViewModel(); } catch (error) { this.logger.error('Error getting league scoring config', error instanceof Error ? error : new Error(String(error))); diff --git a/core/racing/application/use-cases/UpdateLeagueMemberRoleUseCase.ts b/core/racing/application/use-cases/UpdateLeagueMemberRoleUseCase.ts index a41816cd4..c043c3d62 100644 --- a/core/racing/application/use-cases/UpdateLeagueMemberRoleUseCase.ts +++ b/core/racing/application/use-cases/UpdateLeagueMemberRoleUseCase.ts @@ -26,7 +26,7 @@ export class UpdateLeagueMemberRoleUseCase { async execute( input: UpdateLeagueMemberRoleInput, ): Promise< - Result> + Result> > { try { const memberships = await this.leagueMembershipRepository.getLeagueMembers(input.leagueId); @@ -70,7 +70,11 @@ export class UpdateLeagueMemberRoleUseCase { await this.leagueMembershipRepository.saveMembership(updatedMembership); - return Result.ok(undefined); + const result: UpdateLeagueMemberRoleResult = { + membership: updatedMembership, + }; + + return Result.ok(result); } catch (error: unknown) { const message = error instanceof Error && typeof error.message === 'string'