@ingenx-io/valets-schema-mcp-server 0.1.4 → 0.1.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 +42 -8
- package/data/docs/enums/attention-status.md +1 -1
- package/data/docs/enums/booking-status.md +1 -1
- package/data/docs/enums/customer-payment-status.md +1 -1
- package/data/docs/enums/customer-payment-target-type.md +1 -1
- package/data/docs/enums/delivery-type.md +1 -1
- package/data/docs/enums/deployment-link-type.md +26 -0
- 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/order-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 +24 -0
- package/data/docs/enums/stocktake-frequency.md +24 -0
- package/data/docs/enums/stocktake-item-status.md +24 -0
- package/data/docs/enums/stocktake-status.md +24 -0
- package/data/docs/enums/ticket-status.md +2 -2
- package/data/docs/index.md +14 -3
- package/data/docs/models/allowed-user.md +1 -1
- package/data/docs/models/analytics-backfill.md +398 -0
- package/data/docs/models/analytics-daily.md +351 -0
- package/data/docs/models/analytics-event.md +2 -2
- package/data/docs/models/analytics-hourly.md +372 -0
- package/data/docs/models/booking-version.md +2 -2
- package/data/docs/models/booking.md +2 -2
- package/data/docs/models/customer-payment-allocation.md +2 -2
- package/data/docs/models/customer-payment.md +2 -2
- package/data/docs/models/customer.md +2 -2
- package/data/docs/models/event.md +2 -2
- package/data/docs/models/loyalty-config.md +2 -2
- package/data/docs/models/loyalty-reward.md +2 -2
- package/data/docs/models/loyalty-status.md +2 -2
- package/data/docs/models/loyalty-transaction.md +2 -2
- package/data/docs/models/magic-link-request.md +2 -2
- package/data/docs/models/metrics-current.md +2 -2
- package/data/docs/models/metrics-daily.md +2 -2
- package/data/docs/models/metrics-monthly.md +2 -2
- package/data/docs/models/order-item.md +2 -2
- package/data/docs/models/order.md +248 -220
- package/data/docs/models/sale.md +2 -2
- package/data/docs/models/site-payment.md +2 -2
- package/data/docs/models/site.md +561 -0
- package/data/docs/models/stocktake-item.md +500 -0
- package/data/docs/models/stocktake.md +649 -0
- package/data/docs/models/ticket.md +2 -2
- package/data/static/llms.txt +309 -2
- package/data/static/openapi.yaml +972 -0
- package/data/static/schemas.json +1249 -77
- package/package.json +1 -1
package/data/static/llms.txt
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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-
|
|
7
|
+
> Generated: 2026-05-05
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -30,6 +30,10 @@ Values: BOOKING, ORDER, PURCHASE
|
|
|
30
30
|
Fulfillment channel for an order. Determines whether the customer comes to the business (ON_SITE), collects their order themselves (PICK_UP), or receives a physical delivery (DELIVERY). Drives whether fulfillmentStatus is relevant.
|
|
31
31
|
Values: ON_SITE, PICK_UP, DELIVERY
|
|
32
32
|
|
|
33
|
+
### DeploymentLinkType
|
|
34
|
+
Category of a Site deployment link (D41). Used for UI icon/labelling and deep-link handling.
|
|
35
|
+
Values: web, mobile, pwa, app-store, play-store, other
|
|
36
|
+
|
|
33
37
|
### EventStatus
|
|
34
38
|
Ticketed event lifecycle (D32). Mobile-only today; Dashboard in Wave 4.
|
|
35
39
|
Values: DRAFT, ACTIVE, CANCELLED, COMPLETED
|
|
@@ -70,6 +74,22 @@ Values: RETURN_REQUESTED, RETURN_PROCESSING, RETURNED, EXCHANGE_REQUESTED, EXCHA
|
|
|
70
74
|
Per-date/per-slot booking session status (D19). Dashboard is sole writer; Mobile is read-only.
|
|
71
75
|
Values: PENDING, CONFIRMED, CANCELLATION_REQUESTED, COMPLETED, NO_SHOW, CANCELLED
|
|
72
76
|
|
|
77
|
+
### SiteStatus
|
|
78
|
+
Lifecycle status for a Site (D41). Drives whether the site is reachable and whether analytics/payments flow.
|
|
79
|
+
Values: ACTIVE, INACTIVE, EXPIRED, ARCHIVED
|
|
80
|
+
|
|
81
|
+
### StocktakeFrequency
|
|
82
|
+
Recurrence cadence of a Stocktake session (GH#29 §4).
|
|
83
|
+
Values: DAILY, WEEKLY, MONTHLY, AD_HOC
|
|
84
|
+
|
|
85
|
+
### StocktakeItemStatus
|
|
86
|
+
Per-line workflow status inside a Stocktake (GH#29 §4, audit Q21).
|
|
87
|
+
Values: PENDING, COUNTED, VERIFIED, ADJUSTED
|
|
88
|
+
|
|
89
|
+
### StocktakeStatus
|
|
90
|
+
Lifecycle status of a Stocktake session (GH#29 §3, §4).
|
|
91
|
+
Values: PENDING, IN_PROGRESS, COMPLETED, CANCELLED
|
|
92
|
+
|
|
73
93
|
### TicketStatus
|
|
74
94
|
Event ticket status (D32). VALID = active and unused.
|
|
75
95
|
Values: VALID, USED, CANCELLED
|
|
@@ -108,6 +128,97 @@ Example:
|
|
|
108
128
|
}
|
|
109
129
|
```
|
|
110
130
|
|
|
131
|
+
### AnalyticsBackfill
|
|
132
|
+
Fields: 12 (10 required)
|
|
133
|
+
|
|
134
|
+
| Field | Type | Required | Description |
|
|
135
|
+
|-------|------|----------|-------------|
|
|
136
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
137
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
138
|
+
| siteId | string | yes | (Immutable) FK → Site document ID (D40). |
|
|
139
|
+
| status | enum(5) | yes | Run status. |
|
|
140
|
+
| from | string | yes | (Immutable) Inclusive start date (`YYYY-MM-DD`, UTC). |
|
|
141
|
+
| to | string | yes | (Immutable) Inclusive end date (`YYYY-MM-DD`, UTC). |
|
|
142
|
+
| dryRun | boolean | yes | (Immutable) When true, rollup writes are skipped — only source counts are returned for diffing. |
|
|
143
|
+
| processedDates | array<string> | yes | Ordered list of `YYYY-MM-DD` dates already processed by this run. |
|
|
144
|
+
| errors | array<object> | yes | Per-date errors collected during the run. |
|
|
145
|
+
| errors[].date | string | yes | `YYYY-MM-DD` date that failed. |
|
|
146
|
+
| errors[].message | string | yes | Error message captured at failure. |
|
|
147
|
+
| errors[].at | FirestoreTimestamp | yes | When the error occurred. |
|
|
148
|
+
| triggeredBy | string | yes | (Immutable) UID of the admin who triggered the backfill. |
|
|
149
|
+
| startedAt | FirestoreTimestamp | yes | (Read-only) When the run actually started. |
|
|
150
|
+
| completedAt | any | no | (Read-only) When the run reached a terminal status. |
|
|
151
|
+
|
|
152
|
+
Example:
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"id": null,
|
|
156
|
+
"companyId": "comp_xyz789",
|
|
157
|
+
"siteId": "sit_ref123",
|
|
158
|
+
"status": "pending",
|
|
159
|
+
"from": "from",
|
|
160
|
+
"to": "to",
|
|
161
|
+
"dryRun": true,
|
|
162
|
+
"processedDates": [
|
|
163
|
+
"example"
|
|
164
|
+
],
|
|
165
|
+
"errors": [
|
|
166
|
+
{
|
|
167
|
+
"date": "2026-02-15",
|
|
168
|
+
"message": "message",
|
|
169
|
+
"at": "at"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"triggeredBy": "triggeredBy",
|
|
173
|
+
"startedAt": "startedAt",
|
|
174
|
+
"completedAt": "completedAt"
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### AnalyticsDaily
|
|
179
|
+
Fields: 16 (14 required)
|
|
180
|
+
|
|
181
|
+
| Field | Type | Required | Description |
|
|
182
|
+
|-------|------|----------|-------------|
|
|
183
|
+
| totalEvents | integer | yes | Total event count within the bucket. |
|
|
184
|
+
| pageViews | integer | yes | Count of `page_view` + `screen_view` events. |
|
|
185
|
+
| sessions | integer | yes | Distinct session count within the bucket (by `sessionId`). |
|
|
186
|
+
| uniqueUsers | integer | yes | Distinct identified `userId` count. Anonymous sessions (userId=null) are excluded. |
|
|
187
|
+
| anonymousSessions | integer | yes | Distinct session count where `userId` was null for the entire session. |
|
|
188
|
+
| orders | integer | yes | Count of `order_submitted` events (or Order documents scoped to this site, D43) within the bucket. |
|
|
189
|
+
| paymentsCompleted | integer | yes | Count of `payment_completed` events within the bucket. |
|
|
190
|
+
| paymentsFailed | integer | yes | Count of `payment_failed` events within the bucket. |
|
|
191
|
+
| errors | integer | yes | Count of `error_occurred` + `exception_caught` events within the bucket. |
|
|
192
|
+
| eventCounts | record<string,integer> | yes | Per-event-name counts — key is the event name (canonical or custom), value is the count within the bucket. |
|
|
193
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID = `YYYY-MM-DD`. |
|
|
194
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
195
|
+
| siteId | string | yes | (Immutable) FK → Site document ID (D40). |
|
|
196
|
+
| date | string | yes | (Immutable) `YYYY-MM-DD` UTC — matches document ID. |
|
|
197
|
+
| computedAt | FirestoreTimestamp | yes | (Read-only) When this rollup was last (re)computed. Updated on every set/merge. |
|
|
198
|
+
| sourceEventCount | ['integer', 'null'] | no | (Read-only, Optional) Total source events scanned when producing this rollup. Useful for dry-run diffing. |
|
|
199
|
+
|
|
200
|
+
Example:
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"totalEvents": 0,
|
|
204
|
+
"pageViews": 0,
|
|
205
|
+
"sessions": 0,
|
|
206
|
+
"uniqueUsers": 0,
|
|
207
|
+
"anonymousSessions": 0,
|
|
208
|
+
"orders": 0,
|
|
209
|
+
"paymentsCompleted": 0,
|
|
210
|
+
"paymentsFailed": 0,
|
|
211
|
+
"errors": 0,
|
|
212
|
+
"eventCounts": {},
|
|
213
|
+
"id": null,
|
|
214
|
+
"companyId": "comp_xyz789",
|
|
215
|
+
"siteId": "sit_ref123",
|
|
216
|
+
"date": "2026-02-15",
|
|
217
|
+
"computedAt": "computedAt",
|
|
218
|
+
"sourceEventCount": null
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
111
222
|
### AnalyticsEvent
|
|
112
223
|
Fields: 12 (10 required)
|
|
113
224
|
|
|
@@ -159,6 +270,52 @@ Example:
|
|
|
159
270
|
}
|
|
160
271
|
```
|
|
161
272
|
|
|
273
|
+
### AnalyticsHourly
|
|
274
|
+
Fields: 17 (15 required)
|
|
275
|
+
|
|
276
|
+
| Field | Type | Required | Description |
|
|
277
|
+
|-------|------|----------|-------------|
|
|
278
|
+
| totalEvents | integer | yes | Total event count within the bucket. |
|
|
279
|
+
| pageViews | integer | yes | Count of `page_view` + `screen_view` events. |
|
|
280
|
+
| sessions | integer | yes | Distinct session count within the bucket (by `sessionId`). |
|
|
281
|
+
| uniqueUsers | integer | yes | Distinct identified `userId` count. Anonymous sessions (userId=null) are excluded. |
|
|
282
|
+
| anonymousSessions | integer | yes | Distinct session count where `userId` was null for the entire session. |
|
|
283
|
+
| orders | integer | yes | Count of `order_submitted` events (or Order documents scoped to this site, D43) within the bucket. |
|
|
284
|
+
| paymentsCompleted | integer | yes | Count of `payment_completed` events within the bucket. |
|
|
285
|
+
| paymentsFailed | integer | yes | Count of `payment_failed` events within the bucket. |
|
|
286
|
+
| errors | integer | yes | Count of `error_occurred` + `exception_caught` events within the bucket. |
|
|
287
|
+
| eventCounts | record<string,integer> | yes | Per-event-name counts — key is the event name (canonical or custom), value is the count within the bucket. |
|
|
288
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID = `YYYY-MM-DD-HH`. |
|
|
289
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. |
|
|
290
|
+
| siteId | string | yes | (Immutable) FK → Site document ID (D40). |
|
|
291
|
+
| date | string | yes | (Immutable) `YYYY-MM-DD` UTC for the bucket day. |
|
|
292
|
+
| hour | integer | yes | (Immutable) UTC hour of day, 0–23. |
|
|
293
|
+
| computedAt | FirestoreTimestamp | yes | (Read-only) When this rollup was last (re)computed. |
|
|
294
|
+
| sourceEventCount | ['integer', 'null'] | no | (Read-only, Optional) Total source events scanned when producing this rollup. |
|
|
295
|
+
|
|
296
|
+
Example:
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"totalEvents": 0,
|
|
300
|
+
"pageViews": 0,
|
|
301
|
+
"sessions": 0,
|
|
302
|
+
"uniqueUsers": 0,
|
|
303
|
+
"anonymousSessions": 0,
|
|
304
|
+
"orders": 0,
|
|
305
|
+
"paymentsCompleted": 0,
|
|
306
|
+
"paymentsFailed": 0,
|
|
307
|
+
"errors": 0,
|
|
308
|
+
"eventCounts": {},
|
|
309
|
+
"id": null,
|
|
310
|
+
"companyId": "comp_xyz789",
|
|
311
|
+
"siteId": "sit_ref123",
|
|
312
|
+
"date": "2026-02-15",
|
|
313
|
+
"hour": 0,
|
|
314
|
+
"computedAt": "computedAt",
|
|
315
|
+
"sourceEventCount": null
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
162
319
|
### Booking
|
|
163
320
|
Fields: 52 (7 required)
|
|
164
321
|
|
|
@@ -908,13 +1065,14 @@ Example:
|
|
|
908
1065
|
```
|
|
909
1066
|
|
|
910
1067
|
### Order
|
|
911
|
-
Fields:
|
|
1068
|
+
Fields: 48 (8 required)
|
|
912
1069
|
|
|
913
1070
|
| Field | Type | Required | Description |
|
|
914
1071
|
|-------|------|----------|-------------|
|
|
915
1072
|
| id | string | yes | (Read-only) Firestore document ID. Note: some models also have uid; see ID conventions. |
|
|
916
1073
|
| uid | string | yes | (Read-only) Entity UID. Often mirrors id. |
|
|
917
1074
|
| companyId | string | yes | (Immutable) FK → Company document ID. Scopes all queries. |
|
|
1075
|
+
| siteId | ['string', 'null'] | no | (Immutable, Optional) FK → Site document ID (D43 / ADR-003). null = company-wide. |
|
|
918
1076
|
| orderNumber | string | yes | (Read-only) Server-generated order number. |
|
|
919
1077
|
| status | OrderStatus | yes | Core lifecycle status (D34, MIG-11). See OrderStatus enum for the legacy value migration mapping. |
|
|
920
1078
|
| paymentStatus | any | no | Payment lifecycle (D34). Null until payment is initiated. |
|
|
@@ -966,6 +1124,7 @@ Example:
|
|
|
966
1124
|
"id": "bk_abc123def456",
|
|
967
1125
|
"uid": "user_u8x92kqm",
|
|
968
1126
|
"companyId": "comp_xyz789",
|
|
1127
|
+
"siteId": null,
|
|
969
1128
|
"orderNumber": "ORD-2026-0042",
|
|
970
1129
|
"status": "status",
|
|
971
1130
|
"paymentStatus": "paymentStatus",
|
|
@@ -1085,6 +1244,56 @@ Example:
|
|
|
1085
1244
|
}
|
|
1086
1245
|
```
|
|
1087
1246
|
|
|
1247
|
+
### Site
|
|
1248
|
+
Fields: 14 (6 required)
|
|
1249
|
+
|
|
1250
|
+
| Field | Type | Required | Description |
|
|
1251
|
+
|-------|------|----------|-------------|
|
|
1252
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
1253
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. Scopes all site sub-collections. |
|
|
1254
|
+
| name | string | yes | Human-readable site name shown in dashboards. |
|
|
1255
|
+
| description | ['string', 'null'] | no | Optional freeform description. |
|
|
1256
|
+
| status | SiteStatus | yes | Lifecycle status (D41). Clients filter by ACTIVE. |
|
|
1257
|
+
| deploymentLinks | array<object> | yes | Ordered list of deployment URLs (web, mobile, PWA, store links). |
|
|
1258
|
+
| deploymentLinks[].label | string | yes | Human-readable label shown in dashboards (e.g. "Production", "Staging"). |
|
|
1259
|
+
| deploymentLinks[].url | string | yes | Absolute URL or store link. |
|
|
1260
|
+
| deploymentLinks[].type | DeploymentLinkType | yes | Link category — drives icon/handler selection. |
|
|
1261
|
+
| deploymentLinks[].isPrimary | boolean | no | If true, this link is used as the canonical deployment URL for the Site. |
|
|
1262
|
+
| expiresAt | any | no | Optional expiration timestamp. When set and elapsed, `isExpired` flips true and status typically moves to EXPIRED. |
|
|
1263
|
+
| isExpired | ['boolean', 'null'] | no | (Read-only) Derived — true when `expiresAt` is in the past. Maintained by server trigger. |
|
|
1264
|
+
| createdAt | any | no | (Read-only) Server-generated creation timestamp. |
|
|
1265
|
+
| updatedAt | any | no | (Read-only) Server-generated update timestamp. |
|
|
1266
|
+
| createdBy | string | yes | (Immutable) FK → User/staff UID who created the site. |
|
|
1267
|
+
| analyticsEnabled | boolean | yes | Feature flag — when false, clients should not emit analytics events for this site. |
|
|
1268
|
+
| lastAnalyticsSync | any | no | (Read-only) Last time the analytics rollup pipeline refreshed `cachedMetrics`. |
|
|
1269
|
+
| cachedMetrics | ['object', 'null'] | no | (Read-only, Denormalized) Cached metrics snapshot for quick dashboard rendering. |
|
|
1270
|
+
|
|
1271
|
+
Example:
|
|
1272
|
+
```json
|
|
1273
|
+
{
|
|
1274
|
+
"id": null,
|
|
1275
|
+
"companyId": "comp_xyz789",
|
|
1276
|
+
"name": "Amadou Diallo",
|
|
1277
|
+
"description": null,
|
|
1278
|
+
"status": "status",
|
|
1279
|
+
"deploymentLinks": [
|
|
1280
|
+
{
|
|
1281
|
+
"label": "label",
|
|
1282
|
+
"url": "https://storage.example.com/url.jpg",
|
|
1283
|
+
"type": "phone"
|
|
1284
|
+
}
|
|
1285
|
+
],
|
|
1286
|
+
"expiresAt": "expiresAt",
|
|
1287
|
+
"isExpired": null,
|
|
1288
|
+
"createdAt": "createdAt",
|
|
1289
|
+
"updatedAt": "updatedAt",
|
|
1290
|
+
"createdBy": "staff_k0f1",
|
|
1291
|
+
"analyticsEnabled": true,
|
|
1292
|
+
"lastAnalyticsSync": "lastAnalyticsSync",
|
|
1293
|
+
"cachedMetrics": null
|
|
1294
|
+
}
|
|
1295
|
+
```
|
|
1296
|
+
|
|
1088
1297
|
### SitePayment
|
|
1089
1298
|
Fields: 10 (9 required)
|
|
1090
1299
|
|
|
@@ -1117,6 +1326,104 @@ Example:
|
|
|
1117
1326
|
}
|
|
1118
1327
|
```
|
|
1119
1328
|
|
|
1329
|
+
### Stocktake
|
|
1330
|
+
Fields: 21 (11 required)
|
|
1331
|
+
|
|
1332
|
+
| Field | Type | Required | Description |
|
|
1333
|
+
|-------|------|----------|-------------|
|
|
1334
|
+
| id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
|
|
1335
|
+
| companyId | string | yes | (Immutable) FK → Company document ID. Tenant scope. |
|
|
1336
|
+
| stocktakeNumber | string | yes | Human-readable session number, e.g. "STK-2026-001". Embedded as `referenceNumber` on the StockMovement rows the session emits, so the ledger remains traceable to the originating stocktake. |
|
|
1337
|
+
| stocktakeDate | FirestoreTimestamp | yes | Effective date of the count. Distinct from createdAt; can be backdated. |
|
|
1338
|
+
| warehouseId | any | no | FK → Warehouse document ID. Null = whole-company stocktake (no warehouse partition). |
|
|
1339
|
+
| frequency | any | no | Recurrence cadence. Optional — leave unset for ad-hoc sessions, or set to indicate this stocktake is part of a recurring schedule. |
|
|
1340
|
+
| scheduledStocktakeId | any | no | FK to a recurring stocktake schedule, if this session was emitted from one. Null for ad-hoc sessions. |
|
|
1341
|
+
| status | StocktakeStatus | yes | Lifecycle status. Transitions PENDING → IN_PROGRESS → COMPLETED are server-owned (GH#29 §3 / Q25). |
|
|
1342
|
+
| adjustmentsApplied | boolean | yes | True if completing the session actually emitted StockMovement adjustments. False for record-only counts. |
|
|
1343
|
+
| notes | any | no | Free-text session-level notes. |
|
|
1344
|
+
| totalItemsCount | integer | yes | (Read-only) Total number of StocktakeItem rows under this session. |
|
|
1345
|
+
| totalDiscrepancies | integer | yes | (Read-only) Sum of absolute deltas across counted items. |
|
|
1346
|
+
| totalDeltaValue | number | yes | (Read-only) Net valuation impact of the count, in XOF integer minor units. |
|
|
1347
|
+
| startedAt | FirestoreTimestamp | yes | When the counting session physically opened. Typically equal to createdAt for ad-hoc sessions. |
|
|
1348
|
+
| completedAt | any | no | (Read-only) When the session transitioned to COMPLETED. |
|
|
1349
|
+
| createdAt | any | no | (Read-only) Server-generated creation timestamp. |
|
|
1350
|
+
| createdBy | string | yes | (Immutable) FK → User UID who created the session. |
|
|
1351
|
+
| createdByName | string | yes | (Denormalized) Snapshot of the creator's display name at session creation. |
|
|
1352
|
+
| completedBy | any | no | (Read-only) FK → User UID who completed the session, set by server on COMPLETED. |
|
|
1353
|
+
| completedByName | any | no | (Denormalized) Snapshot of the completer's display name. |
|
|
1354
|
+
| updatedAt | any | no | (Read-only) Server-generated update timestamp. |
|
|
1355
|
+
|
|
1356
|
+
Example:
|
|
1357
|
+
```json
|
|
1358
|
+
{
|
|
1359
|
+
"id": null,
|
|
1360
|
+
"companyId": "comp_xyz789",
|
|
1361
|
+
"stocktakeNumber": "stocktakeNumber",
|
|
1362
|
+
"stocktakeDate": "stocktakeDate",
|
|
1363
|
+
"warehouseId": "war_ref123",
|
|
1364
|
+
"frequency": "frequency",
|
|
1365
|
+
"scheduledStocktakeId": "sch_ref123",
|
|
1366
|
+
"status": "status",
|
|
1367
|
+
"adjustmentsApplied": true,
|
|
1368
|
+
"notes": "VIP customer, handle with care",
|
|
1369
|
+
"totalItemsCount": 2,
|
|
1370
|
+
"totalDiscrepancies": 0,
|
|
1371
|
+
"totalDeltaValue": 0,
|
|
1372
|
+
"startedAt": "startedAt",
|
|
1373
|
+
"completedAt": "completedAt",
|
|
1374
|
+
"createdAt": "createdAt",
|
|
1375
|
+
"createdBy": "staff_k0f1",
|
|
1376
|
+
"createdByName": "Kofi Mensah",
|
|
1377
|
+
"completedBy": "completedBy",
|
|
1378
|
+
"completedByName": "completedByName",
|
|
1379
|
+
"updatedAt": "updatedAt"
|
|
1380
|
+
}
|
|
1381
|
+
```
|
|
1382
|
+
|
|
1383
|
+
### StocktakeItem
|
|
1384
|
+
Fields: 16 (8 required)
|
|
1385
|
+
|
|
1386
|
+
| Field | Type | Required | Description |
|
|
1387
|
+
|-------|------|----------|-------------|
|
|
1388
|
+
| stockItemId | string | yes | FK → StockItem document ID. Doubles as the item document ID. |
|
|
1389
|
+
| stockItemName | string | yes | (Denormalized) Snapshot of StockItem.name at session time. |
|
|
1390
|
+
| theoreticalQuantity | number | yes | (Immutable) System belief at session start, snapshotted when this item row was created. |
|
|
1391
|
+
| actualQuantity | any | no | Physical count entered by the counter. Null until counted; set when the line moves to status COUNTED. |
|
|
1392
|
+
| delta | number | yes | (Read-only) Signed difference between actual and theoretical. Drives the StockMovement(type=INVENTORY) emitted on session COMPLETED. |
|
|
1393
|
+
| unit | string | yes | (Immutable) Snapshot of StockItem.unit at session start. Locks the unit against later catalog changes. |
|
|
1394
|
+
| costPerUnit | number | yes | (Immutable) Snapshot of StockItem.costPerUnit at session start, in XOF integer minor units. |
|
|
1395
|
+
| totalValue | number | yes | (Read-only) Per-line valuation in XOF integer minor units. |
|
|
1396
|
+
| status | StocktakeItemStatus | yes | Per-line workflow status. Server transitions ADJUSTED on parent COMPLETED. |
|
|
1397
|
+
| notes | any | no | Optional per-line note from the counter (e.g. "damaged carton, 3 unsellable"). |
|
|
1398
|
+
| countedBy | any | no | UID of the staff member who entered actualQuantity. |
|
|
1399
|
+
| countedByName | any | no | (Denormalized) Snapshot of the counter's display name at count time. |
|
|
1400
|
+
| countedAt | any | no | When the line was counted. |
|
|
1401
|
+
| verifiedBy | any | no | UID of a second staff member who verified the count. Nullable per GH#29 Q21. |
|
|
1402
|
+
| verifiedByName | any | no | (Denormalized) Snapshot of the verifier's display name. |
|
|
1403
|
+
| verifiedAt | any | no | When the line was verified, if a second-eye flow was used. |
|
|
1404
|
+
|
|
1405
|
+
Example:
|
|
1406
|
+
```json
|
|
1407
|
+
{
|
|
1408
|
+
"stockItemId": "sto_ref123",
|
|
1409
|
+
"stockItemName": "stockItemName",
|
|
1410
|
+
"theoreticalQuantity": 2,
|
|
1411
|
+
"actualQuantity": "actualQuantity",
|
|
1412
|
+
"delta": 0,
|
|
1413
|
+
"unit": "unit",
|
|
1414
|
+
"costPerUnit": 15000,
|
|
1415
|
+
"totalValue": 0,
|
|
1416
|
+
"status": "status",
|
|
1417
|
+
"notes": "VIP customer, handle with care",
|
|
1418
|
+
"countedBy": "countedBy",
|
|
1419
|
+
"countedByName": "countedByName",
|
|
1420
|
+
"countedAt": "countedAt",
|
|
1421
|
+
"verifiedBy": "verifiedBy",
|
|
1422
|
+
"verifiedByName": "verifiedByName",
|
|
1423
|
+
"verifiedAt": "verifiedAt"
|
|
1424
|
+
}
|
|
1425
|
+
```
|
|
1426
|
+
|
|
1120
1427
|
### Ticket
|
|
1121
1428
|
Fields: 16 (6 required)
|
|
1122
1429
|
|