module cleanup
This commit is contained in:
@@ -10,6 +10,7 @@ import type {
|
||||
IGetPaymentsPresenter,
|
||||
GetPaymentsResultDTO,
|
||||
GetPaymentsViewModel,
|
||||
PaymentDto,
|
||||
} from '../presenters/IGetPaymentsPresenter';
|
||||
import type { UseCase } from '@core/shared/application/UseCase';
|
||||
|
||||
@@ -30,27 +31,27 @@ export class GetPaymentsUseCase
|
||||
): Promise<void> {
|
||||
presenter.reset();
|
||||
|
||||
const payments = await this.paymentRepository.findByFilters({
|
||||
leagueId: input.leagueId,
|
||||
payerId: input.payerId,
|
||||
type: input.type,
|
||||
});
|
||||
const { leagueId, payerId, type } = input;
|
||||
|
||||
const payments = await this.paymentRepository.findByFilters({ leagueId, payerId, type });
|
||||
|
||||
const dtos: PaymentDto[] = payments.map(payment => ({
|
||||
id: payment.id,
|
||||
type: payment.type,
|
||||
amount: payment.amount,
|
||||
platformFee: payment.platformFee,
|
||||
netAmount: payment.netAmount,
|
||||
payerId: payment.payerId,
|
||||
payerType: payment.payerType,
|
||||
leagueId: payment.leagueId,
|
||||
seasonId: payment.seasonId,
|
||||
status: payment.status,
|
||||
createdAt: payment.createdAt,
|
||||
completedAt: payment.completedAt,
|
||||
}));
|
||||
|
||||
const dto: GetPaymentsResultDTO = {
|
||||
payments: payments.map(payment => ({
|
||||
id: payment.id,
|
||||
type: payment.type,
|
||||
amount: payment.amount,
|
||||
platformFee: payment.platformFee,
|
||||
netAmount: payment.netAmount,
|
||||
payerId: payment.payerId,
|
||||
payerType: payment.payerType,
|
||||
leagueId: payment.leagueId,
|
||||
seasonId: payment.seasonId,
|
||||
status: payment.status,
|
||||
createdAt: payment.createdAt,
|
||||
completedAt: payment.completedAt,
|
||||
})),
|
||||
payments: dtos,
|
||||
};
|
||||
|
||||
presenter.present(dto);
|
||||
|
||||
Reference in New Issue
Block a user