This commit is contained in:
2025-12-21 22:35:38 +01:00
parent 3c64f328e2
commit 9bd2e630e6
38 changed files with 736 additions and 684 deletions

View File

@@ -1,8 +1,5 @@
import type { Result } from '@core/shared/application/Result';
import type {
ReviewProtestResult,
ReviewProtestApplicationError,
} from '@core/racing/application/use-cases/ReviewProtestUseCase';
import type { UseCaseOutputPort } from '@core/shared/application';
import type { ReviewProtestResult } from '@core/racing/application/use-cases/ReviewProtestUseCase';
export interface ReviewProtestResponseDTO {
success: boolean;
@@ -13,34 +10,18 @@ export interface ReviewProtestResponseDTO {
decision?: 'uphold' | 'dismiss';
}
export class ReviewProtestPresenter {
export class ReviewProtestPresenter implements UseCaseOutputPort<ReviewProtestResult> {
private model: ReviewProtestResponseDTO | null = null;
reset(): void {
this.model = null;
}
present(
result: Result<ReviewProtestResult, ReviewProtestApplicationError>,
): void {
if (result.isErr()) {
const error = result.unwrapErr();
this.model = {
success: false,
errorCode: error.code,
message: error.details?.message,
};
return;
}
const value = result.unwrap();
present(result: ReviewProtestResult): void {
this.model = {
success: true,
protestId: value.protestId,
stewardId: value.stewardId,
decision: value.decision,
protestId: result.protestId,
decision: result.status === 'upheld' ? 'uphold' : 'dismiss',
};
}