chore: add service to approve a invoice by user
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Get, Param, Post, Query } from "@nestjs/common";
|
||||
import { Body, Controller, Get, Param, Patch, Post, Query } from "@nestjs/common";
|
||||
import { ApiOperation } from "@nestjs/swagger";
|
||||
|
||||
import { ApplyDiscountDto } from "./DTO/apply-discount-invoice.dto";
|
||||
@@ -48,6 +48,13 @@ export class InvoicesController {
|
||||
return this.invoiceService.getInvoiceById(paramDto.id, isAdmin, userId);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "approve invoice by user" })
|
||||
@AuthGuards()
|
||||
@Patch(":id/approve")
|
||||
approveInvoiceByUser(@Param() paramDto: ParamDto, @UserDec("id") userId: string) {
|
||||
return this.invoiceService.approveInvoiceByUser(paramDto.id, userId);
|
||||
}
|
||||
|
||||
@Post(":id/apply-discount")
|
||||
async applyDiscount(@Param() paramDto: ParamDto, @Body() applyDiscountDto: ApplyDiscountDto) {
|
||||
return this.invoiceService.applyDiscount(paramDto.id, applyDiscountDto);
|
||||
|
||||
Reference in New Issue
Block a user