import { ApiProperty } from '@nestjs/swagger'; import { SpendingHistoryItemDto } from './spending-history-item.response.dto'; export class SpendingHistoryResponseDto { @ApiProperty({ type: [SpendingHistoryItemDto] }) transactions!: SpendingHistoryItemDto[]; @ApiProperty({ example: 150.75 }) totalSpent!: number; @ApiProperty({ example: 'SAR' }) currency!: string; @ApiProperty({ example: 10 }) count!: number; constructor(transactions: SpendingHistoryItemDto[], currency: string = 'SAR') { this.transactions = transactions; this.totalSpent = transactions.reduce((sum, tx) => sum + tx.amount, 0); this.currency = currency; this.count = transactions.length; } }