refactor api modules
This commit is contained in:
@@ -12,16 +12,27 @@ export interface ReviewProtestResponseDTO {
|
||||
|
||||
export class ReviewProtestPresenter implements UseCaseOutputPort<ReviewProtestResult> {
|
||||
private model: ReviewProtestResponseDTO | null = null;
|
||||
private command: { stewardId: string; decision: 'uphold' | 'dismiss' } | null = null;
|
||||
|
||||
reset(): void {
|
||||
this.model = null;
|
||||
this.command = null;
|
||||
}
|
||||
|
||||
setCommand(command: { stewardId: string; decision: 'uphold' | 'dismiss' }): void {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
present(result: ReviewProtestResult): void {
|
||||
if (!this.command) {
|
||||
throw new Error('Command must be set before presenting result');
|
||||
}
|
||||
|
||||
this.model = {
|
||||
success: true,
|
||||
protestId: result.protestId,
|
||||
decision: result.status === 'upheld' ? 'uphold' : 'dismiss',
|
||||
stewardId: this.command.stewardId,
|
||||
decision: this.command.decision,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user