- Created bible/ with hierarchical documentation (architecture, pricelists,
vendor mapping, background tasks, data rules, patterns, API, operations, history)
- CLAUDE.md reduced to one instruction: read and follow the bible
- README.md reduced to quick start only
- Removed MEMORY.md and csv_export.md (content consolidated into bible/)
- Fixed stale facts found during audit: weighted_avg (not weighted_median),
correct API route names (/export-csv, /recalculate-all)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
- Create new /lot page with two tabs:
1. LOT: component management (formerly in /admin/pricing)
2. Сопоставления: partnumber ↔ LOT mappings (formerly in Warehouse tab)
- Remove LOT tab from Pricing Admin page
- Remove stock mappings section from Warehouse tab
- Update main menu: LOT link now points to /lot
- Default tab in Pricing Admin changed to Estimate
- Add Lot() handler in web.go
- Add /lot route in main.go
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Added handling for Error 1833 (Cannot change column used in foreign key)
in the auto-migration process. This allows migrations to skip gracefully
when encountering columns that cannot be modified due to existing
foreign key constraints from other databases.
The Configuration model has a uuid column that's referenced by a foreign
key in RFQ_LOG.qt_configurations, preventing GORM from modifying it
during auto-migration. Now this error is caught and skipped like other
constraint-related errors.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Две ключевые исправления:
1. Потоковая отправка прогресса создания (SSE):
- Эндпоинт CreateWithProgress теперь отправляет Server-Sent Events
вместо возврата JSON с task_id
- Полирует статус задачи и отправляет обновления прогресса в реальном времени
- Отправляет финальное событие с данными прайслиста или ошибкой
- Фронтенд уже ожидал этого формата SSE
2. Исправление маппинга колонки lot_category:
- Добавлен явный тег column в поле Category модели PricelistItem
чтобы маппиться на колонку 'lot_category' в БД
- Категория теперь хранится как снимок в таблице pricelist_items
- Обновлены запросы репозитория для использования сохраненной
категории вместо динамических JOIN с таблицей lot
Это исправляет ошибки:
- "Создание прервано: не получен результат" (фронтенд ожидал streaming)
- "Unknown column 'category' in 'INSERT INTO'" (несоответствие схемы БД)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Added background task manager with goroutine execution and panic recovery
- Replaced SSE streaming with background task execution for:
* Price recalculation (RecalculateAll)
* Stock import (ImportStockLog)
* Pricelist creation (CreateWithProgress)
- Implemented unified polling for task status and DB connection in frontend
- Added task indicator in top bar showing running tasks count
- Added toast notifications for task completion/error
- Tasks automatically cleaned up after 10 minutes
- Tasks show progress (0-100%) with descriptive messages
- Updated handler constructors to receive task manager
- Added API endpoints for task status (/api/tasks, /api/tasks/:id)
Fixes issue with SSE disconnection on slow connections during long-running operations
- Add CSV export functionality for pricelists with download button
- Export includes all pricelist items with proper UTF-8 encoding
- Support both warehouse and estimate pricelist sources
- Remove description column from admin pricing tables
- Show description as tooltip on row hover instead
- Improve table layout by removing redundant column
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add duplicate detection before batch insert of auto-mappings:
- Query existing partnumbers from lot_partnumbers table
- Build case-insensitive set of existing entries
- Filter out duplicates before CreateInBatches
- Also prevent duplicates within single batch
This ensures partnumber uniqueness as primary key requires.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add LOT creation functionality in pricing admin
- New API endpoint POST /api/admin/pricing/lots
- Modal form for creating new LOT with auto-category detection
- Creates entries in both lot and qt_lot_metadata tables
- Implement auto-save for stock mappings
- Auto-save on change for partnumber → LOT mappings
- Visual feedback (orange during save, green on success, red on error)
- Works in both main mappings table and import suggestions
- Improve stock import suggestions UI
- Remove "Причина" column from suggestions table
- Increase LOT and Partnumber column widths to 33% each
- Better visual balance in the table layout
- Disable automatic warehouse pricelist creation on stock_log import
- Import now completes at 100% after stock_log update
- Manual pricelist creation available via UI when needed
- Faster import process without auto-generation overhead
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>