2025-12-16 10:03:49 +03:30
|
|
|
import { Body, Controller, Get, Post } from '@nestjs/common'
|
|
|
|
|
import { CreateOrderDto } from './dto/create-pos.dto'
|
2025-12-14 20:34:07 +03:30
|
|
|
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!)
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-16 10:03:49 +03:30
|
|
|
@Post('/orders/create')
|
|
|
|
|
async createOrder(@Body() dto: CreateOrderDto) {
|
|
|
|
|
const inventoryId = await this.posService.getDefaultInventoryId()
|
|
|
|
|
|
|
|
|
|
return this.posService.createOrder(dto, inventoryId!)
|
|
|
|
|
}
|
2025-12-14 20:34:07 +03:30
|
|
|
}
|