mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Fix[BE]: fix 500 API Loookup project flock
This commit is contained in:
+2
-2
@@ -93,7 +93,7 @@ func (r *ProductWarehouseRepositoryImpl) GetByCategoryCodeAndWarehouseID(ctx con
|
||||
Joins("JOIN products ON products.id = product_warehouses.product_id").
|
||||
Joins("JOIN product_categories ON product_categories.id = products.product_category_id").
|
||||
Where("product_categories.code = ? AND product_warehouses.warehouse_id = ?", categoryCode, warehouseId).
|
||||
Order("product_warehouses.created_at DESC")
|
||||
Order("product_warehouses.id DESC")
|
||||
|
||||
// preload relations so nested Product and Warehouse are populated
|
||||
err := q.Preload("Product").Preload("Warehouse").Find(&productWarehouses).Error
|
||||
@@ -115,7 +115,7 @@ func (r *ProductWarehouseRepositoryImpl) GetLatestByCategoryCodeAndWarehouseID(c
|
||||
Joins("JOIN products ON products.id = product_warehouses.product_id").
|
||||
Joins("JOIN product_categories ON product_categories.id = products.product_category_id").
|
||||
Where("product_categories.code = ? AND product_warehouses.warehouse_id = ?", categoryCode, warehouseId).
|
||||
Order("product_warehouses.created_at DESC").
|
||||
Order("product_warehouses.id DESC").
|
||||
Preload("Product").Preload("Warehouse").
|
||||
First(&productWarehouse).Error
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user