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