mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2026-03-10 18:41:46 +00:00
ZOD-309-child-transaction-history-parent-→-child-transfers
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user