Deduplicate vendor seen by partnumber and fix vendor mappings list

This commit is contained in:
Mikhail Chusavitin
2026-02-20 15:37:41 +03:00
parent 7d402b756d
commit 60563509e4
8 changed files with 396 additions and 91 deletions

View File

@@ -5,6 +5,33 @@
---
## 2026-02-20: Seen Registry Deduplication by Partnumber
### Decision
Changed `qt_vendor_partnumber_seen` semantics to one row per `partnumber` (vendor/source are no longer part of uniqueness).
### Rationale
- Eliminates duplicate seen rows when the same partnumber appears both with vendor and without vendor.
- Keeps ignore behavior consistent regardless of vendor presence.
- Simplifies operational cleanup and prevents re-creation of vendor/no-vendor duplicates.
### Constraints
- `partnumber` is now the unique key in seen registry.
- Ignore checks are resolved by `partnumber` only.
- Stock provenance must be preserved (`source_type='stock'`) when stock data exists for the partnumber.
### Files
- Migration: `migrations/025_dedup_vendor_seen_by_partnumber.sql`
- Service: `internal/services/stock_import.go`
- Service: `internal/services/vendor_mapping.go`
- Model: `internal/models/lot.go`
---
## 2026-02-18: Global Vendor Partnumber Mapping
### Decision