Firestore & Security
Rules
- Rules in root
firestore.rules— deploy withfirebase deploy --only firestore:rules - Path builders in
shared/src/paths/firestorePaths.ts— always use these, never construct paths as raw strings - Pattern:
isAuthenticated()for reads,canManageMall(mallId)for writes (admin OR editor OR creator)
Floor Plan Data Policy
- Single source of truth: Unit labels, logos, and interactivity on the floor plan come ONLY from occupancy → store data, never from raw feature properties.
- No fallbacks: If a unit has no active occupancy, it must show no label, no logo, and not be clickable. Feature
properties.labelis for editor/admin reference only, never displayed to consumers. - No double-ups: Every piece of data shown to the user should come from exactly one source.
Unit Occupancies
Link stores/brands to unit polygons on the floor plan:
- Each unit can have one active occupancy at a time
- Creating an "active" occupancy atomically deactivates any existing active occupancy for that unit (batch write)
- Cleared optional fields use
FieldValue.delete(), notnull - Required: at least one of
storeId,brandId, oroutletName
Features (IMDF)
Features follow IMDF (Indoor Mapping Data Format) conventions:
- Unit features (
featureType: "unit") — Polygons representing store/service/vacant spaces - Amenity features (
featureType: "amenity") — Points for toilets, escalators, elevators, stairs, ATMs, info desks, exits, parking, and more - Coordinates are either WGS84
[lng, lat](geographic) or normalized[0,1](legacy) - Cascade delete: Deleting a unit feature also deletes all linked occupancies
- Quality gate: POST/PATCH features run geometry quality evaluation; suspect geometry returns 422