feat: optimize background tasks and fix warehouse pricelist workflow
Optimize task retention from 5 minutes to 30 seconds to reduce polling overhead since toast notifications are shown only once. Add conditional warehouse pricelist creation via checkbox. Fix category storage in warehouse pricelists to properly load from lot table. Replace SSE with task polling for all long operations. Add comprehensive logging for debugging while minimizing noise from polling endpoints. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -233,8 +233,9 @@ func (r *PricelistRepository) GetItems(pricelistID uint, offset, limit int, sear
|
||||
|
||||
var items []models.PricelistItem
|
||||
// Optimized query with JOIN to avoid N+1
|
||||
// lot_category is stored in pricelist_items, lot_description comes from JOIN
|
||||
itemsQuery := r.db.Table("qt_pricelist_items AS pi").
|
||||
Select("pi.*, COALESCE(l.lot_description, '') AS lot_description, COALESCE(l.lot_category, '') AS category").
|
||||
Select("pi.*, COALESCE(l.lot_description, '') AS lot_description").
|
||||
Joins("LEFT JOIN lot AS l ON l.lot_name = pi.lot_name").
|
||||
Where("pi.pricelist_id = ?", pricelistID)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user