diff --git a/src/modules/coupons/controllers/coupon.controller.ts b/src/modules/coupons/controllers/coupon.controller.ts index f1e579b..247d06e 100644 --- a/src/modules/coupons/controllers/coupon.controller.ts +++ b/src/modules/coupons/controllers/coupon.controller.ts @@ -24,6 +24,20 @@ import { RestId } from 'src/common/decorators'; export class CouponController { constructor(private readonly couponService: CouponService) {} + @Post('public/coupons/validate') + @ApiOperation({ summary: 'Validate a coupon code' }) + @ApiBody({ type: ValidateCouponDto }) + @ApiOkResponse({ description: 'Coupon validation result' }) + @ApiNotFoundResponse({ description: 'Coupon not found or invalid' }) + validateCoupon(@Body() validateCouponDto: ValidateCouponDto, @RestId() restId: string) { + return this.couponService.validateCoupon( + validateCouponDto.code, + restId, + validateCouponDto.orderAmount || 0, + validateCouponDto.userId, + ); + } + @UseGuards(AdminAuthGuard) @ApiBearerAuth() @Post('admin/coupons') @@ -82,21 +96,9 @@ export class CouponController { return this.couponService.remove(id); } - @Post('public/coupons/validate') - @ApiOperation({ summary: 'Validate a coupon code' }) - @ApiBody({ type: ValidateCouponDto }) - @ApiOkResponse({ description: 'Coupon validation result' }) - @ApiNotFoundResponse({ description: 'Coupon not found or invalid' }) - validateCoupon(@Body() validateCouponDto: ValidateCouponDto, @RestId() restId: string) { - return this.couponService.validateCoupon( - validateCouponDto.code, - restId, - validateCouponDto.orderAmount || 0, - validateCouponDto.userId, - ); - } - @Get('public/coupons/generate-code') + + @Get('admin/coupons/generate-code') @ApiOperation({ summary: 'generate a coupon code' }) generateCouponCode(@RestId() restId: string) { return this.couponService.generateCouponCode(restId);