revenue chart

This commit is contained in:
2025-12-22 00:10:17 +03:30
parent 2f409e5c8c
commit 746c822778
4 changed files with 187 additions and 6 deletions
@@ -1,4 +1,4 @@
import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common';
import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards, Query } from '@nestjs/common';
import { PaymentsService } from '../services/payments.service';
import {
ApiTags,
@@ -14,6 +14,7 @@ import { PaymentMethodService } from '../services/payment-method.service';
import { CreatePaymentMethodDto } from '../dto/create-payment-method.dto';
import { UpdatePaymentMethodDto } from '../dto/update-payment-method.dto';
import { VerifyPaymentDto } from '../dto/verify-payment.dto';
import { PaymentChartDto } from '../dto/payment-chart.dto';
import { RestId, UserId } from 'src/common/decorators';
import { AuthGuard } from 'src/modules/auth/guards/auth.guard';
import { API_HEADER_SLUG } from 'src/common/constants';
@@ -121,4 +122,13 @@ export class PaymentsController {
verifyCashPayment(@Param('paymentId') paymentId: string) {
return this.paymentMethodService.remove(paymentId);
}
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Get('admin/payments/chart')
@ApiOperation({ summary: 'Get payment chart data with date and period filters' })
@ApiHeader(API_HEADER_SLUG)
getPaymentChart(@Query() query: PaymentChartDto, @RestId() restId: string) {
return this.paymentsService.getChartData(query, restId);
}
}