feat: implement purchase receipt items management with create, update, find, and delete functionalities
feat: add purchase receipts management with create, update, find, and delete functionalities feat: implement sales invoice items management with create, update, find, and delete functionalities feat: add sales invoices management with create, update, find, and delete functionalities feat: implement stock adjustments management with create, update, find, and delete functionalities feat: add stock balance retrieval functionality feat: implement stock movements management with create, update, find, and delete functionalities
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { Controller, Get, Param } from '@nestjs/common'
|
||||
import { StockBalanceService } from './stock-balance.service'
|
||||
|
||||
@Controller('stock-balance')
|
||||
export class StockBalanceController {
|
||||
constructor(private readonly service: StockBalanceService) {}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.service.findAll()
|
||||
}
|
||||
|
||||
@Get(':itemId')
|
||||
findOne(@Param('itemId') itemId: string) {
|
||||
return this.service.findOne(Number(itemId))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PrismaModule } from '../prisma/prisma.module'
|
||||
import { StockBalanceController } from './stock-balance.controller'
|
||||
import { StockBalanceService } from './stock-balance.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [StockBalanceController],
|
||||
providers: [StockBalanceService],
|
||||
})
|
||||
export class StockBalanceModule {}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class StockBalanceService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
async findAll() {
|
||||
const items = await this.prisma.stockBalance.findMany()
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async findOne(ProductId: number) {
|
||||
const item = await this.prisma.stockBalance.findUnique({ where: { ProductId } })
|
||||
if (!item) return null
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user