feat(bom): canonical lot mappings and updated vendor spec docs

This commit is contained in:
Mikhail Chusavitin
2026-02-25 19:07:27 +03:00
parent aa65fc8156
commit e9230c0e58
7 changed files with 967 additions and 188 deletions

View File

@@ -10,6 +10,7 @@ import (
type SeenPartnumber struct {
Partnumber string
Description string
Ignored bool
}
// PushPartnumberSeen inserts unresolved vendor partnumbers into qt_vendor_partnumber_seen on MariaDB.
@@ -31,13 +32,14 @@ func (s *Service) PushPartnumberSeen(items []SeenPartnumber) error {
}
err := mariaDB.Exec(`
INSERT INTO qt_vendor_partnumber_seen
(source_type, vendor, partnumber, description, last_seen_at)
(source_type, vendor, partnumber, description, is_ignored, last_seen_at)
VALUES
('manual', '', ?, ?, ?)
('manual', '', ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE
last_seen_at = VALUES(last_seen_at),
is_ignored = VALUES(is_ignored),
description = COALESCE(NULLIF(VALUES(description), ''), description)
`, item.Partnumber, item.Description, now).Error
`, item.Partnumber, item.Description, item.Ignored, now).Error
if err != nil {
slog.Error("failed to upsert partnumber_seen", "partnumber", item.Partnumber, "error", err)
// Continue with remaining items