Admin-level umbrella categories so the same logical service (e.g. mold add-on) aggregates across instances where each company has a different service ID.
Requirements
Context: Mar 17 standup—"group all of those mold services under that category and that's what bubbles up on the dashboard."
What we have today
service is always company-scoped (_companyId required, ref: 'company'). Identity for aggregation is ( _companyId, service._id ).category on service is a free-form string, not a ref—useful for UI copy per company but not a stable, company-agnostic key for cross-tenant dashboards.company does not embed services; linkage is only via service._companyId.New global tree collection (company-agnostic)
globalServiceCategory / serviceCategory, with adjacency-list tree fields: parentId (ObjectId | null for roots), name, optional description / slug, order (sibling sort), active.path string or ancestors: ObjectId[]) for faster subtree queries and admin validation; index e.g. { parentId: 1, order: 1 }.isAssignable / isLeaf) should accept service mappings—enforce in API/app so parents are purely navigational.Mapping company services → leaf categories (many-to-many)
serviceGlobalCategoryAssignment (or similar): { _companyId, _serviceId, _globalCategoryIds: ObjectId[] } with unique index on (_companyId, _serviceId) — keeps service lean, easier audit/history in admin.service: _globalCategoryIds: ObjectId[] — simpler reads; couples taxonomy to the service document.globalServiceCategory ids only.Dashboard API
globalCategoryId (or slug): query assignments → emit { _companyId, _serviceId }[] for metric pipelines (align with ATT-1029 aggregations / add-on filters).Coexistence
service.category string for legacy/display if needed; treat the global tree + assignments as the canonical cross-company grouping for dashboards.Please authenticate to join the conversation.
Completed
Main App
2 months ago
Linear
Get notified by email when there are changes.
Completed
Main App
2 months ago
Linear
Get notified by email when there are changes.