Add PaymentsSummary endpoint to PaymentsController for retrieving payment summaries

This commit is contained in:
Jose Eduardo 2025-08-10 00:55:43 -04:00
parent 1ebfc609f7
commit 7f9b03aafa

View File

@ -1,13 +1,25 @@
import { Body, Controller, Post } from '@nestjs/common';
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { PaymentsService } from './services/payments.service';
import { CreatePaymentDto } from './dto/create-payment.dto';
import { PaymentsSummaryService } from './services/payments-summary.service';
@Controller('payments')
@Controller()
export class PaymentsController {
constructor(private readonly paymentsService: PaymentsService) {}
constructor(
private readonly paymentsService: PaymentsService,
private readonly paymentsSummaryService: PaymentsSummaryService,
) {}
@Post()
@Post('payments')
async payment(@Body() createPaymentDto: CreatePaymentDto): Promise<any> {
return this.paymentsService.store(createPaymentDto);
}
@Get('payments-summary')
async getPaymentsSummary(
@Query('from') from: string,
@Query('to') to: string,
): Promise<any> {
return this.paymentsSummaryService.execute(from, to);
}
}