fix issues in core
This commit is contained in:
@@ -4,7 +4,7 @@ import type { Logger, UseCaseOutputPort } from '@core/shared/application';
|
||||
import type { NotificationService } from '../../../notifications/application/ports/NotificationService';
|
||||
import type { NotificationType } from '../../../notifications/domain/types/NotificationTypes';
|
||||
import type { RaceEvent } from '../../domain/entities/RaceEvent';
|
||||
import type { Result as RaceResult } from '../../domain/entities/Result';
|
||||
import type { Result as RaceResult } from '../../domain/entities/result/Result';
|
||||
import type { IRaceEventRepository } from '../../domain/repositories/IRaceEventRepository';
|
||||
import type { IResultRepository } from '../../domain/repositories/IResultRepository';
|
||||
import type { ILeagueRepository } from '../../domain/repositories/ILeagueRepository';
|
||||
@@ -61,7 +61,7 @@ export class SendFinalResultsUseCase {
|
||||
return Result.err({ code: 'RACE_NOT_FOUND', details: { message: 'Race event not found' } });
|
||||
}
|
||||
|
||||
const membership = await this.membershipRepository.getMembership(league.id, input.triggeredById);
|
||||
const membership = await this.membershipRepository.getMembership(league.id.toString(), input.triggeredById);
|
||||
if (!membership || !isLeagueStewardOrHigherRole(membership.role)) {
|
||||
return Result.err({
|
||||
code: 'INSUFFICIENT_PERMISSIONS',
|
||||
@@ -90,17 +90,17 @@ export class SendFinalResultsUseCase {
|
||||
|
||||
for (const driverResult of results) {
|
||||
await this.sendFinalResultsNotification(
|
||||
driverResult.driverId,
|
||||
driverResult.driverId.toString(),
|
||||
raceEvent,
|
||||
driverResult,
|
||||
league.id,
|
||||
league.id.toString(),
|
||||
false,
|
||||
);
|
||||
notificationsSent += 1;
|
||||
}
|
||||
|
||||
const result: SendFinalResultsResult = {
|
||||
leagueId: league.id,
|
||||
leagueId: league.id.toString(),
|
||||
raceId: raceEvent.id,
|
||||
notificationsSent,
|
||||
};
|
||||
@@ -127,8 +127,8 @@ export class SendFinalResultsUseCase {
|
||||
const incidents = driverResult?.incidents ?? 0;
|
||||
|
||||
const finalRatingChange = this.calculateFinalRatingChange(
|
||||
driverResult?.position,
|
||||
driverResult?.incidents,
|
||||
driverResult?.position?.toNumber(),
|
||||
driverResult?.incidents?.toNumber(),
|
||||
hadPenaltiesApplied,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user