@ingenx-io/valets-schema-mcp-server 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/docs/collections/firestore-paths.md +32 -20
- package/data/docs/enums/app-status.md +24 -0
- package/data/docs/enums/attention-status.md +2 -2
- package/data/docs/enums/booking-status.md +2 -2
- package/data/docs/enums/contract-status.md +24 -0
- package/data/docs/enums/customer-payment-status.md +2 -2
- package/data/docs/enums/customer-payment-target-type.md +2 -2
- package/data/docs/enums/delivery-type.md +2 -2
- package/data/docs/enums/deployment-link-type.md +2 -2
- package/data/docs/enums/event-status.md +2 -2
- package/data/docs/enums/fulfillment-status.md +2 -2
- package/data/docs/enums/loyalty-transaction-type.md +2 -2
- package/data/docs/enums/milestone-status.md +23 -0
- package/data/docs/enums/notification-channel.md +2 -2
- package/data/docs/enums/notification-entity-type.md +2 -2
- package/data/docs/enums/notification-status.md +2 -2
- package/data/docs/enums/order-status.md +2 -2
- package/data/docs/enums/outbound-message-format.md +2 -2
- package/data/docs/enums/outbound-message-purpose.md +2 -2
- package/data/docs/enums/outbound-message-status.md +2 -2
- package/data/docs/enums/payment-method.md +2 -2
- package/data/docs/enums/payment-proof-status.md +2 -2
- package/data/docs/enums/payment-status.md +2 -2
- package/data/docs/enums/pending-issue.md +2 -2
- package/data/docs/enums/return-status.md +2 -2
- package/data/docs/enums/session-status.md +2 -2
- package/data/docs/enums/site-status.md +2 -2
- package/data/docs/enums/stocktake-frequency.md +2 -2
- package/data/docs/enums/stocktake-item-status.md +2 -2
- package/data/docs/enums/stocktake-status.md +2 -2
- package/data/docs/enums/ticket-status.md +2 -2
- package/data/docs/enums/waba-label.md +3 -3
- package/data/docs/enums/whatsapp-button-sub-type.md +2 -2
- package/data/docs/enums/whatsapp-template-component.md +2 -2
- package/data/docs/enums/whatsapp-template-status.md +2 -2
- package/data/docs/index.md +17 -7
- package/data/docs/models/allowed-user.md +7 -7
- package/data/docs/models/analytics-backfill.md +7 -7
- package/data/docs/models/analytics-daily.md +6 -6
- package/data/docs/models/analytics-event.md +7 -7
- package/data/docs/models/analytics-hourly.md +6 -6
- package/data/docs/models/app-payment.md +200 -0
- package/data/docs/models/app.md +585 -0
- package/data/docs/models/booking-version.md +2 -2
- package/data/docs/models/booking.md +127 -127
- package/data/docs/models/contract.md +454 -0
- package/data/docs/models/customer-payment-allocation.md +20 -20
- package/data/docs/models/customer-payment.md +23 -23
- package/data/docs/models/customer.md +11 -11
- package/data/docs/models/event.md +22 -22
- package/data/docs/models/loyalty-config.md +4 -4
- package/data/docs/models/loyalty-reward.md +3 -3
- package/data/docs/models/loyalty-status.md +6 -6
- package/data/docs/models/loyalty-transaction.md +2 -2
- package/data/docs/models/magic-link-request.md +9 -9
- package/data/docs/models/metrics-current.md +169 -37
- package/data/docs/models/metrics-daily.md +172 -40
- package/data/docs/models/metrics-monthly.md +172 -40
- package/data/docs/models/notification-record.md +3 -3
- package/data/docs/models/order-item.md +6 -6
- package/data/docs/models/order.md +314 -294
- package/data/docs/models/outbound-payment-allocation.md +195 -0
- package/data/docs/models/outbound-payment.md +318 -0
- package/data/docs/models/payment-webhook-endpoint.md +191 -0
- package/data/docs/models/sale.md +18 -18
- package/data/docs/models/site-payment.md +2 -2
- package/data/docs/models/site.md +2 -2
- package/data/docs/models/stocktake-item.md +4 -4
- package/data/docs/models/stocktake.md +5 -5
- package/data/docs/models/ticket.md +3 -3
- package/data/docs/models/user.md +249 -0
- package/data/docs/models/whatsapp-inbound-message.md +6 -2
- package/data/docs/models/whatsapp-outbound-lifecycle-event.md +2 -2
- package/data/docs/models/whatsapp-outbound-message.md +43 -27
- package/data/docs/models/whatsapp-template.md +6 -2
- package/data/static/llms.txt +322 -36
- package/data/static/openapi.yaml +1074 -66
- package/data/static/schemas.json +1183 -104
- package/package.json +1 -1
package/data/static/llms.txt
CHANGED
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
> Source of truth: Zod schemas in packages/schema/src/
|
|
5
5
|
> All Firestore documents are scoped under companies/{companyId}/
|
|
6
6
|
|
|
7
|
-
> Generated: 2026-05-
|
|
7
|
+
> Generated: 2026-05-30
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
## Enums
|
|
12
12
|
|
|
13
|
+
### AppStatus
|
|
14
|
+
Lifecycle status for an App (formerly Site — renamed per decision #40 / D44). Drives whether the app is reachable and whether analytics/payments flow.
|
|
15
|
+
Values: ACTIVE, INACTIVE, EXPIRED, ARCHIVED
|
|
16
|
+
|
|
13
17
|
### AttentionStatus
|
|
14
18
|
Operational attention status for Order and Booking (D39). Controls home-page queue assignment. Server-owned — set via triggers or callable fn only.
|
|
15
19
|
Values: ACTIVE, STALE, ON_HOLD, ESCALATED
|
|
@@ -18,6 +22,10 @@ Values: ACTIVE, STALE, ON_HOLD, ESCALATED
|
|
|
18
22
|
Booking lifecycle status. COMPLETED_MIXED = some sessions completed, others cancelled/no-show.
|
|
19
23
|
Values: PENDING, CONFIRMED, COMPLETED, CANCELLED, CANCELLATION_REQUESTED, COMPLETED_MIXED
|
|
20
24
|
|
|
25
|
+
### ContractStatus
|
|
26
|
+
Lifecycle status of a Contract. DRAFT = not yet signed. ACTIVE = in force. COMPLETED = all milestones paid and obligations met. TERMINATED = ended early by either party.
|
|
27
|
+
Values: DRAFT, ACTIVE, COMPLETED, TERMINATED
|
|
28
|
+
|
|
21
29
|
### CustomerPaymentStatus
|
|
22
30
|
Customer payment lifecycle status (D22). Tracks allocation progress of received payments.
|
|
23
31
|
Values: PENDING, CONFIRMED, PARTIALLY_APPLIED, FULLY_APPLIED, REFUNDED, CANCELLED
|
|
@@ -46,6 +54,10 @@ Values: PREPARING, PARTIALLY_SHIPPED, SHIPPED, IN_TRANSIT, DELIVERED, PICKED_UP
|
|
|
46
54
|
Loyalty point transaction type (D07). SCREAMING_SNAKE past tense.
|
|
47
55
|
Values: EARNED, REDEEMED, ADJUSTED, EXPIRED, BONUS, REFUND
|
|
48
56
|
|
|
57
|
+
### MilestoneStatus
|
|
58
|
+
Status of a ContractMilestone (#17). PENDING = created, not yet invoiced. INVOICED = invoice issued, awaiting payment. PAID = payment received.
|
|
59
|
+
Values: PENDING, INVOICED, PAID
|
|
60
|
+
|
|
49
61
|
### NotificationChannel
|
|
50
62
|
Delivery channel of a NotificationRecord (GH#48).
|
|
51
63
|
Values: email, whatsapp, sms, push
|
|
@@ -119,7 +131,7 @@ Event ticket status (D32). VALID = active and unused.
|
|
|
119
131
|
Values: VALID, USED, CANCELLED
|
|
120
132
|
|
|
121
133
|
### WabaLabel
|
|
122
|
-
|
|
134
|
+
WABA label identifying which Meta Business Account sent/received the message. cmz = Chez Miss Zahoui sender; val = Valets sender. See WhatsApp platform constraints doc (#50).
|
|
123
135
|
Values: cmz, val
|
|
124
136
|
|
|
125
137
|
### WhatsappButtonSubType
|
|
@@ -145,7 +157,7 @@ Fields: 9 (8 required)
|
|
|
145
157
|
|-------|------|----------|-------------|
|
|
146
158
|
| id | ['string', 'null'] | no | (Read-only) Firestore document ID = contact identifier (email or E.164 phone), URL-escaped. |
|
|
147
159
|
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
148
|
-
|
|
|
160
|
+
| appId | string | yes | (Immutable) FK → App document ID (D40 sub-tenant scope, renamed per D44). |
|
|
149
161
|
| contact | string | yes | Email or E.164 phone number. Canonical identifier for this user within the site. |
|
|
150
162
|
| tier | string | yes | Access tier. Free string per site (ING-304 open question — tier values are site-specific today). |
|
|
151
163
|
| amount | number | yes | Amount paid. Generalized from amount_xof per D40 decision. |
|
|
@@ -158,7 +170,7 @@ Example:
|
|
|
158
170
|
{
|
|
159
171
|
"id": null,
|
|
160
172
|
"companyId": "comp_xyz789",
|
|
161
|
-
"
|
|
173
|
+
"appId": "app_ref123",
|
|
162
174
|
"contact": "contact",
|
|
163
175
|
"tier": "Gold",
|
|
164
176
|
"amount": 45000,
|
|
@@ -175,7 +187,7 @@ Fields: 12 (10 required)
|
|
|
175
187
|
|-------|------|----------|-------------|
|
|
176
188
|
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
177
189
|
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
178
|
-
|
|
|
190
|
+
| appId | string | yes | (Immutable) FK → Site document ID (D40). |
|
|
179
191
|
| status | enum(5) | yes | Run status. |
|
|
180
192
|
| from | string | yes | (Immutable) Inclusive start date (`YYYY-MM-DD`, UTC). |
|
|
181
193
|
| to | string | yes | (Immutable) Inclusive end date (`YYYY-MM-DD`, UTC). |
|
|
@@ -194,7 +206,7 @@ Example:
|
|
|
194
206
|
{
|
|
195
207
|
"id": null,
|
|
196
208
|
"companyId": "comp_xyz789",
|
|
197
|
-
"
|
|
209
|
+
"appId": "app_ref123",
|
|
198
210
|
"status": "pending",
|
|
199
211
|
"from": "from",
|
|
200
212
|
"to": "to",
|
|
@@ -232,7 +244,7 @@ Fields: 16 (14 required)
|
|
|
232
244
|
| eventCounts | record<string,integer> | yes | Per-event-name counts — key is the event name (canonical or custom), value is the count within the bucket. |
|
|
233
245
|
| id | ['string', 'null'] | no | (Read-only) Firestore document ID = `YYYY-MM-DD`. |
|
|
234
246
|
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
235
|
-
|
|
|
247
|
+
| appId | string | yes | (Immutable) FK → Site document ID (D40). |
|
|
236
248
|
| date | string | yes | (Immutable) `YYYY-MM-DD` UTC — matches document ID. |
|
|
237
249
|
| computedAt | FirestoreTimestamp | yes | (Read-only) When this rollup was last (re)computed. Updated on every set/merge. |
|
|
238
250
|
| sourceEventCount | ['integer', 'null'] | no | (Read-only, Optional) Total source events scanned when producing this rollup. Useful for dry-run diffing. |
|
|
@@ -252,7 +264,7 @@ Example:
|
|
|
252
264
|
"eventCounts": {},
|
|
253
265
|
"id": null,
|
|
254
266
|
"companyId": "comp_xyz789",
|
|
255
|
-
"
|
|
267
|
+
"appId": "app_ref123",
|
|
256
268
|
"date": "2026-02-15",
|
|
257
269
|
"computedAt": "computedAt",
|
|
258
270
|
"sourceEventCount": null
|
|
@@ -266,7 +278,7 @@ Fields: 12 (10 required)
|
|
|
266
278
|
|-------|------|----------|-------------|
|
|
267
279
|
| id | ['string', 'null'] | no | (Read-only) Firestore document ID. Equal to eventId. |
|
|
268
280
|
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
269
|
-
|
|
|
281
|
+
| appId | string | yes | (Immutable) FK → App document ID (D40 sub-tenant scope, renamed per D44). |
|
|
270
282
|
| eventId | string | yes | (Immutable) Client-generated UUID. Matches document ID. |
|
|
271
283
|
| eventName | string | yes | Event name. Free string; canonical vocabulary is encouraged (see CANONICAL_ANALYTICS_EVENT_NAMES). |
|
|
272
284
|
| timestamp | string | yes | Client-side ISO 8601 — "when it happened on device". Can diverge from serverTimestamp for queued offline events. |
|
|
@@ -297,7 +309,7 @@ Example:
|
|
|
297
309
|
{
|
|
298
310
|
"id": null,
|
|
299
311
|
"companyId": "comp_xyz789",
|
|
300
|
-
"
|
|
312
|
+
"appId": "app_ref123",
|
|
301
313
|
"eventId": "eve_ref123",
|
|
302
314
|
"eventName": "eventName",
|
|
303
315
|
"timestamp": "timestamp",
|
|
@@ -327,7 +339,7 @@ Fields: 17 (15 required)
|
|
|
327
339
|
| eventCounts | record<string,integer> | yes | Per-event-name counts — key is the event name (canonical or custom), value is the count within the bucket. |
|
|
328
340
|
| id | ['string', 'null'] | no | (Read-only) Firestore document ID = `YYYY-MM-DD-HH`. |
|
|
329
341
|
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
330
|
-
|
|
|
342
|
+
| appId | string | yes | (Immutable) FK → Site document ID (D40). |
|
|
331
343
|
| date | string | yes | (Immutable) `YYYY-MM-DD` UTC for the bucket day. |
|
|
332
344
|
| hour | integer | yes | (Immutable) UTC hour of day, 0–23. |
|
|
333
345
|
| computedAt | FirestoreTimestamp | yes | (Read-only) When this rollup was last (re)computed. |
|
|
@@ -348,7 +360,7 @@ Example:
|
|
|
348
360
|
"eventCounts": {},
|
|
349
361
|
"id": null,
|
|
350
362
|
"companyId": "comp_xyz789",
|
|
351
|
-
"
|
|
363
|
+
"appId": "app_ref123",
|
|
352
364
|
"date": "2026-02-15",
|
|
353
365
|
"hour": 0,
|
|
354
366
|
"computedAt": "computedAt",
|
|
@@ -356,6 +368,88 @@ Example:
|
|
|
356
368
|
}
|
|
357
369
|
```
|
|
358
370
|
|
|
371
|
+
### App
|
|
372
|
+
Fields: 14 (5 required)
|
|
373
|
+
|
|
374
|
+
| Field | Type | Required | Description |
|
|
375
|
+
|-------|------|----------|-------------|
|
|
376
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
377
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. Scopes all app sub-collections. |
|
|
378
|
+
| name | string | yes | Human-readable app name shown in dashboards. |
|
|
379
|
+
| description | ['string', 'null'] | no | Optional freeform description. |
|
|
380
|
+
| status | any | no | Lifecycle status (D41/D44). Optional pending backfill of pre-existing records (#26) — treat absent as ACTIVE. Clients filter by ACTIVE. |
|
|
381
|
+
| deploymentLinks | array<object> | yes | Ordered list of deployment URLs (web, mobile, PWA, store links). |
|
|
382
|
+
| deploymentLinks[].label | string | yes | Human-readable label shown in dashboards (e.g. "Production", "Staging"). |
|
|
383
|
+
| deploymentLinks[].url | string | yes | Absolute URL or store link. |
|
|
384
|
+
| deploymentLinks[].type | DeploymentLinkType | yes | Link category — drives icon/handler selection. |
|
|
385
|
+
| deploymentLinks[].isPrimary | boolean | no | If true, this link is used as the canonical deployment URL for the App. |
|
|
386
|
+
| expiresAt | any | no | Optional expiration timestamp. When set and elapsed, `isExpired` flips true and status typically moves to EXPIRED. |
|
|
387
|
+
| isExpired | ['boolean', 'null'] | no | (Read-only) Derived — true when `expiresAt` is in the past. Maintained by server trigger. |
|
|
388
|
+
| createdAt | any | no | (Read-only) Server-generated creation timestamp. |
|
|
389
|
+
| updatedAt | any | no | (Read-only) Server-generated update timestamp. |
|
|
390
|
+
| createdBy | string | yes | (Immutable) FK → User/staff UID who created the app. |
|
|
391
|
+
| analyticsEnabled | boolean | yes | Feature flag — when false, clients should not emit analytics events for this app. |
|
|
392
|
+
| lastAnalyticsSync | any | no | (Read-only) Last time the analytics rollup pipeline refreshed `cachedMetrics`. |
|
|
393
|
+
| cachedMetrics | ['object', 'null'] | no | (Read-only, Denormalized) Cached metrics snapshot for quick dashboard rendering. |
|
|
394
|
+
|
|
395
|
+
Example:
|
|
396
|
+
```json
|
|
397
|
+
{
|
|
398
|
+
"id": null,
|
|
399
|
+
"companyId": "comp_xyz789",
|
|
400
|
+
"name": "Amadou Diallo",
|
|
401
|
+
"description": null,
|
|
402
|
+
"status": "status",
|
|
403
|
+
"deploymentLinks": [
|
|
404
|
+
{
|
|
405
|
+
"label": "label",
|
|
406
|
+
"url": "https://storage.example.com/url.jpg",
|
|
407
|
+
"type": "phone"
|
|
408
|
+
}
|
|
409
|
+
],
|
|
410
|
+
"expiresAt": "expiresAt",
|
|
411
|
+
"isExpired": null,
|
|
412
|
+
"createdAt": "createdAt",
|
|
413
|
+
"updatedAt": "updatedAt",
|
|
414
|
+
"createdBy": "staff_k0f1",
|
|
415
|
+
"analyticsEnabled": true,
|
|
416
|
+
"lastAnalyticsSync": "lastAnalyticsSync",
|
|
417
|
+
"cachedMetrics": null
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### AppPayment
|
|
422
|
+
Fields: 10 (9 required)
|
|
423
|
+
|
|
424
|
+
| Field | Type | Required | Description |
|
|
425
|
+
|-------|------|----------|-------------|
|
|
426
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
427
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
428
|
+
| appId | string | yes | (Immutable) FK → App document ID (D40 sub-tenant scope, renamed from siteId per D44). |
|
|
429
|
+
| contact | string | yes | Email or E.164 phone number. Matches AllowedUser.contact. |
|
|
430
|
+
| sessionId | string | yes | Payment provider checkout session ID (e.g. Wave). Usable for dedup across dual writes. |
|
|
431
|
+
| transactionId | string | yes | Payment provider transaction ID. |
|
|
432
|
+
| tier | string | yes | Access tier. Free string per app (ING-304 open question). |
|
|
433
|
+
| amount | number | yes | Amount paid. Generalized from amount_xof per D40 decision. |
|
|
434
|
+
| currency | string | yes | Currency code (ISO 4217). Defaults to XOF for legacy SR-Single parity. |
|
|
435
|
+
| paidAt | FirestoreTimestamp | yes | RFC3339Nano UTC when payment was completed. |
|
|
436
|
+
|
|
437
|
+
Example:
|
|
438
|
+
```json
|
|
439
|
+
{
|
|
440
|
+
"id": null,
|
|
441
|
+
"companyId": "comp_xyz789",
|
|
442
|
+
"appId": "app_ref123",
|
|
443
|
+
"contact": "contact",
|
|
444
|
+
"sessionId": "ses_ref123",
|
|
445
|
+
"transactionId": "tra_ref123",
|
|
446
|
+
"tier": "Gold",
|
|
447
|
+
"amount": 45000,
|
|
448
|
+
"currency": "XOF",
|
|
449
|
+
"paidAt": "pai_ref123"
|
|
450
|
+
}
|
|
451
|
+
```
|
|
452
|
+
|
|
359
453
|
### Booking
|
|
360
454
|
Fields: 52 (7 required)
|
|
361
455
|
|
|
@@ -382,9 +476,9 @@ Fields: 52 (7 required)
|
|
|
382
476
|
| bookingDates[].selectedTimeSlots[].isNotMainPurposeReason | string | no | |
|
|
383
477
|
| bookingDates[].selectedTimeSlots[].isNotMainPurposeOtherReason | string | no | |
|
|
384
478
|
| bookingDates[].selectedTimeSlots[]._deleted | boolean | no | Soft-delete flag. Dashboard writes; Mobile filters (IG-6). |
|
|
385
|
-
| bookingDates[].selectedTimeSlots[]._deletedAt | FirestoreTimestamp | no | Firestore Timestamp
|
|
479
|
+
| bookingDates[].selectedTimeSlots[]._deletedAt | FirestoreTimestamp | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
386
480
|
| bookingDates[].selectedTimeSlots[]._deletedBy | string | no | FK → User/staff UID who soft-deleted this item. |
|
|
387
|
-
| bookingDates[].selectedTimeSlots[]._lastModifiedAt | FirestoreTimestamp | no | Firestore Timestamp
|
|
481
|
+
| bookingDates[].selectedTimeSlots[]._lastModifiedAt | FirestoreTimestamp | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
388
482
|
| bookingDates[].selectedTimeSlots[]._lastModifiedBy | string | no | FK → User/staff UID who last modified this item. |
|
|
389
483
|
| bookingDates[].selectedTimeSlots[]._version | number | no | Monotonic version counter for conflict detection. |
|
|
390
484
|
| bookingDates[].slotKitTypes | record<string,string> | yes | Kit type per slot (IG-11). Firebase parity gap — exists in Firestore but Firebase type lacked it. |
|
|
@@ -397,9 +491,9 @@ Fields: 52 (7 required)
|
|
|
397
491
|
| bookingDates[].slotStatusUpdatedAt | record<string,FirestoreTimestamp> | no | |
|
|
398
492
|
| bookingDates[].slotStatusUpdatedBy | record<string,string> | no | |
|
|
399
493
|
| bookingDates[]._deleted | boolean | no | Soft-delete flag. Dashboard writes; Mobile filters (IG-6). |
|
|
400
|
-
| bookingDates[]._deletedAt | FirestoreTimestamp | no | Firestore Timestamp
|
|
494
|
+
| bookingDates[]._deletedAt | FirestoreTimestamp | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
401
495
|
| bookingDates[]._deletedBy | string | no | FK → User/staff UID who soft-deleted this item. |
|
|
402
|
-
| bookingDates[]._lastModifiedAt | FirestoreTimestamp | no | Firestore Timestamp
|
|
496
|
+
| bookingDates[]._lastModifiedAt | FirestoreTimestamp | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
403
497
|
| bookingDates[]._lastModifiedBy | string | no | FK → User/staff UID who last modified this item. |
|
|
404
498
|
| bookingDates[]._version | number | no | Monotonic version counter for conflict detection. |
|
|
405
499
|
| customerId | ['string', 'null'] | no | FK → Customer.id (Firestore doc ID). Links booking to customer record. |
|
|
@@ -429,18 +523,18 @@ Fields: 52 (7 required)
|
|
|
429
523
|
| purchaseId | ['string', 'null'] | no | FK → Sale.id. Link to associated Sale document. |
|
|
430
524
|
| paymentStatusChangeReason | ['string', 'null'] | no | |
|
|
431
525
|
| paymentStatusChangedBy | ['string', 'null'] | no | FK → User/staff UID who changed payment status. |
|
|
432
|
-
| paymentStatusChangedAt | any | no | Firestore Timestamp
|
|
526
|
+
| paymentStatusChangedAt | any | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
433
527
|
| paymentProofUrl | ['string', 'null'] | no | URL to uploaded payment proof image/document. |
|
|
434
528
|
| paymentProofStatus | any | no | Payment proof review status. Used by Order and Booking payment proof workflows. |
|
|
435
|
-
| paymentProofAddedAt | any | no | Firestore Timestamp
|
|
529
|
+
| paymentProofAddedAt | any | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
436
530
|
| paymentProofAddedBy | ['string', 'null'] | no | FK → User/staff UID who uploaded the payment proof. |
|
|
437
531
|
| paymentProofReviewedBy | ['string', 'null'] | no | FK → User/staff UID who reviewed the payment proof. |
|
|
438
|
-
| paymentProofReviewedAt | any | no | Firestore Timestamp
|
|
532
|
+
| paymentProofReviewedAt | any | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
439
533
|
| paymentProofRejectionReason | ['string', 'null'] | no | |
|
|
440
534
|
| cancellationRequestedById | ['string', 'null'] | no | FK → User/staff UID who requested cancellation. |
|
|
441
535
|
| cancellationRequestReason | ['string', 'null'] | no | |
|
|
442
536
|
| cancellationProcessedById | ['string', 'null'] | no | FK → User/staff UID who processed the cancellation. |
|
|
443
|
-
| cancellationProcessedAt | any | no | Firestore Timestamp
|
|
537
|
+
| cancellationProcessedAt | any | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
444
538
|
| cancelledByRole | ['string', 'null'] | no | |
|
|
445
539
|
| cancellationReason | ['string', 'null'] | no | |
|
|
446
540
|
| createdAt | FirestoreTimestamp | yes | (Read-only) Server-generated creation timestamp. |
|
|
@@ -556,6 +650,48 @@ Example:
|
|
|
556
650
|
}
|
|
557
651
|
```
|
|
558
652
|
|
|
653
|
+
### Contract
|
|
654
|
+
Fields: 15 (8 required)
|
|
655
|
+
|
|
656
|
+
| Field | Type | Required | Description |
|
|
657
|
+
|-------|------|----------|-------------|
|
|
658
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
659
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
660
|
+
| payeeId | string | yes | (Immutable) FK → Payee document ID. Full Payee model tracked in #20. |
|
|
661
|
+
| title | string | yes | Contract title or reference name shown in dashboards. |
|
|
662
|
+
| description | ['string', 'null'] | no | Optional freeform description of the contract scope. |
|
|
663
|
+
| status | ContractStatus | yes | Contract lifecycle status (#14). Query by ACTIVE — do not use an isActive boolean. |
|
|
664
|
+
| currency | string | yes | Currency code. Locked to XOF (#18). Multi-currency support requires a deliberate schema version bump. |
|
|
665
|
+
| totalAmount | number | yes | Total contract value (XOF). |
|
|
666
|
+
| startDate | string | yes | Contract start date (ISO 8601 YYYY-MM-DD). |
|
|
667
|
+
| endDate | ['string', 'null'] | no | Contract end date (ISO 8601 YYYY-MM-DD). Absent for open-ended contracts. |
|
|
668
|
+
| milestones | ['array', 'null'] | no | Ordered list of payment milestones. Embedded in the contract document (#17). |
|
|
669
|
+
| notes | ['string', 'null'] | no | Optional internal notes. |
|
|
670
|
+
| createdBy | string | yes | (Immutable) FK → User/staff UID who created the contract. |
|
|
671
|
+
| createdAt | any | no | (Read-only) Server-generated creation timestamp. |
|
|
672
|
+
| updatedAt | any | no | (Read-only) Server-generated update timestamp. |
|
|
673
|
+
|
|
674
|
+
Example:
|
|
675
|
+
```json
|
|
676
|
+
{
|
|
677
|
+
"id": null,
|
|
678
|
+
"companyId": "comp_xyz789",
|
|
679
|
+
"payeeId": "pay_ref123",
|
|
680
|
+
"title": "title",
|
|
681
|
+
"description": null,
|
|
682
|
+
"status": "status",
|
|
683
|
+
"currency": "XOF",
|
|
684
|
+
"totalAmount": 45000,
|
|
685
|
+
"startDate": "2026-02-15",
|
|
686
|
+
"endDate": null,
|
|
687
|
+
"milestones": null,
|
|
688
|
+
"notes": null,
|
|
689
|
+
"createdBy": "staff_k0f1",
|
|
690
|
+
"createdAt": "createdAt",
|
|
691
|
+
"updatedAt": "updatedAt"
|
|
692
|
+
}
|
|
693
|
+
```
|
|
694
|
+
|
|
559
695
|
### Customer
|
|
560
696
|
Fields: 17 (4 required)
|
|
561
697
|
|
|
@@ -613,7 +749,7 @@ Fields: 17 (12 required)
|
|
|
613
749
|
| customerName | ['string', 'null'] | no | (Denormalized) From Customer.name at write time. |
|
|
614
750
|
| amount | number | yes | |
|
|
615
751
|
| currency | string | yes | Currency code. Locked to XOF (West African CFA franc) for now. |
|
|
616
|
-
| paymentDate | FirestoreTimestamp | yes | Firestore Timestamp
|
|
752
|
+
| paymentDate | FirestoreTimestamp | yes | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
617
753
|
| paymentMethod | PaymentMethod | yes | Unified payment method set with African + global methods (D02). |
|
|
618
754
|
| referenceNumber | string | yes | Unique payment reference (receipt number, transaction ID, etc.). |
|
|
619
755
|
| allocatedAmount | number | yes | (Read-only) Total amount allocated to bookings/orders/purchases via allocations. Server-calculated. |
|
|
@@ -663,7 +799,7 @@ Fields: 14 (8 required)
|
|
|
663
799
|
| allocatedAmount | number | yes | (Immutable) Amount allocated in this allocation. Set at creation. |
|
|
664
800
|
| transferredToAllocationId | ['string', 'null'] | no | FK → CustomerPaymentAllocation.id. Self-reference for transfer chains. |
|
|
665
801
|
| transferredFromAllocationId | ['string', 'null'] | no | FK → CustomerPaymentAllocation.id. Self-reference for transfer chains. |
|
|
666
|
-
| transferredAt | any | no | Firestore Timestamp
|
|
802
|
+
| transferredAt | any | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
667
803
|
| createdBy | string | yes | (Immutable) FK → User/staff UID who created this allocation. |
|
|
668
804
|
| createdByName | ['string', 'null'] | no | (Immutable, Denormalized) From User display name at creation time. |
|
|
669
805
|
| createdAt | FirestoreTimestamp | yes | (Read-only) Server-generated creation timestamp. |
|
|
@@ -698,8 +834,8 @@ Fields: 15 (9 required)
|
|
|
698
834
|
| name | string | yes | |
|
|
699
835
|
| description | ['string', 'null'] | no | |
|
|
700
836
|
| location | ['string', 'null'] | no | |
|
|
701
|
-
| startDate | FirestoreTimestamp | yes | Firestore Timestamp
|
|
702
|
-
| endDate | any | no | Firestore Timestamp
|
|
837
|
+
| startDate | FirestoreTimestamp | yes | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
838
|
+
| endDate | any | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
703
839
|
| status | EventStatus | yes | Event lifecycle status (D32). SCREAMING_SNAKE per D04. MIG-09 migrates legacy lowercase values. |
|
|
704
840
|
| maxTickets | ['integer', 'null'] | no | |
|
|
705
841
|
| ticketsSold | integer | yes | (Read-only) Counter: total tickets sold. Updated by Firebase triggers (D28). |
|
|
@@ -879,7 +1015,7 @@ Fields: 15 (11 required)
|
|
|
879
1015
|
|-------|------|----------|-------------|
|
|
880
1016
|
| id | ['string', 'null'] | no | (Read-only) Firestore document ID. 16-byte random hex. |
|
|
881
1017
|
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
882
|
-
|
|
|
1018
|
+
| appId | string | yes | (Immutable) FK → App document ID (D40 sub-tenant scope, renamed per D44). |
|
|
883
1019
|
| email | string | yes | Populated if identifier is email; empty string if phone. Mutually exclusive with phone per document. |
|
|
884
1020
|
| phone | string | yes | Populated if identifier is E.164 format (starts with +); empty string if email. |
|
|
885
1021
|
| ip | string | yes | Client IP from X-Forwarded-For or RemoteAddr. |
|
|
@@ -898,7 +1034,7 @@ Example:
|
|
|
898
1034
|
{
|
|
899
1035
|
"id": null,
|
|
900
1036
|
"companyId": "comp_xyz789",
|
|
901
|
-
"
|
|
1037
|
+
"appId": "app_ref123",
|
|
902
1038
|
"email": "amadou@example.com",
|
|
903
1039
|
"phone": "+225 07 00 11 22",
|
|
904
1040
|
"ip": "ip",
|
|
@@ -915,7 +1051,7 @@ Example:
|
|
|
915
1051
|
```
|
|
916
1052
|
|
|
917
1053
|
### MetricsCurrent
|
|
918
|
-
Fields:
|
|
1054
|
+
Fields: 30 (25 required)
|
|
919
1055
|
|
|
920
1056
|
| Field | Type | Required | Description |
|
|
921
1057
|
|-------|------|----------|-------------|
|
|
@@ -942,6 +1078,11 @@ Fields: 25 (25 required)
|
|
|
942
1078
|
| lowStockItemsCount | integer | yes | (Read-only) Active stock items where currentQuantity <= minimumQuantity. Current state, always full recalc. |
|
|
943
1079
|
| activeRecurringPaymentsCount | integer | yes | (Read-only) Recurring payments with status ACTIVE. Current state, always full recalc. |
|
|
944
1080
|
| monthlyRecurringRevenue | number | yes | (Read-only) Sum of amount for ACTIVE + MONTHLY recurring payments. Always full recalc. |
|
|
1081
|
+
| escalatedOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders currently in an escalated state. Present once the current aggregator rewrites the document. |
|
|
1082
|
+
| staleOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders that have been in an incomplete status beyond the stale threshold. |
|
|
1083
|
+
| staleBookingsCount | ['integer', 'null'] | no | (Read-only, Optional) Bookings that have been in an incomplete status beyond the stale threshold. |
|
|
1084
|
+
| onHoldOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders currently in an on-hold state. |
|
|
1085
|
+
| paymentsByMethod | ['object', 'null'] | no | (Read-only, Optional) Map of PaymentMethod → total amount for the current day. Empty map {} until first payment. |
|
|
945
1086
|
| computedForDay | string | yes | (Read-only) YYYY-MM-DD string indicating which day these metrics reflect. Used to detect day boundaries and trigger midnight resets. |
|
|
946
1087
|
| generatedAt | FirestoreTimestamp | yes | (Read-only) Server timestamp of the last metrics write. |
|
|
947
1088
|
|
|
@@ -971,13 +1112,18 @@ Example:
|
|
|
971
1112
|
"lowStockItemsCount": 2,
|
|
972
1113
|
"activeRecurringPaymentsCount": 2,
|
|
973
1114
|
"monthlyRecurringRevenue": 0,
|
|
1115
|
+
"escalatedOrdersCount": null,
|
|
1116
|
+
"staleOrdersCount": null,
|
|
1117
|
+
"staleBookingsCount": null,
|
|
1118
|
+
"onHoldOrdersCount": null,
|
|
1119
|
+
"paymentsByMethod": null,
|
|
974
1120
|
"computedForDay": "computedForDay",
|
|
975
1121
|
"generatedAt": "generatedAt"
|
|
976
1122
|
}
|
|
977
1123
|
```
|
|
978
1124
|
|
|
979
1125
|
### MetricsDaily
|
|
980
|
-
Fields:
|
|
1126
|
+
Fields: 31 (26 required)
|
|
981
1127
|
|
|
982
1128
|
| Field | Type | Required | Description |
|
|
983
1129
|
|-------|------|----------|-------------|
|
|
@@ -1004,6 +1150,11 @@ Fields: 26 (26 required)
|
|
|
1004
1150
|
| lowStockItemsCount | integer | yes | (Read-only) Active stock items where currentQuantity <= minimumQuantity. Current state, always full recalc. |
|
|
1005
1151
|
| activeRecurringPaymentsCount | integer | yes | (Read-only) Recurring payments with status ACTIVE. Current state, always full recalc. |
|
|
1006
1152
|
| monthlyRecurringRevenue | number | yes | (Read-only) Sum of amount for ACTIVE + MONTHLY recurring payments. Always full recalc. |
|
|
1153
|
+
| escalatedOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders currently in an escalated state. Present once the current aggregator rewrites the document. |
|
|
1154
|
+
| staleOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders that have been in an incomplete status beyond the stale threshold. |
|
|
1155
|
+
| staleBookingsCount | ['integer', 'null'] | no | (Read-only, Optional) Bookings that have been in an incomplete status beyond the stale threshold. |
|
|
1156
|
+
| onHoldOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders currently in an on-hold state. |
|
|
1157
|
+
| paymentsByMethod | ['object', 'null'] | no | (Read-only, Optional) Map of PaymentMethod → total amount for the current day. Empty map {} until first payment. |
|
|
1007
1158
|
| computedForDay | string | yes | (Read-only) YYYY-MM-DD string indicating which day these metrics reflect. Used to detect day boundaries and trigger midnight resets. |
|
|
1008
1159
|
| generatedAt | FirestoreTimestamp | yes | (Read-only) Server timestamp of the last metrics write. |
|
|
1009
1160
|
| date | string | yes | (Read-only) YYYY-MM-DD document ID repeated as a field. Identifies the day this snapshot covers. |
|
|
@@ -1034,6 +1185,11 @@ Example:
|
|
|
1034
1185
|
"lowStockItemsCount": 2,
|
|
1035
1186
|
"activeRecurringPaymentsCount": 2,
|
|
1036
1187
|
"monthlyRecurringRevenue": 0,
|
|
1188
|
+
"escalatedOrdersCount": null,
|
|
1189
|
+
"staleOrdersCount": null,
|
|
1190
|
+
"staleBookingsCount": null,
|
|
1191
|
+
"onHoldOrdersCount": null,
|
|
1192
|
+
"paymentsByMethod": null,
|
|
1037
1193
|
"computedForDay": "computedForDay",
|
|
1038
1194
|
"generatedAt": "generatedAt",
|
|
1039
1195
|
"date": "2026-02-15"
|
|
@@ -1041,7 +1197,7 @@ Example:
|
|
|
1041
1197
|
```
|
|
1042
1198
|
|
|
1043
1199
|
### MetricsMonthly
|
|
1044
|
-
Fields:
|
|
1200
|
+
Fields: 31 (26 required)
|
|
1045
1201
|
|
|
1046
1202
|
| Field | Type | Required | Description |
|
|
1047
1203
|
|-------|------|----------|-------------|
|
|
@@ -1068,6 +1224,11 @@ Fields: 26 (26 required)
|
|
|
1068
1224
|
| lowStockItemsCount | integer | yes | (Read-only) Active stock items where currentQuantity <= minimumQuantity. Current state, always full recalc. |
|
|
1069
1225
|
| activeRecurringPaymentsCount | integer | yes | (Read-only) Recurring payments with status ACTIVE. Current state, always full recalc. |
|
|
1070
1226
|
| monthlyRecurringRevenue | number | yes | (Read-only) Sum of amount for ACTIVE + MONTHLY recurring payments. Always full recalc. |
|
|
1227
|
+
| escalatedOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders currently in an escalated state. Present once the current aggregator rewrites the document. |
|
|
1228
|
+
| staleOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders that have been in an incomplete status beyond the stale threshold. |
|
|
1229
|
+
| staleBookingsCount | ['integer', 'null'] | no | (Read-only, Optional) Bookings that have been in an incomplete status beyond the stale threshold. |
|
|
1230
|
+
| onHoldOrdersCount | ['integer', 'null'] | no | (Read-only, Optional) Orders currently in an on-hold state. |
|
|
1231
|
+
| paymentsByMethod | ['object', 'null'] | no | (Read-only, Optional) Map of PaymentMethod → total amount for the current day. Empty map {} until first payment. |
|
|
1071
1232
|
| computedForDay | string | yes | (Read-only) YYYY-MM-DD string indicating which day these metrics reflect. Used to detect day boundaries and trigger midnight resets. |
|
|
1072
1233
|
| generatedAt | FirestoreTimestamp | yes | (Read-only) Server timestamp of the last metrics write. |
|
|
1073
1234
|
| month | string | yes | (Read-only) YYYY-MM document ID repeated as a field. Identifies the month this rollup covers. |
|
|
@@ -1098,6 +1259,11 @@ Example:
|
|
|
1098
1259
|
"lowStockItemsCount": 2,
|
|
1099
1260
|
"activeRecurringPaymentsCount": 2,
|
|
1100
1261
|
"monthlyRecurringRevenue": 0,
|
|
1262
|
+
"escalatedOrdersCount": null,
|
|
1263
|
+
"staleOrdersCount": null,
|
|
1264
|
+
"staleBookingsCount": null,
|
|
1265
|
+
"onHoldOrdersCount": null,
|
|
1266
|
+
"paymentsByMethod": null,
|
|
1101
1267
|
"computedForDay": "computedForDay",
|
|
1102
1268
|
"generatedAt": "generatedAt",
|
|
1103
1269
|
"month": "month"
|
|
@@ -1165,15 +1331,16 @@ Example:
|
|
|
1165
1331
|
```
|
|
1166
1332
|
|
|
1167
1333
|
### Order
|
|
1168
|
-
Fields:
|
|
1334
|
+
Fields: 49 (8 required)
|
|
1169
1335
|
|
|
1170
1336
|
| Field | Type | Required | Description |
|
|
1171
1337
|
|-------|------|----------|-------------|
|
|
1172
1338
|
| id | string | yes | (Read-only) Firestore document ID. Note: some models also have uid; see ID conventions. |
|
|
1173
1339
|
| uid | string | yes | (Read-only) Entity UID. Often mirrors id. |
|
|
1174
1340
|
| companyId | string | yes | (Immutable) FK → Company document ID. Scopes all queries. |
|
|
1175
|
-
|
|
|
1341
|
+
| appId | ['string', 'null'] | no | (Immutable, Optional) FK → App document ID (D43 / ADR-003, renamed from siteId per D44). null = company-wide. |
|
|
1176
1342
|
| orderNumber | string | yes | (Read-only) Server-generated order number. |
|
|
1343
|
+
| followUpUrl | ['string', 'null'] | no | Optional URL for receipt QR code / post-order follow-up. Canonical casing: followUpUrl (#6). |
|
|
1177
1344
|
| status | OrderStatus | yes | Core lifecycle status (D34, MIG-11). See OrderStatus enum for the legacy value migration mapping. |
|
|
1178
1345
|
| paymentStatus | any | no | Payment lifecycle (D34). Null until payment is initiated. |
|
|
1179
1346
|
| fulfillmentStatus | any | no | Delivery/fulfillment lifecycle (D34). |
|
|
@@ -1192,14 +1359,14 @@ Fields: 48 (8 required)
|
|
|
1192
1359
|
| amountPaid | ['number', 'null'] | no | Amount of `amount` paid to date. Derived from payment allocations. |
|
|
1193
1360
|
| total | ['number', 'null'] | no | Mobile-only legacy total field. Deprecated — use `amount`. |
|
|
1194
1361
|
| createdAt | FirestoreTimestamp | yes | (Read-only) Server-generated creation timestamp. |
|
|
1195
|
-
| orderDate | FirestoreTimestamp | yes | Firestore Timestamp
|
|
1362
|
+
| orderDate | FirestoreTimestamp | yes | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
1196
1363
|
| PROCESSING_ON | any | no | (Read-only) Timestamp when order entered PROCESSING (D04 SCREAMING_SNAKE). MIG-01 renames from camelCase. |
|
|
1197
1364
|
| COMPLETED_ON | any | no | (Read-only) Timestamp when order completed (D04 SCREAMING_SNAKE). MIG-01 renames from camelCase. |
|
|
1198
1365
|
| CANCELLED_ON | any | no | (Read-only) Timestamp when order cancelled (D04 SCREAMING_SNAKE). MIG-01 renames from camelCase. |
|
|
1199
1366
|
| cancellationReason | ['string', 'null'] | no | |
|
|
1200
1367
|
| shippingCarrier | ['string', 'null'] | no | |
|
|
1201
1368
|
| trackingNumber | ['string', 'null'] | no | |
|
|
1202
|
-
| estimatedDeliveryDate | any | no | Firestore Timestamp
|
|
1369
|
+
| estimatedDeliveryDate | any | no | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
1203
1370
|
| shippingCost | ['number', 'null'] | no | |
|
|
1204
1371
|
| paymentProofUrl | ['string', 'null'] | no | URL to uploaded payment proof image/document. |
|
|
1205
1372
|
| paymentProofStatus | any | no | Payment proof review status. |
|
|
@@ -1224,8 +1391,9 @@ Example:
|
|
|
1224
1391
|
"id": "bk_abc123def456",
|
|
1225
1392
|
"uid": "user_u8x92kqm",
|
|
1226
1393
|
"companyId": "comp_xyz789",
|
|
1227
|
-
"
|
|
1394
|
+
"appId": null,
|
|
1228
1395
|
"orderNumber": "ORD-2026-0042",
|
|
1396
|
+
"followUpUrl": null,
|
|
1229
1397
|
"status": "status",
|
|
1230
1398
|
"paymentStatus": "paymentStatus",
|
|
1231
1399
|
"fulfillmentStatus": "fulfillmentStatus",
|
|
@@ -1308,6 +1476,94 @@ Example:
|
|
|
1308
1476
|
}
|
|
1309
1477
|
```
|
|
1310
1478
|
|
|
1479
|
+
### OutboundPayment
|
|
1480
|
+
Fields: 13 (7 required)
|
|
1481
|
+
|
|
1482
|
+
| Field | Type | Required | Description |
|
|
1483
|
+
|-------|------|----------|-------------|
|
|
1484
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
1485
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
1486
|
+
| payeeId | string | yes | (Immutable) FK → Payee document ID. Full Payee model tracked in #20. |
|
|
1487
|
+
| contractId | ['string', 'null'] | no | (Immutable, Optional) FK → Contract document ID. Absent for ad-hoc payments outside a formal contract. |
|
|
1488
|
+
| amount | number | yes | Amount paid (XOF). |
|
|
1489
|
+
| currency | string | yes | Currency code. Locked to XOF — consistent with Contract and CustomerPayment. |
|
|
1490
|
+
| method | PaymentMethod | yes | Payment method used (e.g. BANK_TRANSFER, MOBILE_MONEY, CHECK). |
|
|
1491
|
+
| reference | ['string', 'null'] | no | Optional payment reference — bank transaction number, check number, Wave ref, etc. |
|
|
1492
|
+
| paidAt | FirestoreTimestamp | yes | When the payment was made. |
|
|
1493
|
+
| notes | ['string', 'null'] | no | Optional internal notes. |
|
|
1494
|
+
| createdBy | string | yes | (Immutable) FK → User/staff UID who recorded the payment. |
|
|
1495
|
+
| createdAt | any | no | (Read-only) Server-generated creation timestamp. |
|
|
1496
|
+
| updatedAt | any | no | (Read-only) Server-generated update timestamp. |
|
|
1497
|
+
|
|
1498
|
+
Example:
|
|
1499
|
+
```json
|
|
1500
|
+
{
|
|
1501
|
+
"id": null,
|
|
1502
|
+
"companyId": "comp_xyz789",
|
|
1503
|
+
"payeeId": "pay_ref123",
|
|
1504
|
+
"contractId": null,
|
|
1505
|
+
"amount": 45000,
|
|
1506
|
+
"currency": "XOF",
|
|
1507
|
+
"method": "method",
|
|
1508
|
+
"reference": null,
|
|
1509
|
+
"paidAt": "pai_ref123",
|
|
1510
|
+
"notes": null,
|
|
1511
|
+
"createdBy": "staff_k0f1",
|
|
1512
|
+
"createdAt": "createdAt",
|
|
1513
|
+
"updatedAt": "updatedAt"
|
|
1514
|
+
}
|
|
1515
|
+
```
|
|
1516
|
+
|
|
1517
|
+
### OutboundPaymentAllocation
|
|
1518
|
+
Fields: 7 (4 required)
|
|
1519
|
+
|
|
1520
|
+
| Field | Type | Required | Description |
|
|
1521
|
+
|-------|------|----------|-------------|
|
|
1522
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
1523
|
+
| outboundPaymentId | string | yes | (Immutable) FK → OutboundPayment document ID (parent). |
|
|
1524
|
+
| expenseId | string | yes | (Immutable) FK → Expense document ID. Full Expense model tracked in #20. |
|
|
1525
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. Denormalized for collection-group queries. |
|
|
1526
|
+
| amount | number | yes | Amount of this payment allocated to the referenced expense (XOF). |
|
|
1527
|
+
| notes | ['string', 'null'] | no | Optional notes about this allocation. |
|
|
1528
|
+
| allocatedAt | any | no | (Read-only) When this allocation was recorded. |
|
|
1529
|
+
|
|
1530
|
+
Example:
|
|
1531
|
+
```json
|
|
1532
|
+
{
|
|
1533
|
+
"id": null,
|
|
1534
|
+
"outboundPaymentId": "out_ref123",
|
|
1535
|
+
"expenseId": "exp_ref123",
|
|
1536
|
+
"companyId": "comp_xyz789",
|
|
1537
|
+
"amount": 45000,
|
|
1538
|
+
"notes": null,
|
|
1539
|
+
"allocatedAt": "allocatedAt"
|
|
1540
|
+
}
|
|
1541
|
+
```
|
|
1542
|
+
|
|
1543
|
+
### PaymentWebhookEndpoint
|
|
1544
|
+
Fields: 6 (5 required)
|
|
1545
|
+
|
|
1546
|
+
| Field | Type | Required | Description |
|
|
1547
|
+
|-------|------|----------|-------------|
|
|
1548
|
+
| token | string | yes | (Immutable) base64url-encoded 24-byte random token. Also the Firestore document ID and the URL path segment. |
|
|
1549
|
+
| company | string | yes | (Immutable) Company slug (e.g. gerko_studios). Identifies the tenant that owns this endpoint. |
|
|
1550
|
+
| provider | enum(2) | yes | (Immutable) Payment provider whose webhooks this endpoint accepts. |
|
|
1551
|
+
| secret | string | yes | Webhook signing secret for HMAC verification. Backend-only — never returned to dashboard or mobile clients. |
|
|
1552
|
+
| active | boolean | yes | Whether this endpoint is currently active. Inactive endpoints reject incoming webhooks. |
|
|
1553
|
+
| createdAt | any | no | (Read-only) When this endpoint was provisioned. |
|
|
1554
|
+
|
|
1555
|
+
Example:
|
|
1556
|
+
```json
|
|
1557
|
+
{
|
|
1558
|
+
"token": "token",
|
|
1559
|
+
"company": "company",
|
|
1560
|
+
"provider": "wave",
|
|
1561
|
+
"secret": "secret",
|
|
1562
|
+
"active": true,
|
|
1563
|
+
"createdAt": "createdAt"
|
|
1564
|
+
}
|
|
1565
|
+
```
|
|
1566
|
+
|
|
1311
1567
|
### Sale
|
|
1312
1568
|
Fields: 12 (1 required)
|
|
1313
1569
|
|
|
@@ -1323,7 +1579,7 @@ Fields: 12 (1 required)
|
|
|
1323
1579
|
| notes | ['string', 'null'] | no | |
|
|
1324
1580
|
| orderId | ['string', 'null'] | no | FK → Order.id. Link to associated Order document. |
|
|
1325
1581
|
| bookingId | ['string', 'null'] | no | FK → Booking.id. Link to associated Booking document (IG-12). |
|
|
1326
|
-
| purchaseDate | FirestoreTimestamp | yes | Firestore Timestamp
|
|
1582
|
+
| purchaseDate | FirestoreTimestamp | yes | Firestore Timestamp — Admin SDK form: { _seconds, _nanoseconds }. See types/firestore.ts for REST API v1 and client SDK serialization notes (#10). |
|
|
1327
1583
|
| createdAt | any | no | (Read-only) Server-generated creation timestamp. |
|
|
1328
1584
|
|
|
1329
1585
|
Example:
|
|
@@ -1568,6 +1824,36 @@ Example:
|
|
|
1568
1824
|
}
|
|
1569
1825
|
```
|
|
1570
1826
|
|
|
1827
|
+
### User
|
|
1828
|
+
Fields: 9 (0 required)
|
|
1829
|
+
|
|
1830
|
+
| Field | Type | Required | Description |
|
|
1831
|
+
|-------|------|----------|-------------|
|
|
1832
|
+
| id | ['string', 'null'] | no | (Read-only) Firebase Auth UID. Matches the Firestore document ID. |
|
|
1833
|
+
| displayName | ['string', 'null'] | no | User display name from Firebase Auth or manually set. |
|
|
1834
|
+
| email | ['string', 'null'] | no | Email address. Present for email/Google auth users. |
|
|
1835
|
+
| phoneE164 | ['string', 'null'] | no | E.164-normalized phone number (e.g. +2250777471485). Canonical phone identity field; used for WhatsApp OTP lookup via indexed query. |
|
|
1836
|
+
| companyId | ['string', 'null'] | no | (Immutable) FK → Company document ID. Present for staff accounts scoped to a company. |
|
|
1837
|
+
| role | ['string', 'null'] | no | Staff role within the company (e.g. admin, manager, staff). Application-defined. |
|
|
1838
|
+
| isActive | ['boolean', 'null'] | no | Whether this user account is active. Inactive accounts are denied access. |
|
|
1839
|
+
| createdAt | any | no | (Read-only) When the user document was created. |
|
|
1840
|
+
| updatedAt | any | no | (Read-only) When the user document was last updated. |
|
|
1841
|
+
|
|
1842
|
+
Example:
|
|
1843
|
+
```json
|
|
1844
|
+
{
|
|
1845
|
+
"id": null,
|
|
1846
|
+
"displayName": null,
|
|
1847
|
+
"email": null,
|
|
1848
|
+
"phoneE164": null,
|
|
1849
|
+
"companyId": null,
|
|
1850
|
+
"role": null,
|
|
1851
|
+
"isActive": null,
|
|
1852
|
+
"createdAt": "createdAt",
|
|
1853
|
+
"updatedAt": "updatedAt"
|
|
1854
|
+
}
|
|
1855
|
+
```
|
|
1856
|
+
|
|
1571
1857
|
### WhatsappInboundMessage
|
|
1572
1858
|
Fields: 13 (7 required)
|
|
1573
1859
|
|
|
@@ -1646,7 +1932,7 @@ Fields: 18 (7 required)
|
|
|
1646
1932
|
| Field | Type | Required | Description |
|
|
1647
1933
|
|-------|------|----------|-------------|
|
|
1648
1934
|
| id | ['string', 'null'] | no | (Read-only) Firestore document ID — auto-generated at enqueue time. |
|
|
1649
|
-
| to | string | yes | (Immutable) Recipient
|
|
1935
|
+
| to | string | yes | (Immutable) Recipient Meta wa_id — digits only, no leading + (e.g. 22577471485). Equal to the inbound `from` for the same conversation. NOT literal E.164; see x-note (#54). |
|
|
1650
1936
|
| waba | WabaLabel | yes | (Immutable) WABA that will send the message. Mirrors inbound `waba`. |
|
|
1651
1937
|
| wabaId | string | yes | (Immutable) Meta WABA ID. Mirrors inbound `wabaId`. |
|
|
1652
1938
|
| kind | OutboundMessageFormat | yes | (Immutable) Message format: `text` or `template`. Set `text` xor `template` to match. |
|