Add PaymentsSummary endpoint to PaymentsController for retrieving payment summaries
This commit is contained in:
parent
1ebfc609f7
commit
7f9b03aafa
@ -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 { PaymentsService } from './services/payments.service';
|
||||||
import { CreatePaymentDto } from './dto/create-payment.dto';
|
import { CreatePaymentDto } from './dto/create-payment.dto';
|
||||||
|
import { PaymentsSummaryService } from './services/payments-summary.service';
|
||||||
|
|
||||||
@Controller('payments')
|
@Controller()
|
||||||
export class PaymentsController {
|
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> {
|
async payment(@Body() createPaymentDto: CreatePaymentDto): Promise<any> {
|
||||||
return this.paymentsService.store(createPaymentDto);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user