Products

Product catalog for renovation services and funding products. Products define what Renewa offers — from energy consulting (iSFP) to specific funding program services (BEG EM, KfW). Supports bundles, application type mapping, and is the R1 mirror of the HubSpot Product object (0-7).

Source Files

LayerPath
Schemabackend/src/db/schema.ts
Admin Routesbackend/src/routes/admin/products.ts
Servicebackend/src/services/catalog-service.ts
Sync Configbackend/src/services/hubspot/sync-engine/entity-configs.ts (productConfig)
Admin Pagesfrontend/src/pages/admin/AdminProductsList.tsx, AdminProductDetail.tsx
Mock Databackend/src/db/mocks/products.ts (large catalog; loads only with AUTO_MOCK=true)

Database Tables

TablePurpose
productsMain entity — key, label, category, pricing, HubSpot sync
product_bundle_childrenParent-child relationships for bundle products
application_typesAntragstypen (e.g., beg_einzelmassnahme, kfw_foerderung)
product_application_typesJunction: which products apply to which application types

Key Fields

FieldTypeNotes
keytextUnique identifier (e.g., bafa_beg_em, effi_wg, isfp)
shortNametextShort display name (e.g., BEG EM, Effi WG, iSFP)
labeljsonb LocalizedTextBilingual name (de/en, required)
descriptionjsonb LocalizedTextBilingual description
categoryvarcharGrouping — foerdermittel (funding), beratung (consulting)
actorvarcharResponsible party — engineer, backoffice, technician, team
productNumbervarcharHubSpot Produktnummer (e.g., BBG EFFI AT)
listPriceintegerListenpreis in cents (e.g., 110000 = 1100.00 EUR)
priceEur / costOfGoodsSolddecimal(12,2)HubSpot prices — decimal strings, Big.js arithmetic only (Invoices money rules)
isBundlebooleanWhether this is a bundle (Bündelprodukt)
craftvarcharHubSpot “gewerk” — Wände, Steildach, Wärmepumpe, …
applicationTypeKeyvarcharHubSpot “antragstyp” — KfW 261 Effi, BAFA BEG EM, …
technicalPlanningTypeKeyvarcharHubSpot “berechnungstyp” — iSFP, Heizlastberechnung, …
positionTypevarcharHubSpot “positionstyp” — Rabatt, TVO (document-matrix marker)
sourcevarcharrenewa (manually maintained) or hubspot (synced)
hubspotIdvarcharHubSpot vendor ID — sync round-tripping only, never business logic
recordOwnerContactIduuid FKRead-only HubSpot owner mirror, resolved to Contacts; sync layer is the sole writer

HubSpot Sync

Products mirror the HubSpot Product object (objectTypeId 0-7) via the sync engine (productConfig in entity-configs.ts):

AspectDetails
HubSpot RenewaProducts synced in with source: 'hubspot'; name/description land in hubspotProperties json
CoexistenceManually maintained source: 'renewa' rows live alongside synced rows (key unique)
Shared fieldshubspotId, sku, priceEur, hsStatus, hubspotProperties, hubspotSchemaVersion
Lifecyclearchived, archivedAt, deletedAt, mergedIntoHubspotId for sync state; orphan detection requires non-null hubspotId

No vendor lock-in: internal cross-table references (quote/invoice line items) join on products.id (UUID PK), never on hubspotId (CLAUDE.md HubSpot Entity Map).

Bundle System

Bundle products have child products via product_bundle_children:

  • parentProductId the bundle product
  • childProductId individual component products
  • sortOrder controls display ordering
  • Unique constraint prevents duplicate parent-child links

Relationships

Product 1──* Product Bundle Children (parent)
Product *──1 Product Bundle Children (child)
Product *──* Application Types (via product_application_types)
Product 1──* Quote Line Items (productId FK)

Features

  • Large mock catalog with real German renovation products (db/mocks/products.ts; “seeding” retired)
  • Bundle products with parent-child composition (Bündelprodukt)
  • Application type mapping — defines which products apply to which funding types
  • Matrix matching via craft, applicationTypeKey, technicalPlanningTypeKey, positionType
  • Admin management via Admin Dashboard with list and detail views
  • Workflow integration — workflow templates/phases/tasks match on product.key arrays (matchingProductsRequired, assignedProductKeys)
  • Used in Quotes line items via productId FK

Quotes | Invoices | Funding Programs | Measures | HubSpot Integration | Workflows | Admin Dashboard | Database Architecture