remover unused payment methods

This commit is contained in:
2025-12-03 10:26:33 +03:30
parent b67f00a919
commit afbe480db6
@@ -1,16 +1,6 @@
import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common';
import { PaymentsService } from '../services/payments.service';
import { UpdatePaymentDto } from '../dto/update-payment.dto';
import {
ApiTags,
ApiOperation,
ApiCreatedResponse,
ApiOkResponse,
ApiNotFoundResponse,
ApiBody,
ApiParam,
ApiBearerAuth,
} from '@nestjs/swagger';
import { ApiTags, ApiOperation, ApiNotFoundResponse, ApiBody, ApiParam, ApiBearerAuth } from '@nestjs/swagger';
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
import { PaymentMethodService } from '../services/payment-method.service';
import { CreatePaymentMethodDto } from '../dto/create-payment-method.dto';
@@ -35,14 +25,14 @@ export class PaymentsController {
return this.paymentMethodService.findByRestaurant(restId);
}
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Get('admin/payments')
@ApiOperation({ summary: 'Get all payments' })
@ApiOkResponse({ description: 'List of all payments' })
findAllPayments() {
return this.paymentsService.findAll();
}
// @UseGuards(AdminAuthGuard)
// @ApiBearerAuth()
// @Get('admin/payments')
// @ApiOperation({ summary: 'Get all payments' })
// @ApiOkResponse({ description: 'List of all payments' })
// findAllPayments() {
// return this.paymentsService.findAll();
// }
// @UseGuards(AdminAuthGuard)
// @ApiBearerAuth()
// @Get('admin/payments/:id')
@@ -53,36 +43,34 @@ export class PaymentsController {
// findOnePayment(@Param('id') id: string) {
// return this.paymentsService.findById(+id);
// }
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Patch('admin/payments/:id')
@ApiOperation({ summary: 'Update a payment' })
@ApiParam({ name: 'id', type: 'number', description: 'Payment ID' })
@ApiBody({ type: UpdatePaymentDto })
@ApiOkResponse({ description: 'Payment updated successfully' })
@ApiNotFoundResponse({ description: 'Payment not found' })
updatePayment(@Param('id') id: string, @Body() updatePaymentDto: UpdatePaymentDto) {
return this.paymentsService.update(+id, updatePaymentDto);
}
// @UseGuards(AdminAuthGuard)
// @ApiBearerAuth()
// @Patch('admin/payments/:id')
// @ApiOperation({ summary: 'Update a payment' })
// @ApiParam({ name: 'id', type: 'number', description: 'Payment ID' })
// @ApiBody({ type: UpdatePaymentDto })
// @ApiOkResponse({ description: 'Payment updated successfully' })
// @ApiNotFoundResponse({ description: 'Payment not found' })
// updatePayment(@Param('id') id: string, @Body() updatePaymentDto: UpdatePaymentDto) {
// return this.paymentsService.update(+id, updatePaymentDto);
// }
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Delete('admin/payments/:id')
@ApiOperation({ summary: 'Delete a payment' })
@ApiParam({ name: 'id', type: 'number', description: 'Payment ID' })
@ApiOkResponse({ description: 'Payment deleted successfully' })
@ApiNotFoundResponse({ description: 'Payment not found' })
removePayment(@Param('id') id: string) {
return this.paymentsService.remove(+id);
}
// @UseGuards(AdminAuthGuard)
// @ApiBearerAuth()
// @Delete('admin/payments/:id')
// @ApiOperation({ summary: 'Delete a payment' })
// @ApiParam({ name: 'id', type: 'number', description: 'Payment ID' })
// @ApiOkResponse({ description: 'Payment deleted successfully' })
// @ApiNotFoundResponse({ description: 'Payment not found' })
// removePayment(@Param('id') id: string) {
// return this.paymentsService.remove(+id);
// }
/** payment methods */
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Get('admin/payments/methods')
@ApiOperation({ summary: 'Get restaurant all payment methods' })
@ApiOkResponse({ description: 'List of restaurant payment methods' })
@ApiNotFoundResponse({ description: 'Restaurant payment methods not found' })
findByRestaurant(@RestId() restId: string) {
return this.paymentMethodService.findByRestaurant(restId);
}
@@ -92,7 +80,6 @@ export class PaymentsController {
@Post('admin/payments/methods')
@ApiOperation({ summary: 'Create a new restaurant payment method' })
@ApiBody({ type: CreatePaymentMethodDto })
@ApiCreatedResponse({ description: 'Restaurant payment method created successfully' })
createRestaurantPaymentMethod(@RestId() restId: string, @Body() createPaymentMethodDto: CreatePaymentMethodDto) {
return this.paymentMethodService.create(restId, createPaymentMethodDto);
}
@@ -102,8 +89,6 @@ export class PaymentsController {
@Get('admin/payments/methods/:paymentMethodId')
@ApiOperation({ summary: 'Get restaurant payment method by ID' })
@ApiParam({ name: 'paymentMethodId', type: 'string', description: 'Payment method ID' })
@ApiOkResponse({ description: 'Payment method found' })
@ApiNotFoundResponse({ description: 'Payment method not found' })
findOneRestaurantPaymentMethod(@Param('paymentMethodId') paymentMethodId: string) {
return this.paymentMethodService.findOne(paymentMethodId);
}
@@ -114,8 +99,6 @@ export class PaymentsController {
@ApiOperation({ summary: 'Update a restaurant payment method' })
@ApiParam({ name: 'paymentMethodId', type: 'string', description: 'Payment method ID' })
@ApiBody({ type: UpdatePaymentMethodDto })
@ApiOkResponse({ description: 'Restaurant payment method updated successfully' })
@ApiNotFoundResponse({ description: 'Restaurant payment method not found' })
updateRestaurantPaymentMethod(
@Param('paymentMethodId') paymentMethodId: string,
@Body() updatePaymentMethodDto: UpdatePaymentMethodDto,
@@ -128,8 +111,6 @@ export class PaymentsController {
@Delete('admin/payments/methods/:paymentMethodId')
@ApiOperation({ summary: 'Delete a restaurant payment method' })
@ApiParam({ name: 'paymentMethodId', type: 'string', description: 'Payment method ID' })
@ApiOkResponse({ description: 'Restaurant payment method deleted successfully' })
@ApiNotFoundResponse({ description: 'Restaurant payment method not found' })
removeRestaurantPaymentMethod(@Param('paymentMethodId') paymentMethodId: string) {
return this.paymentMethodService.remove(paymentMethodId);
}