ZOD-309-child-transaction-history-parent-→-child-transfers

This commit is contained in:
Abdalhamid Alhamad
2025-10-16 12:25:16 +03:00
parent f6fa74897a
commit 15621124ad
13 changed files with 331 additions and 22 deletions

View File

@ -1,8 +1,6 @@
import { Injectable } from '@nestjs/common';
import { CustomerService } from '~/customer/services';
import { GuardianHomeResponseDto, PagedTransactionsResponseDto } from '~/card/dtos/responses';
import { TransactionItemResponseDto } from '~/card/dtos/responses';
import { ParentTransactionType } from '~/card/enums';
import { ParentHomeResponseDto, PagedParentTransfersResponseDto } from '~/card/dtos/responses';
import { TransactionService } from '~/card/services/transaction.service';
@Injectable()
@ -12,7 +10,7 @@ export class GuardianTransactionsService {
private readonly transactionService: TransactionService,
) {}
async getHome(guardianId: string, size: number): Promise<GuardianHomeResponseDto> {
async getHome(guardianId: string, size: number): Promise<ParentHomeResponseDto> {
const parent = await this.customerService.findCustomerById(guardianId);
const primaryCard = parent.cards?.[0];
@ -27,18 +25,17 @@ export class GuardianTransactionsService {
}
}
const items: TransactionItemResponseDto[] = await this.transactionService.getParentConsolidated(guardianId, 1, size);
const recentTransfers = await this.transactionService.getParentTransfersOnly(guardianId, 1, size);
return new GuardianHomeResponseDto(availableBalance, items);
return new ParentHomeResponseDto(availableBalance, recentTransfers);
}
async getTransactions(
async getTransfers(
guardianId: string,
page: number,
size: number,
type?: ParentTransactionType,
): Promise<PagedTransactionsResponseDto> {
return this.transactionService.getParentTransactionsPaginated(guardianId, page, size, type);
): Promise<PagedParentTransfersResponseDto> {
return this.transactionService.getParentTransfersPaginated(guardianId, page, size);
}
}