parent
cb3eaeb425
commit
be0f01bc1a
2 changed files with 38 additions and 8 deletions
@ -1,13 +1,17 @@ |
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; |
||||
import { InvoiceService } from './invoice.service'; |
||||
import { Invoice } from './entities/invoice.entity'; |
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from "@nestjs/common"; |
||||
import { InvoiceService } from "./invoice.service"; |
||||
import { Invoice } from "./entities/invoice.entity"; |
||||
|
||||
@Controller('invoice') |
||||
@Controller("invoice") |
||||
export class InvoiceController { |
||||
constructor(private readonly invoiceService: InvoiceService) {} |
||||
@Post('create') |
||||
async createInvoice(@Body() body:{userId:number, totalAmount:number}):Promise<Invoice>{ |
||||
const { userId, totalAmount} = body |
||||
return this.invoiceService.createInvoice(userId, totalAmount) |
||||
@Post("create") |
||||
async createInvoice(@Body() body: { userId: number; totalAmount: number }): Promise<Invoice> { |
||||
const { userId, totalAmount } = body; |
||||
return this.invoiceService.createInvoice(userId, totalAmount); |
||||
} |
||||
@Get(":userId") |
||||
async getInvoices(@Param("userId") userId: number): Promise<any> { |
||||
return this.invoiceService.getInvoicesByUser(userId); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue