chore: complete the the invoice module - not tested
This commit is contained in:
@@ -1,4 +1,32 @@
|
||||
import { Controller } from "@nestjs/common";
|
||||
import { Body, Controller, Get, Post, Query } from "@nestjs/common";
|
||||
import { ApiOperation } from "@nestjs/swagger";
|
||||
|
||||
import { CreateInvoiceDto } from "./DTO/create-invoice.dto";
|
||||
import { InvoicesSearchQueryDto } from "./DTO/invoices-search-query.dto";
|
||||
import { InvoicesService } from "./providers/invoices.service";
|
||||
import { AuthGuards } from "../../common/decorators/auth-guard.decorator";
|
||||
import { Pagination } from "../../common/decorators/pagination.decorator";
|
||||
import { Roles } from "../../common/decorators/roles.decorator";
|
||||
import { RoleEnum } from "../users/enums/role.enum";
|
||||
|
||||
@Controller("invoices")
|
||||
export class InvoicesController {}
|
||||
export class InvoicesController {
|
||||
constructor(private readonly invoiceService: InvoicesService) {}
|
||||
|
||||
@ApiOperation({ summary: "create an invoice ==> admin route" })
|
||||
@AuthGuards()
|
||||
@Roles(RoleEnum.ADMIN)
|
||||
@Post()
|
||||
createInvoice(@Body() createDto: CreateInvoiceDto) {
|
||||
return this.invoiceService.createInvoiceAdmin(createDto);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "get all invoices ==> admin route" })
|
||||
@AuthGuards()
|
||||
@Pagination()
|
||||
@Roles(RoleEnum.ADMIN)
|
||||
@Get()
|
||||
getInvoices(@Query() queryDto: InvoicesSearchQueryDto) {
|
||||
return this.invoiceService.getInvoices(queryDto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user