Files
psp_api/src/modules/pos/pos.controller.ts
T

33 lines
906 B
TypeScript
Raw Normal View History

import { Body, Controller, Get, Post } from '@nestjs/common'
import { CreateOrderDto } from './dto/create-pos.dto'
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('/orders/create')
async createOrder(@Body() dto: CreateOrderDto) {
const inventoryId = await this.posService.getDefaultInventoryId()
return this.posService.createOrder(dto, inventoryId!)
}
}