feat: add salePrice field to Product model and update related files

- Added salePrice field to Product model in Prisma schema and generated files.
- Updated Product scalar field enums in both TypeScript files.
- Modified aggregate output types to include salePrice.
- Enhanced input types for creating and updating products to support salePrice.
- Updated migration file to add salePrice column to Products table.
- Created DTOs for inventory management in POS module.
- Implemented POS controller and service with methods for stock and product categories.
This commit is contained in:
2025-12-14 20:34:07 +03:30
parent 9d7d94b5f8
commit 687c89c3e1
13 changed files with 360 additions and 25 deletions
+67
View File
@@ -0,0 +1,67 @@
import { Controller, Get } from '@nestjs/common'
import { PosService } from './pos.service'
@Controller('pos')
export class PosController {
constructor(private readonly posService: PosService) {}
@Get()
getInfo() {
return this.posService.getInfo()
}
@Get('/stock')
async getStock() {
const inventoryId = await this.posService.getDefaultInventoryId()
return this.posService.getStock(inventoryId!)
}
@Get('/product-categories')
async getProductCategories() {
const inventoryId = await this.posService.getDefaultInventoryId()
return this.posService.getProductCategories(inventoryId!)
}
// @Post()
// create(@Body() dto: CreateInventoryDto) {
// return this.inventoriesService.create(dto)
// }
// @Get()
// @ApiQuery({ name: 'isPointOfSale', required: false, type: Boolean })
// findAll(@Query('isPointOfSale') isPointOfSale?: boolean) {
// return this.inventoriesService.findAll(isPointOfSale)
// }
// @Get(':id')
// findOne(@Param('id') id: string) {
// return this.inventoriesService.findOne(Number(id))
// }
// @Patch(':id')
// update(@Param('id') id: string, @Body() dto: UpdateInventoryDto) {
// return this.inventoriesService.update(Number(id), dto)
// }
// @Delete(':id')
// remove(@Param('id') id: string) {
// return this.inventoriesService.remove(Number(id))
// }
// @Get(':id/movements')
// @ApiQuery({ name: 'type', required: false, enum: MovementType })
// findInventoryMovements(@Param('id') id: string, @Query('type') type?: MovementType) {
// return this.inventoriesService.findInventoryMovements(Number(id), type ?? undefined)
// }
// @Get(':id/stock')
// @ApiQuery({ name: 'isAvailable', required: false, type: Boolean })
// getStock(@Param('id') id: string, @Query('isAvailable') isAvailable?: boolean) {
// return this.inventoriesService.getStock(Number(id), isAvailable ?? undefined)
// }
// @Get(':id/products/:productId/cardex')
// getProductCardex(@Param('id') id: string, @Param('productId') productId: string) {
// return this.inventoriesService.getProductCardex(Number(id), Number(productId))
// }
}