chore: add discount logic to apply to the plan price and ...
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Body, Controller, Get, Param, Patch, Post, Query } from "@nestjs/common";
|
||||
import { ApiOperation } from "@nestjs/swagger";
|
||||
|
||||
import { ApplyDiscountDto } from "./DTO/apply-discount.dto";
|
||||
import { CreateInvoiceDto } from "./DTO/create-invoice.dto";
|
||||
import { InvoicesSearchQueryDto, UserInvoicesSearchQueryDto } from "./DTO/invoices-search-query.dto";
|
||||
import { UpdateInvoiceDto } from "./DTO/update-invoice.dto";
|
||||
@@ -71,15 +72,15 @@ export class InvoicesController {
|
||||
return this.invoiceService.payInvoice(paramDto.id, userId);
|
||||
}
|
||||
|
||||
// @ApiOperation({ summary: "apply discount on invoice by user" })
|
||||
// @Post(":id/apply-discount")
|
||||
// async applyDiscount(@Param() paramDto: ParamDto, @Body() applyDiscountDto: ApplyDiscountDto, @UserDec("id") userId: string) {
|
||||
// return this.discountsService.applyDiscountToInvoice(paramDto.id, applyDiscountDto.code, userId);
|
||||
// }
|
||||
@ApiOperation({ summary: "apply discount on invoice by user" })
|
||||
@Post(":id/apply-discount")
|
||||
async applyDiscount(@Param() paramDto: ParamDto, @Body() applyDiscountDto: ApplyDiscountDto, @UserDec("id") userId: string) {
|
||||
return this.invoiceService.applyDiscount(paramDto.id, applyDiscountDto.code, userId);
|
||||
}
|
||||
|
||||
// @ApiOperation({ summary: "cancel discount by user" })
|
||||
// @Post(":id/cancel-discount")
|
||||
// cancelDiscount(@Param() paramDto: ParamDto, @UserDec("id") userId: string) {
|
||||
// return this.discountsService.cancelInvoiceDiscount(paramDto.id, userId);
|
||||
// }
|
||||
@ApiOperation({ summary: "cancel discount by user" })
|
||||
@Post(":id/cancel-discount")
|
||||
cancelDiscount(@Param() paramDto: ParamDto, @UserDec("id") userId: string) {
|
||||
return this.invoiceService.cancelDiscount(paramDto.id, userId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user