fix issues in core

This commit is contained in:
2025-12-23 14:43:49 +01:00
parent 11492d1ff2
commit df5c20c5cc
62 changed files with 480 additions and 334 deletions

View File

@@ -7,7 +7,7 @@ import type { League } from '../../domain/entities/League';
import type { Season } from '../../domain/entities/season/Season';
import type { LeagueScoringConfig } from '../../domain/entities/LeagueScoringConfig';
import type { Game } from '../../domain/entities/Game';
import type { LeagueScoringPreset } from '../../../bootstrap/LeagueScoringPresets';
import type { LeagueScoringPreset } from '../../domain/types/LeagueScoringPreset';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
@@ -62,18 +62,18 @@ export class GetAllLeaguesWithCapacityAndScoringUseCase {
const enrichedLeagues: LeagueCapacityAndScoringSummary[] = [];
for (const league of leagues) {
const members = await this.leagueMembershipRepository.getLeagueMembers(league.id);
const members = await this.leagueMembershipRepository.getLeagueMembers(league.id.toString());
const currentDrivers = members.filter(
(m) =>
m.status === 'active' &&
(m.role === 'owner' ||
m.role === 'admin' ||
m.role === 'steward' ||
m.role === 'member'),
m.status.toString() === 'active' &&
(m.role.toString() === 'owner' ||
m.role.toString() === 'admin' ||
m.role.toString() === 'steward' ||
m.role.toString() === 'member'),
).length;
const seasons = await this.seasonRepository.findByLeagueId(league.id);
const seasons = await this.seasonRepository.findByLeagueId(league.id.toString());
const activeSeason =
seasons && seasons.length > 0
? seasons.find((s) => s.status === 'active') ?? seasons[0]
@@ -85,14 +85,14 @@ export class GetAllLeaguesWithCapacityAndScoringUseCase {
if (activeSeason) {
const scoringConfigResult =
await this.leagueScoringConfigRepository.findBySeasonId(activeSeason.id);
await this.leagueScoringConfigRepository.findBySeasonId(activeSeason.id.toString());
scoringConfig = scoringConfigResult ?? undefined;
if (scoringConfig) {
const gameResult = await this.gameRepository.findById(activeSeason.gameId);
const gameResult = await this.gameRepository.findById(activeSeason.gameId.toString());
game = gameResult ?? undefined;
const presetId = scoringConfig.scoringPresetId;
if (presetId) {
preset = this.presetProvider.getPresetById(presetId);
preset = this.presetProvider.getPresetById(presetId.toString());
}
}
}