refactor league module (wip)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import type { UseCaseOutputPort } from '@core/shared/application';
|
||||
import type { WithdrawFromLeagueWalletResult } from '@core/racing/application/use-cases/WithdrawFromLeagueWalletUseCase';
|
||||
import { WithdrawFromLeagueWalletOutputDTO } from '../dtos/WithdrawFromLeagueWalletOutputDTO';
|
||||
|
||||
export class WithdrawFromLeagueWalletPresenter implements UseCaseOutputPort<WithdrawFromLeagueWalletResult> {
|
||||
private model: WithdrawFromLeagueWalletOutputDTO | null = null;
|
||||
|
||||
present(result: WithdrawFromLeagueWalletResult): void {
|
||||
this.model = {
|
||||
success: true,
|
||||
message: `Successfully withdrew ${result.amount.amount} ${result.amount.currency} from league wallet. Transaction ID: ${result.transactionId}`,
|
||||
};
|
||||
}
|
||||
|
||||
getResponseModel(): WithdrawFromLeagueWalletOutputDTO {
|
||||
if (!this.model) throw new Error('Presenter not presented');
|
||||
return this.model;
|
||||
}
|
||||
|
||||
get responseModel(): WithdrawFromLeagueWalletOutputDTO {
|
||||
if (!this.model) throw new Error('Presenter not presented');
|
||||
return this.model;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user