Feat[BE]: enhance chickin stock management with FIFO service integration and fix key naming inconsistencies

This commit is contained in:
aguhh18
2025-12-24 09:24:32 +07:00
committed by Hafizh A. Y
parent ebf0f8c5ab
commit 67ddd8e667
4 changed files with 26 additions and 30 deletions
@@ -39,19 +39,19 @@ func (ChickinModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *
projectFlockRepo := rProjectFlock.NewProjectflockRepository(db)
productWarehouseRepo := rProductWarehouse.NewProductWarehouseRepository(db)
stockAllocationRepo := commonRepo.NewStockAllocationRepository(db)
fifoService := commonSvc.NewFifoService(db, stockAllocationRepo, productWarehouseRepo, utils.Log)
userRepo := rUser.NewUserRepository(db)
fifoService := commonSvc.NewFifoService(db, stockAllocationRepo, productWarehouseRepo, utils.Log)
// Register PROJECT_CHICKIN as usable
if err := fifoService.RegisterUsable(fifo.UsableConfig{
Key: fifo.UsablekeyProjectChickin,
Key: fifo.UsableKeyProjectChickin,
Table: "project_chickins",
Columns: fifo.UsableColumns{
ID: "id",
ProductWarehouseID: "product_warehouse_id",
UsageQuantity: "usage_qty",
PendingQuantity: "pending_usage_qty",
CreatedAt: "id",
CreatedAt: "created_at",
},
}); err != nil {
if !strings.Contains(strings.ToLower(err.Error()), "already registered") {