- 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>
1.4 KiB
1.4 KiB
Data Rules
Component Categories (lot_category)
Source
Categories are always taken from lot.lot_category (table lot).
NOT from qt_lot_metadata.
NOT derived from the LOT name or article name.
When creating pricelists
- Estimate: load
lot.lot_categoryfor all components. - Warehouse: load
lot.lot_categoryfor all positions. - Persist into
lot_categorycolumn ofqt_pricelist_items.
Model
type PricelistItem struct {
LotCategory *string `gorm:"column:lot_category;size:50" json:"category,omitempty"`
// JSON field is "category" for the frontend
}
Rules
- Category is not a virtual field — it is persisted to DB when the pricelist is created.
- JOIN with
lotis only needed forlot_description; category is already inqt_pricelist_items. - Default value when category is absent in source:
PART_.
Price Method
- Warehouse pricelist:
price_method="weighted_avg"(quantity-weighted average). - Estimate pricelist: method determined by per-component settings.
Warehouse: Filtering by lot_partnumbers
Rule (CRITICAL): only positions with a matching record in lot_partnumbers are included in the warehouse pricelist. Unmapped partnumbers are completely excluded.
Component Data Source
- Source: MariaDB (not SQLite).
handlers/component.gousescomponentService.List()(MariaDB).