fix issues in core
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
import { SeasonScheduleGenerator } from '../../domain/services/SeasonScheduleGenerator';
|
||||
import { scheduleDTOToSeasonSchedule } from '../dto/LeagueScheduleDTO';
|
||||
import {
|
||||
scheduleDTOToSeasonSchedule,
|
||||
type SeasonScheduleConfigDTO,
|
||||
} from '../dto/LeagueScheduleDTO';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { SeasonSchedule } from '../../domain/value-objects/SeasonSchedule';
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
|
||||
export type PreviewLeagueScheduleSeasonConfig = {
|
||||
seasonStartDate: string;
|
||||
recurrenceStrategy: string;
|
||||
weekdays?: string[];
|
||||
raceStartTime: string;
|
||||
timezoneId: string;
|
||||
plannedRounds: number;
|
||||
intervalWeeks?: number;
|
||||
monthlyOrdinal?: 1 | 2 | 3 | 4;
|
||||
monthlyWeekday?: string;
|
||||
};
|
||||
export type PreviewLeagueScheduleSeasonConfig = SeasonScheduleConfigDTO;
|
||||
|
||||
export type PreviewLeagueScheduleInput = {
|
||||
schedule: PreviewLeagueScheduleSeasonConfig;
|
||||
@@ -61,7 +54,7 @@ export class PreviewLeagueScheduleUseCase {
|
||||
try {
|
||||
let seasonSchedule: SeasonSchedule;
|
||||
try {
|
||||
seasonSchedule = scheduleDTOToSeasonSchedule(params.schedule as any);
|
||||
seasonSchedule = scheduleDTOToSeasonSchedule(params.schedule);
|
||||
} catch (error) {
|
||||
this.logger.warn('Invalid schedule data provided', {
|
||||
schedule: params.schedule,
|
||||
@@ -83,11 +76,11 @@ export class PreviewLeagueScheduleUseCase {
|
||||
maxRounds,
|
||||
);
|
||||
|
||||
const rounds: PreviewLeagueScheduleRound[] = slots.map((slot) => ({
|
||||
roundNumber: slot.roundNumber,
|
||||
scheduledAt: slot.scheduledAt.toISOString(),
|
||||
timezoneId: slot.timezone.id,
|
||||
}));
|
||||
const rounds: PreviewLeagueScheduleRound[] = slots.map(slot => ({
|
||||
roundNumber: slot.roundNumber,
|
||||
scheduledAt: slot.scheduledAt.toISOString(),
|
||||
timezoneId: slot.timezone.id,
|
||||
}));
|
||||
|
||||
const summary = this.buildSummary(params.schedule, rounds);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user