mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 34c690956a |
@@ -739,25 +739,26 @@ func (s *adjustmentService) AdjustmentHistory(c *fiber.Ctx, query *validation.Qu
|
|||||||
}
|
}
|
||||||
offset := (query.Page - 1) * query.Limit
|
offset := (query.Page - 1) * query.Limit
|
||||||
|
|
||||||
var isProductsExist bool
|
if query.WarehouseID > 0 {
|
||||||
isWarehousesExist, err := s.WarehouseRepo.IdExists(c.Context(), uint(query.WarehouseID))
|
isWarehouseExist, err := s.WarehouseRepo.IdExists(c.Context(), query.WarehouseID)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, fiber.NewError(fiber.StatusInternalServerError, "Failed to validate warehouse")
|
return nil, 0, fiber.NewError(fiber.StatusInternalServerError, "Failed to validate warehouse")
|
||||||
}
|
}
|
||||||
if query.WarehouseID > 0 && !isWarehousesExist {
|
if !isWarehouseExist {
|
||||||
return nil, 0, fiber.NewError(fiber.StatusNotFound, "Warehouse not found")
|
return nil, 0, fiber.NewError(fiber.StatusNotFound, "Warehouse not found")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isProductsExist, err = s.ProductRepo.IdExists(c.Context(), uint(query.ProductID))
|
if query.ProductID > 0 {
|
||||||
|
isProductExist, err := s.ProductRepo.IdExists(c.Context(), query.ProductID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Log.Errorf("Failed to check product existence: %+v", err)
|
s.Log.Errorf("Failed to check product existence: %+v", err)
|
||||||
return nil, 0, fiber.NewError(fiber.StatusInternalServerError, "Failed to validate product")
|
return nil, 0, fiber.NewError(fiber.StatusInternalServerError, "Failed to validate product")
|
||||||
}
|
}
|
||||||
if query.ProductID > 0 && !isProductsExist {
|
if !isProductExist {
|
||||||
return nil, 0, fiber.NewError(fiber.StatusNotFound, "Product not found")
|
return nil, 0, fiber.NewError(fiber.StatusNotFound, "Product not found")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scope, scopeErr := m.ResolveLocationScope(c, s.AdjustmentStockRepository.DB())
|
scope, scopeErr := m.ResolveLocationScope(c, s.AdjustmentStockRepository.DB())
|
||||||
if scopeErr != nil {
|
if scopeErr != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user