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:
2026-02-16 11:08:10 +03:00
parent c9f7f4e908
commit f64c4fd6b2
17 changed files with 346 additions and 133 deletions

View File

@@ -55,6 +55,7 @@ type PricelistItem struct {
ID uint `gorm:"primaryKey" json:"id"`
PricelistID uint `gorm:"not null;index:idx_pricelist_lot" json:"pricelist_id"`
LotName string `gorm:"size:255;not null;index:idx_pricelist_lot" json:"lot_name"`
LotCategory *string `gorm:"column:lot_category;size:50" json:"category,omitempty"`
Price float64 `gorm:"type:decimal(12,2);not null" json:"price"`
PriceMethod string `gorm:"size:20" json:"price_method"`
@@ -65,10 +66,9 @@ type PricelistItem struct {
MetaPrices string `gorm:"size:1000" json:"meta_prices,omitempty"`
// Virtual fields for display (not stored in qt_pricelist_items table)
// LotDescription and Category are populated via JOIN in SQL queries
// AvailableQty and Partnumbers are populated programmatically
// LotDescription is populated via JOIN in SQL queries
// AvailableQty and Partnumbers are populated programmatically for warehouse pricelists
LotDescription string `gorm:"-" json:"lot_description,omitempty"`
Category string `gorm:"-" json:"category,omitempty"`
AvailableQty *float64 `gorm:"-" json:"available_qty,omitempty"`
Partnumbers []string `gorm:"-" json:"partnumbers,omitempty"`
}