mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
91b320d489
- Extend DB schema with product_warehouses and stock_logs tables - Implement stock adjustment API (increase/decrease operations) - Add comprehensive validation for all adjustment operations - Implement audit log system for each adjustment with history tracking - Include transaction handling, DTOs, seeders, and proper error handling - Add adjustment history API with pagination and filtering TODO: Integration testing pending
30 lines
1.2 KiB
Go
30 lines
1.2 KiB
Go
package adjustments
|
|
|
|
import (
|
|
"github.com/go-playground/validator/v10"
|
|
"github.com/gofiber/fiber/v2"
|
|
"gorm.io/gorm"
|
|
|
|
sAdjustment "gitlab.com/mbugroup/lti-api.git/internal/modules/inventory/adjustments/services"
|
|
rProductWarehouse "gitlab.com/mbugroup/lti-api.git/internal/modules/inventory/product-warehouses/repositories"
|
|
rWarehouse "gitlab.com/mbugroup/lti-api.git/internal/modules/master/warehouses/repositories"
|
|
rStockLogs "gitlab.com/mbugroup/lti-api.git/internal/modules/shared/stock-logs/repositories"
|
|
|
|
rUser "gitlab.com/mbugroup/lti-api.git/internal/modules/users/repositories"
|
|
sUser "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"
|
|
)
|
|
|
|
type AdjustmentModule struct{}
|
|
|
|
func (AdjustmentModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *validator.Validate) {
|
|
stockLogsRepo := rStockLogs.NewStockLogRepository(db)
|
|
warehouseRepo := rWarehouse.NewWarehouseRepository(db)
|
|
productWarehouseRepo := rProductWarehouse.NewProductWarehouseRepository(db)
|
|
userRepo := rUser.NewUserRepository(db)
|
|
|
|
adjustmentService := sAdjustment.NewAdjustmentService(stockLogsRepo, warehouseRepo, productWarehouseRepo, validate)
|
|
userService := sUser.NewUserService(userRepo, validate)
|
|
|
|
AdjustmentRoutes(router, userService, adjustmentService)
|
|
}
|