ref for projection snapshots

This commit is contained in:
mats committed 2026-06-28 18:41:31 +02:00
1 parent 21bcb63440
commit 5a3ffcb6bc
4 files changed
+91 -5

No files matched your search

+12
View File
@@ -61,6 +61,12 @@ type Schema struct {
CategoryField string `json:"category_field,omitempty"`
BrandField string `json:"brand_field,omitempty"`
ImageField string `json:"image_field,omitempty"`
// ItemIdField is the source-side key carrying the producer's catalog
// item id (uint32-equivalent). DefaultSchema points at "id" (matching
// the product service's /api/get/{sku} shape). Producers that omit
// an integer id field simply leave ItemIdField empty — consumers see
// Projection.ItemID=0 and fall back to their HTTP lookup.
ItemIdField string `json:"item_id_field,omitempty"`
// --- fixed / default values used when a source field is absent ---.
FixedCurrency string `json:"fixed_currency,omitempty"`
@@ -118,6 +124,8 @@ func DefaultSchema() Schema {
CategoryField: "category",
BrandField: "brand",
ImageField: "image",
// Standard product service carries the integer catalog id under "id".
ItemIdField: "id",
UpdatedAtField: "updated_at",
FixedCurrency: "", // read from source if present
@@ -139,6 +147,9 @@ func DefaultSchema() Schema {
// The wire contract is class identifiers; platform/tax resolves them to
// numeric rates out of band. Shipping "25" as the class would break that
// resolution path on the consumer side.
//
// ItemIdField: bygglagret rows carry the integer item id under "item_id"
// (matches the per-row log shape we see from the upstream product import).
func BygglagretSchema() Schema {
return Schema{
Tenant: "bygglagret",
@@ -152,6 +163,7 @@ func BygglagretSchema() Schema {
CategoryField: "CategoryPath",
BrandField: "Brand",
ImageField: "PrimaryImage",
ItemIdField: "item_id",
UpdatedAtField: "LastModifiedMs",
FixedCurrency: "SEK",