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