up
This commit is contained in:
@@ -24,6 +24,20 @@ import { RestId } from 'src/common/decorators';
|
|||||||
export class CouponController {
|
export class CouponController {
|
||||||
constructor(private readonly couponService: CouponService) {}
|
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)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@Post('admin/coupons')
|
@Post('admin/coupons')
|
||||||
@@ -82,21 +96,9 @@ export class CouponController {
|
|||||||
return this.couponService.remove(id);
|
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' })
|
@ApiOperation({ summary: 'generate a coupon code' })
|
||||||
generateCouponCode(@RestId() restId: string) {
|
generateCouponCode(@RestId() restId: string) {
|
||||||
return this.couponService.generateCouponCode(restId);
|
return this.couponService.generateCouponCode(restId);
|
||||||
|
|||||||
Reference in New Issue
Block a user