module cleanup
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { ICreateLeaguePresenter, CreateLeagueResultDTO, CreateLeagueViewModel } from '@core/racing/application/presenters/ICreateLeaguePresenter';
|
||||
|
||||
export class CreateLeaguePresenter implements ICreateLeaguePresenter {
|
||||
private result: CreateLeagueViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: CreateLeagueResultDTO): void {
|
||||
this.result = {
|
||||
leagueId: dto.leagueId,
|
||||
success: true,
|
||||
};
|
||||
}
|
||||
|
||||
getViewModel(): CreateLeagueViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
21
apps/api/src/domain/league/presenters/JoinLeaguePresenter.ts
Normal file
21
apps/api/src/domain/league/presenters/JoinLeaguePresenter.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { IJoinLeaguePresenter, JoinLeagueResultDTO, JoinLeagueViewModel } from '@core/racing/application/presenters/IJoinLeaguePresenter';
|
||||
|
||||
export class JoinLeaguePresenter implements IJoinLeaguePresenter {
|
||||
private result: JoinLeagueViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: JoinLeagueResultDTO): void {
|
||||
this.result = {
|
||||
success: true,
|
||||
membershipId: dto.id,
|
||||
};
|
||||
}
|
||||
|
||||
getViewModel(): JoinLeagueViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,11 @@ export class LeagueAdminPresenter {
|
||||
}
|
||||
|
||||
present(data: {
|
||||
joinRequests: any[];
|
||||
ownerSummary: any;
|
||||
config: any;
|
||||
protests: any;
|
||||
seasons: any[];
|
||||
joinRequests: unknown[];
|
||||
ownerSummary: unknown;
|
||||
config: unknown;
|
||||
protests: unknown;
|
||||
seasons: unknown[];
|
||||
}) {
|
||||
this.result = {
|
||||
joinRequests: data.joinRequests,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { ITransferLeagueOwnershipPresenter, TransferLeagueOwnershipResultDTO, TransferLeagueOwnershipViewModel } from '@core/racing/application/presenters/ITransferLeagueOwnershipPresenter';
|
||||
|
||||
export class TransferLeagueOwnershipPresenter implements ITransferLeagueOwnershipPresenter {
|
||||
private result: TransferLeagueOwnershipViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: TransferLeagueOwnershipResultDTO): void {
|
||||
this.result = {
|
||||
success: dto.success,
|
||||
};
|
||||
}
|
||||
|
||||
getViewModel(): TransferLeagueOwnershipViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user