all
This commit is contained in:
1 parent
90125aede9
commit
2d6c29a1f3
404 files changed
+126983
-85
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { Body, Controller, Delete, Get, Inject, Param, ParseIntPipe, Patch, Post } from "@nestjs/common";
|
||||
import type { CreateCustomerInput, UpdateCustomerInput } from "../../dtos/customer.dto.js";
|
||||
import { CUSTOMER_SERVICE } from "./interfaces/customer-service.interface.js";
|
||||
import type { ICustomerService } from "./interfaces/customer-service.interface.js";
|
||||
|
||||
@Controller("customers")
|
||||
export class CustomerController {
|
||||
constructor(@Inject(CUSTOMER_SERVICE) private readonly customerService: ICustomerService) {}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.customerService.findAll();
|
||||
}
|
||||
|
||||
@Get(":id")
|
||||
findOne(@Param("id", ParseIntPipe) id: number) {
|
||||
return this.customerService.findById({ id });
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Body() body: CreateCustomerInput) {
|
||||
return this.customerService.create(body);
|
||||
}
|
||||
|
||||
@Patch(":id")
|
||||
update(@Param("id", ParseIntPipe) id: number, @Body() body: UpdateCustomerInput) {
|
||||
return this.customerService.update({ id }, body);
|
||||
}
|
||||
|
||||
@Delete(":id")
|
||||
remove(@Param("id", ParseIntPipe) id: number) {
|
||||
return this.customerService.delete({ id });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user