621e15dd02
- Added Create and Update DTOs for Inventory, Product Brand, Product Category, Product Info, Product, Role, Store, User, and Vendor. - Implemented InventoriesController, ProductBrandsController, ProductCategoriesController, ProductInfoController, ProductsController, RolesController, StoresController, UsersController, and VendorsController with respective CRUD endpoints. - Developed InventoriesService, ProductBrandsService, ProductCategoriesService, ProductInfoService, ProductsService, RolesService, StoresService, UsersService, and VendorsService to handle business logic. - Created PrismaModule and PrismaService for database interactions using Prisma with MariaDB adapter. - Configured application with Swagger for API documentation and added global interceptors for logging and response mapping. - Established e2e testing setup with Jest for the application.
35 lines
883 B
TypeScript
35 lines
883 B
TypeScript
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
|
|
import { CreateStoreDto } from './dto/create-store.dto'
|
|
import { UpdateStoreDto } from './dto/update-store.dto'
|
|
import { StoresService } from './stores.service'
|
|
|
|
@Controller('stores')
|
|
export class StoresController {
|
|
constructor(private readonly storesService: StoresService) {}
|
|
|
|
@Post()
|
|
create(@Body() dto: CreateStoreDto) {
|
|
return this.storesService.create(dto)
|
|
}
|
|
|
|
@Get()
|
|
findAll() {
|
|
return this.storesService.findAll()
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@Param('id') id: string) {
|
|
return this.storesService.findOne(Number(id))
|
|
}
|
|
|
|
@Patch(':id')
|
|
update(@Param('id') id: string, @Body() dto: UpdateStoreDto) {
|
|
return this.storesService.update(Number(id), dto)
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@Param('id') id: string) {
|
|
return this.storesService.remove(Number(id))
|
|
}
|
|
}
|