diff --git a/src/modules/payments/payments.controller.ts b/src/modules/payments/payments.controller.ts index 6928439..79cd788 100644 --- a/src/modules/payments/payments.controller.ts +++ b/src/modules/payments/payments.controller.ts @@ -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 { return this.paymentsService.store(createPaymentDto); } + + @Get('payments-summary') + async getPaymentsSummary( + @Query('from') from: string, + @Query('to') to: string, + ): Promise { + return this.paymentsSummaryService.execute(from, to); + } }