@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
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Stocktake"
|
|
3
|
+
sidebar_label: "Stocktake"
|
|
4
|
+
sidebar_position: 25
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Stocktake
|
|
8
|
+
|
|
9
|
+
<details>
|
|
10
|
+
<summary>Example JSON</summary>
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"id": null,
|
|
15
|
+
"companyId": "comp_xyz789",
|
|
16
|
+
"stocktakeNumber": "stocktakeNumber",
|
|
17
|
+
"stocktakeDate": "stocktakeDate",
|
|
18
|
+
"warehouseId": "war_ref123",
|
|
19
|
+
"frequency": "frequency",
|
|
20
|
+
"scheduledStocktakeId": "sch_ref123",
|
|
21
|
+
"status": "status",
|
|
22
|
+
"adjustmentsApplied": true,
|
|
23
|
+
"notes": "VIP customer, handle with care",
|
|
24
|
+
"totalItemsCount": 2,
|
|
25
|
+
"totalDiscrepancies": 0,
|
|
26
|
+
"totalDeltaValue": 0,
|
|
27
|
+
"startedAt": "startedAt",
|
|
28
|
+
"completedAt": "completedAt",
|
|
29
|
+
"createdAt": "createdAt",
|
|
30
|
+
"createdBy": "staff_k0f1",
|
|
31
|
+
"createdByName": "Kofi Mensah",
|
|
32
|
+
"completedBy": "completedBy",
|
|
33
|
+
"completedByName": "completedByName",
|
|
34
|
+
"updatedAt": "updatedAt"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
</details>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
- [1. Property `id`](#id)
|
|
42
|
+
- [2. Property `companyId`](#companyId)
|
|
43
|
+
- [3. Property `stocktakeNumber`](#stocktakeNumber)
|
|
44
|
+
- [4. Property `stocktakeDate`](#stocktakeDate)
|
|
45
|
+
- [4.1. Property `_seconds`](#stocktakeDate__seconds)
|
|
46
|
+
- [4.2. Property `_nanoseconds`](#stocktakeDate__nanoseconds)
|
|
47
|
+
- [5. Property `warehouseId`](#warehouseId)
|
|
48
|
+
- [5.1. Property `item 0`](#warehouseId_anyOf_i0)
|
|
49
|
+
- [5.2. Property `item 1`](#warehouseId_anyOf_i1)
|
|
50
|
+
- [6. Property `frequency`](#frequency)
|
|
51
|
+
- [6.1. Property `stocktake-frequency`](#frequency_anyOf_i0)
|
|
52
|
+
- [6.2. Property `item 1`](#frequency_anyOf_i1)
|
|
53
|
+
- [7. Property `scheduledStocktakeId`](#scheduledStocktakeId)
|
|
54
|
+
- [7.1. Property `item 0`](#scheduledStocktakeId_anyOf_i0)
|
|
55
|
+
- [7.2. Property `item 1`](#scheduledStocktakeId_anyOf_i1)
|
|
56
|
+
- [8. Property `status`](#status)
|
|
57
|
+
- [9. Property `adjustmentsApplied`](#adjustmentsApplied)
|
|
58
|
+
- [10. Property `notes`](#notes)
|
|
59
|
+
- [10.1. Property `item 0`](#notes_anyOf_i0)
|
|
60
|
+
- [10.2. Property `item 1`](#notes_anyOf_i1)
|
|
61
|
+
- [11. Property `totalItemsCount`](#totalItemsCount)
|
|
62
|
+
- [12. Property `totalDiscrepancies`](#totalDiscrepancies)
|
|
63
|
+
- [13. Property `totalDeltaValue`](#totalDeltaValue)
|
|
64
|
+
- [14. Property `startedAt`](#startedAt)
|
|
65
|
+
- [15. Property `completedAt`](#completedAt)
|
|
66
|
+
- [15.1. Property `firestore-timestamp`](#completedAt_anyOf_i0)
|
|
67
|
+
- [15.2. Property `item 1`](#completedAt_anyOf_i1)
|
|
68
|
+
- [16. Property `createdAt`](#createdAt)
|
|
69
|
+
- [16.1. Property `firestore-timestamp`](#createdAt_anyOf_i0)
|
|
70
|
+
- [16.2. Property `item 1`](#createdAt_anyOf_i1)
|
|
71
|
+
- [17. Property `createdBy`](#createdBy)
|
|
72
|
+
- [18. Property `createdByName`](#createdByName)
|
|
73
|
+
- [19. Property `completedBy`](#completedBy)
|
|
74
|
+
- [19.1. Property `item 0`](#completedBy_anyOf_i0)
|
|
75
|
+
- [19.2. Property `item 1`](#completedBy_anyOf_i1)
|
|
76
|
+
- [20. Property `completedByName`](#completedByName)
|
|
77
|
+
- [20.1. Property `item 0`](#completedByName_anyOf_i0)
|
|
78
|
+
- [20.2. Property `item 1`](#completedByName_anyOf_i1)
|
|
79
|
+
- [21. Property `updatedAt`](#updatedAt)
|
|
80
|
+
- [21.1. Property `firestore-timestamp`](#updatedAt_anyOf_i0)
|
|
81
|
+
- [21.2. Property `item 1`](#updatedAt_anyOf_i1)
|
|
82
|
+
|
|
83
|
+
| | |
|
|
84
|
+
| ------------------------- | ----------------------- |
|
|
85
|
+
| **Type** | `object` |
|
|
86
|
+
| **Required** | No |
|
|
87
|
+
| **Additional properties** | Not allowed |
|
|
88
|
+
| **Defined in** | #/definitions/stocktake |
|
|
89
|
+
|
|
90
|
+
**Description:** Stocktake (GH#29 §4). Collection: companies/\{companyId\}/stocktakes/\{stocktakeId\}. A recorded session of physically counting all SKUs at a point in time. Replaces the dashboard's Inventory model; items live in a sub-collection (replaces InventoryItem[] embedded array); InventoryEvolution is dropped — derivable from the sub-collection. Status transitions and aggregate fields (totalItemsCount/Discrepancies/totalDeltaValue) are server-owned per GH#29 §3.
|
|
91
|
+
|
|
92
|
+
| Property | Pattern | Type | Deprecated | Definition | Title/Description |
|
|
93
|
+
| ------------------------------------------------ | ------- | ---------------- | ---------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
94
|
+
| - [id](#id ) | No | string or null | No | - | (Read-only) Firestore document ID, auto-generated. |
|
|
95
|
+
| + [companyId](#companyId ) | No | string | No | - | (Immutable) FK → Company document ID. Tenant scope. |
|
|
96
|
+
| + [stocktakeNumber](#stocktakeNumber ) | No | string | No | - | 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. |
|
|
97
|
+
| + [stocktakeDate](#stocktakeDate ) | No | object | No | In #/definitions/firestore-timestamp | Effective date of the count. Distinct from createdAt; can be backdated. |
|
|
98
|
+
| - [warehouseId](#warehouseId ) | No | Combination | No | - | FK → Warehouse document ID. Null = whole-company stocktake (no warehouse partition). |
|
|
99
|
+
| - [frequency](#frequency ) | No | Combination | No | - | Recurrence cadence. Optional — leave unset for ad-hoc sessions, or set to indicate this stocktake is part of a recurring schedule. |
|
|
100
|
+
| - [scheduledStocktakeId](#scheduledStocktakeId ) | No | Combination | No | - | FK to a recurring stocktake schedule, if this session was emitted from one. Null for ad-hoc sessions. |
|
|
101
|
+
| + [status](#status ) | No | enum (of string) | No | In #/definitions/stocktake-status | Lifecycle status. Transitions PENDING → IN_PROGRESS → COMPLETED are server-owned (GH#29 §3 / Q25). |
|
|
102
|
+
| + [adjustmentsApplied](#adjustmentsApplied ) | No | boolean | No | - | True if completing the session actually emitted StockMovement adjustments. False for record-only counts. |
|
|
103
|
+
| - [notes](#notes ) | No | Combination | No | - | Free-text session-level notes. |
|
|
104
|
+
| + [totalItemsCount](#totalItemsCount ) | No | integer | No | - | (Read-only) Total number of StocktakeItem rows under this session. |
|
|
105
|
+
| + [totalDiscrepancies](#totalDiscrepancies ) | No | integer | No | - | (Read-only) Sum of absolute deltas across counted items. |
|
|
106
|
+
| + [totalDeltaValue](#totalDeltaValue ) | No | number | No | - | (Read-only) Net valuation impact of the count, in XOF integer minor units. |
|
|
107
|
+
| + [startedAt](#startedAt ) | No | object | No | Same as [stocktakeDate](#stocktakeDate ) | When the counting session physically opened. Typically equal to createdAt for ad-hoc sessions. |
|
|
108
|
+
| - [completedAt](#completedAt ) | No | Combination | No | - | (Read-only) When the session transitioned to COMPLETED. |
|
|
109
|
+
| - [createdAt](#createdAt ) | No | Combination | No | - | (Read-only) Server-generated creation timestamp. |
|
|
110
|
+
| + [createdBy](#createdBy ) | No | string | No | - | (Immutable) FK → User UID who created the session. |
|
|
111
|
+
| + [createdByName](#createdByName ) | No | string | No | - | (Denormalized) Snapshot of the creator's display name at session creation. |
|
|
112
|
+
| - [completedBy](#completedBy ) | No | Combination | No | - | (Read-only) FK → User UID who completed the session, set by server on COMPLETED. |
|
|
113
|
+
| - [completedByName](#completedByName ) | No | Combination | No | - | (Denormalized) Snapshot of the completer's display name. |
|
|
114
|
+
| - [updatedAt](#updatedAt ) | No | Combination | No | - | (Read-only) Server-generated update timestamp. |
|
|
115
|
+
|
|
116
|
+
## <a name="id"></a>1. Property `id`
|
|
117
|
+
|
|
118
|
+
| | |
|
|
119
|
+
| ------------ | ---------------- |
|
|
120
|
+
| **Type** | `string or null` |
|
|
121
|
+
| **Required** | No |
|
|
122
|
+
|
|
123
|
+
**Description:** (Read-only) Firestore document ID, auto-generated.
|
|
124
|
+
|
|
125
|
+
:::warning Server-set
|
|
126
|
+
Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
|
|
127
|
+
:::
|
|
128
|
+
|
|
129
|
+
## <a name="companyId"></a>2. Property `companyId`
|
|
130
|
+
|
|
131
|
+
| | |
|
|
132
|
+
| ------------ | -------- |
|
|
133
|
+
| **Type** | `string` |
|
|
134
|
+
| **Required** | Yes |
|
|
135
|
+
|
|
136
|
+
**Description:** (Immutable) FK → Company document ID. Tenant scope.
|
|
137
|
+
|
|
138
|
+
:::info Immutable
|
|
139
|
+
Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
|
|
140
|
+
:::
|
|
141
|
+
|
|
142
|
+
## <a name="stocktakeNumber"></a>3. Property `stocktakeNumber`
|
|
143
|
+
|
|
144
|
+
| | |
|
|
145
|
+
| ------------ | -------- |
|
|
146
|
+
| **Type** | `string` |
|
|
147
|
+
| **Required** | Yes |
|
|
148
|
+
|
|
149
|
+
**Description:** 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.
|
|
150
|
+
|
|
151
|
+
## <a name="stocktakeDate"></a>4. Property `stocktakeDate`
|
|
152
|
+
|
|
153
|
+
| | |
|
|
154
|
+
| ------------------------- | --------------------------------- |
|
|
155
|
+
| **Type** | `object` |
|
|
156
|
+
| **Required** | Yes |
|
|
157
|
+
| **Additional properties** | Not allowed |
|
|
158
|
+
| **Defined in** | #/definitions/firestore-timestamp |
|
|
159
|
+
|
|
160
|
+
**Description:** Effective date of the count. Distinct from createdAt; can be backdated.
|
|
161
|
+
|
|
162
|
+
| Property | Pattern | Type | Deprecated | Definition | Title/Description |
|
|
163
|
+
| ---------------------------------------------- | ------- | ------- | ---------- | ---------- | ----------------- |
|
|
164
|
+
| + [_seconds](#stocktakeDate__seconds ) | No | integer | No | - | - |
|
|
165
|
+
| + [_nanoseconds](#stocktakeDate__nanoseconds ) | No | integer | No | - | - |
|
|
166
|
+
|
|
167
|
+
### <a name="stocktakeDate__seconds"></a>4.1. Property `_seconds`
|
|
168
|
+
|
|
169
|
+
| | |
|
|
170
|
+
| ------------ | --------- |
|
|
171
|
+
| **Type** | `integer` |
|
|
172
|
+
| **Required** | Yes |
|
|
173
|
+
|
|
174
|
+
| Restrictions | |
|
|
175
|
+
| ------------ | ---------------------- |
|
|
176
|
+
| **Minimum** | ≥ -9007199254740991 |
|
|
177
|
+
| **Maximum** | ≤ 9007199254740991 |
|
|
178
|
+
|
|
179
|
+
### <a name="stocktakeDate__nanoseconds"></a>4.2. Property `_nanoseconds`
|
|
180
|
+
|
|
181
|
+
| | |
|
|
182
|
+
| ------------ | --------- |
|
|
183
|
+
| **Type** | `integer` |
|
|
184
|
+
| **Required** | Yes |
|
|
185
|
+
|
|
186
|
+
| Restrictions | |
|
|
187
|
+
| ------------ | ---------------------- |
|
|
188
|
+
| **Minimum** | ≥ -9007199254740991 |
|
|
189
|
+
| **Maximum** | ≤ 9007199254740991 |
|
|
190
|
+
|
|
191
|
+
:::note
|
|
192
|
+
The date the count is FOR. Can be backdated (stocktakeDate < createdAt) — analytics buckets by stocktakeDate for "what period was counted" and by completedAt for "when adjustments hit the ledger" (GH#29 Q24).
|
|
193
|
+
:::
|
|
194
|
+
|
|
195
|
+
## <a name="warehouseId"></a>5. Property `warehouseId`
|
|
196
|
+
|
|
197
|
+
| | |
|
|
198
|
+
| ------------------------- | ---------------- |
|
|
199
|
+
| **Type** | `combining` |
|
|
200
|
+
| **Required** | No |
|
|
201
|
+
| **Additional properties** | Any type allowed |
|
|
202
|
+
|
|
203
|
+
**Description:** FK → Warehouse document ID. Null = whole-company stocktake (no warehouse partition).
|
|
204
|
+
|
|
205
|
+
| Any of(Option) |
|
|
206
|
+
| ------------------------------- |
|
|
207
|
+
| [item 0](#warehouseId_anyOf_i0) |
|
|
208
|
+
| [item 1](#warehouseId_anyOf_i1) |
|
|
209
|
+
|
|
210
|
+
### <a name="warehouseId_anyOf_i0"></a>5.1. Property `item 0`
|
|
211
|
+
|
|
212
|
+
| | |
|
|
213
|
+
| ------------ | -------- |
|
|
214
|
+
| **Type** | `string` |
|
|
215
|
+
| **Required** | No |
|
|
216
|
+
|
|
217
|
+
### <a name="warehouseId_anyOf_i1"></a>5.2. Property `item 1`
|
|
218
|
+
|
|
219
|
+
| | |
|
|
220
|
+
| ------------ | ------ |
|
|
221
|
+
| **Type** | `null` |
|
|
222
|
+
| **Required** | No |
|
|
223
|
+
|
|
224
|
+
## <a name="frequency"></a>6. Property `frequency`
|
|
225
|
+
|
|
226
|
+
| | |
|
|
227
|
+
| ------------------------- | ---------------- |
|
|
228
|
+
| **Type** | `combining` |
|
|
229
|
+
| **Required** | No |
|
|
230
|
+
| **Additional properties** | Any type allowed |
|
|
231
|
+
|
|
232
|
+
**Description:** Recurrence cadence. Optional — leave unset for ad-hoc sessions, or set to indicate this stocktake is part of a recurring schedule.
|
|
233
|
+
|
|
234
|
+
| Any of(Option) |
|
|
235
|
+
| ------------------------------------------ |
|
|
236
|
+
| [stocktake-frequency](#frequency_anyOf_i0) |
|
|
237
|
+
| [item 1](#frequency_anyOf_i1) |
|
|
238
|
+
|
|
239
|
+
### <a name="frequency_anyOf_i0"></a>6.1. Property `stocktake-frequency`
|
|
240
|
+
|
|
241
|
+
| | |
|
|
242
|
+
| -------------- | --------------------------------- |
|
|
243
|
+
| **Type** | `enum (of string)` |
|
|
244
|
+
| **Required** | No |
|
|
245
|
+
| **Defined in** | #/definitions/stocktake-frequency |
|
|
246
|
+
|
|
247
|
+
**Description:** Recurrence cadence of a Stocktake session (GH#29 §4).
|
|
248
|
+
|
|
249
|
+
Must be one of:
|
|
250
|
+
* "DAILY"
|
|
251
|
+
* "WEEKLY"
|
|
252
|
+
* "MONTHLY"
|
|
253
|
+
* "AD_HOC"
|
|
254
|
+
|
|
255
|
+
### <a name="frequency_anyOf_i1"></a>6.2. Property `item 1`
|
|
256
|
+
|
|
257
|
+
| | |
|
|
258
|
+
| ------------ | ------ |
|
|
259
|
+
| **Type** | `null` |
|
|
260
|
+
| **Required** | No |
|
|
261
|
+
|
|
262
|
+
:::note
|
|
263
|
+
Optional today (dashboard does not currently track recurrence). Frequency is a property of the record, not a separate type — a daily stocktake is a Stocktake with frequency=DAILY, not a distinct DailyStocktake model. If the session was emitted from a recurring schedule, set Stocktake.scheduledStocktakeId; ad-hoc sessions leave it null.
|
|
264
|
+
:::
|
|
265
|
+
|
|
266
|
+
:::info See also
|
|
267
|
+
**Issues:** `gh#29`
|
|
268
|
+
:::
|
|
269
|
+
|
|
270
|
+
## <a name="scheduledStocktakeId"></a>7. Property `scheduledStocktakeId`
|
|
271
|
+
|
|
272
|
+
| | |
|
|
273
|
+
| ------------------------- | ---------------- |
|
|
274
|
+
| **Type** | `combining` |
|
|
275
|
+
| **Required** | No |
|
|
276
|
+
| **Additional properties** | Any type allowed |
|
|
277
|
+
|
|
278
|
+
**Description:** FK to a recurring stocktake schedule, if this session was emitted from one. Null for ad-hoc sessions.
|
|
279
|
+
|
|
280
|
+
| Any of(Option) |
|
|
281
|
+
| ---------------------------------------- |
|
|
282
|
+
| [item 0](#scheduledStocktakeId_anyOf_i0) |
|
|
283
|
+
| [item 1](#scheduledStocktakeId_anyOf_i1) |
|
|
284
|
+
|
|
285
|
+
### <a name="scheduledStocktakeId_anyOf_i0"></a>7.1. Property `item 0`
|
|
286
|
+
|
|
287
|
+
| | |
|
|
288
|
+
| ------------ | -------- |
|
|
289
|
+
| **Type** | `string` |
|
|
290
|
+
| **Required** | No |
|
|
291
|
+
|
|
292
|
+
### <a name="scheduledStocktakeId_anyOf_i1"></a>7.2. Property `item 1`
|
|
293
|
+
|
|
294
|
+
| | |
|
|
295
|
+
| ------------ | ------ |
|
|
296
|
+
| **Type** | `null` |
|
|
297
|
+
| **Required** | No |
|
|
298
|
+
|
|
299
|
+
## <a name="status"></a>8. Property `status`
|
|
300
|
+
|
|
301
|
+
| | |
|
|
302
|
+
| -------------- | ------------------------------ |
|
|
303
|
+
| **Type** | `enum (of string)` |
|
|
304
|
+
| **Required** | Yes |
|
|
305
|
+
| **Defined in** | #/definitions/stocktake-status |
|
|
306
|
+
|
|
307
|
+
**Description:** Lifecycle status. Transitions PENDING → IN_PROGRESS → COMPLETED are server-owned (GH#29 §3 / Q25).
|
|
308
|
+
|
|
309
|
+
Must be one of:
|
|
310
|
+
* "PENDING"
|
|
311
|
+
* "IN_PROGRESS"
|
|
312
|
+
* "COMPLETED"
|
|
313
|
+
* "CANCELLED"
|
|
314
|
+
|
|
315
|
+
:::note
|
|
316
|
+
PENDING = session created, no items counted yet. IN_PROGRESS = at least one item has been counted. COMPLETED = all items counted and the session was closed; on this transition the server emits one StockMovement(type=INVENTORY) per non-zero delta. CANCELLED = session abandoned without applying adjustments. Status transitions PENDING → IN_PROGRESS → COMPLETED are server-owned (Q25) — clients PATCH item status; the server transitions session status to avoid the concurrent-edit race documented in stockService.ts:1671.
|
|
317
|
+
:::
|
|
318
|
+
|
|
319
|
+
:::tip When to set
|
|
320
|
+
Server-managed. Clients write item updates; the trigger transitions session status.
|
|
321
|
+
:::
|
|
322
|
+
|
|
323
|
+
:::info See also
|
|
324
|
+
**Issues:** `gh#29`
|
|
325
|
+
:::
|
|
326
|
+
|
|
327
|
+
## <a name="adjustmentsApplied"></a>9. Property `adjustmentsApplied`
|
|
328
|
+
|
|
329
|
+
| | |
|
|
330
|
+
| ------------ | --------- |
|
|
331
|
+
| **Type** | `boolean` |
|
|
332
|
+
| **Required** | Yes |
|
|
333
|
+
|
|
334
|
+
**Description:** True if completing the session actually emitted StockMovement adjustments. False for record-only counts.
|
|
335
|
+
|
|
336
|
+
:::note
|
|
337
|
+
Records whether the COMPLETED transition actually mutated stock or was record-only. The dashboard's completeInventory(applyAdjustments) flag was not persisted; this field closes that gap (GH#29 audit Q22).
|
|
338
|
+
:::
|
|
339
|
+
|
|
340
|
+
## <a name="notes"></a>10. Property `notes`
|
|
341
|
+
|
|
342
|
+
| | |
|
|
343
|
+
| ------------------------- | ---------------- |
|
|
344
|
+
| **Type** | `combining` |
|
|
345
|
+
| **Required** | No |
|
|
346
|
+
| **Additional properties** | Any type allowed |
|
|
347
|
+
|
|
348
|
+
**Description:** Free-text session-level notes.
|
|
349
|
+
|
|
350
|
+
| Any of(Option) |
|
|
351
|
+
| ------------------------- |
|
|
352
|
+
| [item 0](#notes_anyOf_i0) |
|
|
353
|
+
| [item 1](#notes_anyOf_i1) |
|
|
354
|
+
|
|
355
|
+
### <a name="notes_anyOf_i0"></a>10.1. Property `item 0`
|
|
356
|
+
|
|
357
|
+
| | |
|
|
358
|
+
| ------------ | -------- |
|
|
359
|
+
| **Type** | `string` |
|
|
360
|
+
| **Required** | No |
|
|
361
|
+
|
|
362
|
+
### <a name="notes_anyOf_i1"></a>10.2. Property `item 1`
|
|
363
|
+
|
|
364
|
+
| | |
|
|
365
|
+
| ------------ | ------ |
|
|
366
|
+
| **Type** | `null` |
|
|
367
|
+
| **Required** | No |
|
|
368
|
+
|
|
369
|
+
## <a name="totalItemsCount"></a>11. Property `totalItemsCount`
|
|
370
|
+
|
|
371
|
+
| | |
|
|
372
|
+
| ------------ | --------- |
|
|
373
|
+
| **Type** | `integer` |
|
|
374
|
+
| **Required** | Yes |
|
|
375
|
+
|
|
376
|
+
**Description:** (Read-only) Total number of StocktakeItem rows under this session.
|
|
377
|
+
|
|
378
|
+
| Restrictions | |
|
|
379
|
+
| ------------ | ---------------------- |
|
|
380
|
+
| **Minimum** | ≥ -9007199254740991 |
|
|
381
|
+
| **Maximum** | ≤ 9007199254740991 |
|
|
382
|
+
|
|
383
|
+
:::warning Server-set
|
|
384
|
+
Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
|
|
385
|
+
:::
|
|
386
|
+
|
|
387
|
+
:::note
|
|
388
|
+
Server-derived. Recomputed by trigger on each StocktakeItem write; not safe to write client-side under concurrent edits (GH#29 audit Q23).
|
|
389
|
+
:::
|
|
390
|
+
|
|
391
|
+
## <a name="totalDiscrepancies"></a>12. Property `totalDiscrepancies`
|
|
392
|
+
|
|
393
|
+
| | |
|
|
394
|
+
| ------------ | --------- |
|
|
395
|
+
| **Type** | `integer` |
|
|
396
|
+
| **Required** | Yes |
|
|
397
|
+
|
|
398
|
+
**Description:** (Read-only) Sum of absolute deltas across counted items.
|
|
399
|
+
|
|
400
|
+
| Restrictions | |
|
|
401
|
+
| ------------ | ---------------------- |
|
|
402
|
+
| **Minimum** | ≥ -9007199254740991 |
|
|
403
|
+
| **Maximum** | ≤ 9007199254740991 |
|
|
404
|
+
|
|
405
|
+
:::warning Server-set
|
|
406
|
+
Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
|
|
407
|
+
:::
|
|
408
|
+
|
|
409
|
+
:::note
|
|
410
|
+
Server-derived = sum of |item.delta| across COUNTED items. Updated by trigger.
|
|
411
|
+
:::
|
|
412
|
+
|
|
413
|
+
## <a name="totalDeltaValue"></a>13. Property `totalDeltaValue`
|
|
414
|
+
|
|
415
|
+
| | |
|
|
416
|
+
| ------------ | -------- |
|
|
417
|
+
| **Type** | `number` |
|
|
418
|
+
| **Required** | Yes |
|
|
419
|
+
|
|
420
|
+
**Description:** (Read-only) Net valuation impact of the count, in XOF integer minor units.
|
|
421
|
+
|
|
422
|
+
:::warning Server-set
|
|
423
|
+
Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
|
|
424
|
+
:::
|
|
425
|
+
|
|
426
|
+
:::note
|
|
427
|
+
Server-derived = sum of (item.delta × item.costPerUnit) across COUNTED items, in XOF integer minor units (D18). Updated by trigger.
|
|
428
|
+
:::
|
|
429
|
+
|
|
430
|
+
## <a name="startedAt"></a>14. Property `startedAt`
|
|
431
|
+
|
|
432
|
+
| | |
|
|
433
|
+
| ------------------------- | ------------------------------- |
|
|
434
|
+
| **Type** | `object` |
|
|
435
|
+
| **Required** | Yes |
|
|
436
|
+
| **Additional properties** | Not allowed |
|
|
437
|
+
| **Same definition as** | [stocktakeDate](#stocktakeDate) |
|
|
438
|
+
|
|
439
|
+
**Description:** When the counting session physically opened. Typically equal to createdAt for ad-hoc sessions.
|
|
440
|
+
|
|
441
|
+
## <a name="completedAt"></a>15. Property `completedAt`
|
|
442
|
+
|
|
443
|
+
| | |
|
|
444
|
+
| ------------------------- | ---------------- |
|
|
445
|
+
| **Type** | `combining` |
|
|
446
|
+
| **Required** | No |
|
|
447
|
+
| **Additional properties** | Any type allowed |
|
|
448
|
+
|
|
449
|
+
**Description:** (Read-only) When the session transitioned to COMPLETED.
|
|
450
|
+
|
|
451
|
+
| Any of(Option) |
|
|
452
|
+
| -------------------------------------------- |
|
|
453
|
+
| [firestore-timestamp](#completedAt_anyOf_i0) |
|
|
454
|
+
| [item 1](#completedAt_anyOf_i1) |
|
|
455
|
+
|
|
456
|
+
### <a name="completedAt_anyOf_i0"></a>15.1. Property `firestore-timestamp`
|
|
457
|
+
|
|
458
|
+
| | |
|
|
459
|
+
| ------------------------- | ------------------------------- |
|
|
460
|
+
| **Type** | `object` |
|
|
461
|
+
| **Required** | No |
|
|
462
|
+
| **Additional properties** | Not allowed |
|
|
463
|
+
| **Same definition as** | [stocktakeDate](#stocktakeDate) |
|
|
464
|
+
|
|
465
|
+
**Description:** Firestore Timestamp serialized representation
|
|
466
|
+
|
|
467
|
+
### <a name="completedAt_anyOf_i1"></a>15.2. Property `item 1`
|
|
468
|
+
|
|
469
|
+
| | |
|
|
470
|
+
| ------------ | ------ |
|
|
471
|
+
| **Type** | `null` |
|
|
472
|
+
| **Required** | No |
|
|
473
|
+
|
|
474
|
+
:::warning Server-set
|
|
475
|
+
Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
|
|
476
|
+
:::
|
|
477
|
+
|
|
478
|
+
:::note
|
|
479
|
+
Server-set on transition to COMPLETED. Distinct from stocktakeDate (the period counted) — analytics buckets by completedAt to answer "when did the ledger hit?".
|
|
480
|
+
:::
|
|
481
|
+
|
|
482
|
+
## <a name="createdAt"></a>16. Property `createdAt`
|
|
483
|
+
|
|
484
|
+
| | |
|
|
485
|
+
| ------------------------- | ---------------- |
|
|
486
|
+
| **Type** | `combining` |
|
|
487
|
+
| **Required** | No |
|
|
488
|
+
| **Additional properties** | Any type allowed |
|
|
489
|
+
|
|
490
|
+
**Description:** (Read-only) Server-generated creation timestamp.
|
|
491
|
+
|
|
492
|
+
| Any of(Option) |
|
|
493
|
+
| ------------------------------------------ |
|
|
494
|
+
| [firestore-timestamp](#createdAt_anyOf_i0) |
|
|
495
|
+
| [item 1](#createdAt_anyOf_i1) |
|
|
496
|
+
|
|
497
|
+
### <a name="createdAt_anyOf_i0"></a>16.1. Property `firestore-timestamp`
|
|
498
|
+
|
|
499
|
+
| | |
|
|
500
|
+
| ------------------------- | ------------------------------- |
|
|
501
|
+
| **Type** | `object` |
|
|
502
|
+
| **Required** | No |
|
|
503
|
+
| **Additional properties** | Not allowed |
|
|
504
|
+
| **Same definition as** | [stocktakeDate](#stocktakeDate) |
|
|
505
|
+
|
|
506
|
+
**Description:** Firestore Timestamp serialized representation
|
|
507
|
+
|
|
508
|
+
### <a name="createdAt_anyOf_i1"></a>16.2. Property `item 1`
|
|
509
|
+
|
|
510
|
+
| | |
|
|
511
|
+
| ------------ | ------ |
|
|
512
|
+
| **Type** | `null` |
|
|
513
|
+
| **Required** | No |
|
|
514
|
+
|
|
515
|
+
:::warning Server-set
|
|
516
|
+
Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
|
|
517
|
+
:::
|
|
518
|
+
|
|
519
|
+
## <a name="createdBy"></a>17. Property `createdBy`
|
|
520
|
+
|
|
521
|
+
| | |
|
|
522
|
+
| ------------ | -------- |
|
|
523
|
+
| **Type** | `string` |
|
|
524
|
+
| **Required** | Yes |
|
|
525
|
+
|
|
526
|
+
**Description:** (Immutable) FK → User UID who created the session.
|
|
527
|
+
|
|
528
|
+
:::info Immutable
|
|
529
|
+
Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
|
|
530
|
+
:::
|
|
531
|
+
|
|
532
|
+
## <a name="createdByName"></a>18. Property `createdByName`
|
|
533
|
+
|
|
534
|
+
| | |
|
|
535
|
+
| ------------ | -------- |
|
|
536
|
+
| **Type** | `string` |
|
|
537
|
+
| **Required** | Yes |
|
|
538
|
+
|
|
539
|
+
**Description:** (Denormalized) Snapshot of the creator's display name at session creation.
|
|
540
|
+
|
|
541
|
+
:::note
|
|
542
|
+
Read-time hint snapshot of the creator's display name (GH#29 §3 / Q10).
|
|
543
|
+
:::
|
|
544
|
+
|
|
545
|
+
## <a name="completedBy"></a>19. Property `completedBy`
|
|
546
|
+
|
|
547
|
+
| | |
|
|
548
|
+
| ------------------------- | ---------------- |
|
|
549
|
+
| **Type** | `combining` |
|
|
550
|
+
| **Required** | No |
|
|
551
|
+
| **Additional properties** | Any type allowed |
|
|
552
|
+
|
|
553
|
+
**Description:** (Read-only) FK → User UID who completed the session, set by server on COMPLETED.
|
|
554
|
+
|
|
555
|
+
| Any of(Option) |
|
|
556
|
+
| ------------------------------- |
|
|
557
|
+
| [item 0](#completedBy_anyOf_i0) |
|
|
558
|
+
| [item 1](#completedBy_anyOf_i1) |
|
|
559
|
+
|
|
560
|
+
### <a name="completedBy_anyOf_i0"></a>19.1. Property `item 0`
|
|
561
|
+
|
|
562
|
+
| | |
|
|
563
|
+
| ------------ | -------- |
|
|
564
|
+
| **Type** | `string` |
|
|
565
|
+
| **Required** | No |
|
|
566
|
+
|
|
567
|
+
### <a name="completedBy_anyOf_i1"></a>19.2. Property `item 1`
|
|
568
|
+
|
|
569
|
+
| | |
|
|
570
|
+
| ------------ | ------ |
|
|
571
|
+
| **Type** | `null` |
|
|
572
|
+
| **Required** | No |
|
|
573
|
+
|
|
574
|
+
:::warning Server-set
|
|
575
|
+
Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
|
|
576
|
+
:::
|
|
577
|
+
|
|
578
|
+
## <a name="completedByName"></a>20. Property `completedByName`
|
|
579
|
+
|
|
580
|
+
| | |
|
|
581
|
+
| ------------------------- | ---------------- |
|
|
582
|
+
| **Type** | `combining` |
|
|
583
|
+
| **Required** | No |
|
|
584
|
+
| **Additional properties** | Any type allowed |
|
|
585
|
+
|
|
586
|
+
**Description:** (Denormalized) Snapshot of the completer's display name.
|
|
587
|
+
|
|
588
|
+
| Any of(Option) |
|
|
589
|
+
| ----------------------------------- |
|
|
590
|
+
| [item 0](#completedByName_anyOf_i0) |
|
|
591
|
+
| [item 1](#completedByName_anyOf_i1) |
|
|
592
|
+
|
|
593
|
+
### <a name="completedByName_anyOf_i0"></a>20.1. Property `item 0`
|
|
594
|
+
|
|
595
|
+
| | |
|
|
596
|
+
| ------------ | -------- |
|
|
597
|
+
| **Type** | `string` |
|
|
598
|
+
| **Required** | No |
|
|
599
|
+
|
|
600
|
+
### <a name="completedByName_anyOf_i1"></a>20.2. Property `item 1`
|
|
601
|
+
|
|
602
|
+
| | |
|
|
603
|
+
| ------------ | ------ |
|
|
604
|
+
| **Type** | `null` |
|
|
605
|
+
| **Required** | No |
|
|
606
|
+
|
|
607
|
+
:::note
|
|
608
|
+
Read-time hint snapshot of the completer's display name (GH#29 §3 / Q10).
|
|
609
|
+
:::
|
|
610
|
+
|
|
611
|
+
## <a name="updatedAt"></a>21. Property `updatedAt`
|
|
612
|
+
|
|
613
|
+
| | |
|
|
614
|
+
| ------------------------- | ---------------- |
|
|
615
|
+
| **Type** | `combining` |
|
|
616
|
+
| **Required** | No |
|
|
617
|
+
| **Additional properties** | Any type allowed |
|
|
618
|
+
|
|
619
|
+
**Description:** (Read-only) Server-generated update timestamp.
|
|
620
|
+
|
|
621
|
+
| Any of(Option) |
|
|
622
|
+
| ------------------------------------------ |
|
|
623
|
+
| [firestore-timestamp](#updatedAt_anyOf_i0) |
|
|
624
|
+
| [item 1](#updatedAt_anyOf_i1) |
|
|
625
|
+
|
|
626
|
+
### <a name="updatedAt_anyOf_i0"></a>21.1. Property `firestore-timestamp`
|
|
627
|
+
|
|
628
|
+
| | |
|
|
629
|
+
| ------------------------- | ------------------------------- |
|
|
630
|
+
| **Type** | `object` |
|
|
631
|
+
| **Required** | No |
|
|
632
|
+
| **Additional properties** | Not allowed |
|
|
633
|
+
| **Same definition as** | [stocktakeDate](#stocktakeDate) |
|
|
634
|
+
|
|
635
|
+
**Description:** Firestore Timestamp serialized representation
|
|
636
|
+
|
|
637
|
+
### <a name="updatedAt_anyOf_i1"></a>21.2. Property `item 1`
|
|
638
|
+
|
|
639
|
+
| | |
|
|
640
|
+
| ------------ | ------ |
|
|
641
|
+
| **Type** | `null` |
|
|
642
|
+
| **Required** | No |
|
|
643
|
+
|
|
644
|
+
----------------------------------------------------------------------------------------------------------------------------
|
|
645
|
+
Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-05 at 12:09:28 +0000
|
|
646
|
+
|
|
647
|
+
:::warning Server-set
|
|
648
|
+
Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
|
|
649
|
+
:::
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Ticket"
|
|
3
3
|
sidebar_label: "Ticket"
|
|
4
|
-
sidebar_position:
|
|
4
|
+
sidebar_position: 27
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ticket
|
|
@@ -388,7 +388,7 @@ Do not include in write requests. This field is set exclusively by the server (F
|
|
|
388
388
|
**Description:** (Immutable) FK → User/staff UID who created this ticket.
|
|
389
389
|
|
|
390
390
|
----------------------------------------------------------------------------------------------------------------------------
|
|
391
|
-
Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-
|
|
391
|
+
Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-05 at 12:09:28 +0000
|
|
392
392
|
|
|
393
393
|
:::info Immutable
|
|
394
394
|
Set at creation only. This field cannot be modified after the document is created. Include it in CREATE payloads; omit it (or leave unchanged) in UPDATE payloads.
|