@happyvertical/smrt-inventory 0.40.23 → 0.40.24

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.
@@ -1,103 +1,85 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "timestamp": 1785027413620,
3
+ "timestamp": 1785029962385,
4
4
  "packageName": "@happyvertical/smrt-inventory",
5
- "packageVersion": "0.40.23",
5
+ "packageVersion": "0.40.24",
6
6
  "objects": {
7
- "@happyvertical/smrt-inventory:InventoryLocation": {
8
- "name": "inventorylocation",
9
- "className": "InventoryLocation",
10
- "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocation",
7
+ "@happyvertical/smrt-inventory:InventoryLocationCollection": {
8
+ "name": "inventorylocationcollection",
9
+ "className": "InventoryLocationCollection",
10
+ "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocationCollection",
11
11
  "collection": "inventorylocations",
12
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts",
12
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/InventoryLocationCollection.ts",
13
13
  "packageName": "@happyvertical/smrt-inventory",
14
- "fields": {
15
- "tenantId": {
16
- "type": "text",
17
- "required": false,
18
- "_meta": {
19
- "sqlType": "UUID",
20
- "nullable": true,
21
- "__tenancy": {
22
- "isTenantIdField": true,
23
- "autoFilter": true,
24
- "required": false,
25
- "autoPopulate": true,
26
- "nullable": true,
27
- "mode": "optional",
28
- "field": "tenantId",
29
- "allowSuperAdminBypass": false
14
+ "fields": {},
15
+ "methods": {
16
+ "findByCode": {
17
+ "name": "findByCode",
18
+ "async": true,
19
+ "parameters": [
20
+ {
21
+ "name": "code",
22
+ "type": "string",
23
+ "optional": false
30
24
  }
31
- }
32
- },
33
- "code": {
34
- "type": "text",
35
- "required": true,
36
- "default": "",
37
- "_meta": {
38
- "required": true
39
- }
40
- },
41
- "name": {
42
- "type": "text",
43
- "required": false,
44
- "default": ""
25
+ ],
26
+ "returnType": "Promise<InventoryLocation | null>",
27
+ "isStatic": false,
28
+ "isPublic": true
45
29
  },
46
- "kind": {
47
- "type": "text",
48
- "required": false,
49
- "default": "warehouse"
30
+ "findByKind": {
31
+ "name": "findByKind",
32
+ "async": true,
33
+ "parameters": [
34
+ {
35
+ "name": "kind",
36
+ "type": "InventoryLocationKind",
37
+ "optional": false
38
+ }
39
+ ],
40
+ "returnType": "Promise<InventoryLocation[]>",
41
+ "isStatic": false,
42
+ "isPublic": true
50
43
  },
51
- "placeId": {
52
- "type": "text",
53
- "required": false,
54
- "default": ""
44
+ "findByPlace": {
45
+ "name": "findByPlace",
46
+ "async": true,
47
+ "parameters": [
48
+ {
49
+ "name": "placeId",
50
+ "type": "string",
51
+ "optional": false
52
+ }
53
+ ],
54
+ "returnType": "Promise<InventoryLocation[]>",
55
+ "isStatic": false,
56
+ "isPublic": true
55
57
  },
56
- "active": {
57
- "type": "boolean",
58
- "required": false,
59
- "default": true
58
+ "findActive": {
59
+ "name": "findActive",
60
+ "async": true,
61
+ "parameters": [
62
+ {
63
+ "name": "kind",
64
+ "type": "InventoryLocationKind",
65
+ "optional": true
66
+ }
67
+ ],
68
+ "returnType": "Promise<InventoryLocation[]>",
69
+ "isStatic": false,
70
+ "isPublic": true
60
71
  }
61
72
  },
62
- "methods": {},
63
73
  "decoratorConfig": {
64
- "tableName": "inventory_locations",
65
- "conflictColumns": [
66
- "code",
67
- "tenant_id"
68
- ],
69
- "api": {
70
- "include": [
71
- "list",
72
- "get",
73
- "create",
74
- "update"
75
- ]
76
- },
77
- "mcp": {
78
- "include": [
79
- "list",
80
- "get"
81
- ]
82
- },
83
- "cli": true,
84
- "tenantScoped": {
85
- "mode": "optional"
86
- }
74
+ "tableName": "inventory_locations"
87
75
  },
88
- "extends": "SmrtObject",
89
- "exportName": "InventoryLocation",
90
- "collectionExportName": "InventoryLocationCollection",
91
- "validationRules": [
92
- {
93
- "field": "code",
94
- "rule": "required",
95
- "fieldType": "text"
96
- }
97
- ],
76
+ "extends": "SmrtCollection",
77
+ "extendsTypeArg": "InventoryLocation",
78
+ "exportName": "InventoryLocationCollection",
79
+ "collectionExportName": "InventoryLocationCollectionCollection",
98
80
  "schema": {
99
81
  "tableName": "inventory_locations",
100
- "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_locations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"code\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"kind\" TEXT DEFAULT 'warehouse',\n \"place_id\" TEXT DEFAULT '',\n \"active\" BOOLEAN DEFAULT TRUE\n);",
82
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_locations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
101
83
  "columns": {
102
84
  "id": {
103
85
  "type": "UUID",
@@ -123,42 +105,6 @@
123
105
  "type": "TIMESTAMP",
124
106
  "notNull": true,
125
107
  "default": "current_timestamp"
126
- },
127
- "tenant_id": {
128
- "type": "UUID",
129
- "referenceKind": "tenantId",
130
- "notNull": false,
131
- "unique": false
132
- },
133
- "code": {
134
- "type": "TEXT",
135
- "notNull": true,
136
- "unique": false,
137
- "default": ""
138
- },
139
- "name": {
140
- "type": "TEXT",
141
- "notNull": false,
142
- "unique": false,
143
- "default": ""
144
- },
145
- "kind": {
146
- "type": "TEXT",
147
- "notNull": false,
148
- "unique": false,
149
- "default": "warehouse"
150
- },
151
- "place_id": {
152
- "type": "TEXT",
153
- "notNull": false,
154
- "unique": false,
155
- "default": ""
156
- },
157
- "active": {
158
- "type": "BOOLEAN",
159
- "notNull": false,
160
- "unique": false,
161
- "default": true
162
108
  }
163
109
  },
164
110
  "indexes": [
@@ -169,127 +115,128 @@
169
115
  ]
170
116
  },
171
117
  {
172
- "name": "inventory_locations_code_tenant_id_idx",
118
+ "name": "inventory_locations_slug_context_idx",
173
119
  "columns": [
174
- "code",
175
- "tenant_id"
120
+ "slug",
121
+ "context"
176
122
  ],
177
123
  "unique": true
178
124
  }
179
125
  ],
180
- "version": "401c28a1"
126
+ "version": "a8cccfa5"
181
127
  }
182
128
  },
183
- "@happyvertical/smrt-inventory:StockLevel": {
184
- "name": "stocklevel",
185
- "className": "StockLevel",
186
- "qualifiedName": "@happyvertical/smrt-inventory:StockLevel",
129
+ "@happyvertical/smrt-inventory:StockLevelCollection": {
130
+ "name": "stocklevelcollection",
131
+ "className": "StockLevelCollection",
132
+ "qualifiedName": "@happyvertical/smrt-inventory:StockLevelCollection",
187
133
  "collection": "stocklevels",
188
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/StockLevel.ts",
134
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts",
189
135
  "packageName": "@happyvertical/smrt-inventory",
190
- "fields": {
191
- "tenantId": {
192
- "type": "text",
193
- "required": false,
194
- "_meta": {
195
- "sqlType": "UUID",
196
- "nullable": true,
197
- "__tenancy": {
198
- "isTenantIdField": true,
199
- "autoFilter": true,
200
- "required": false,
201
- "autoPopulate": true,
202
- "nullable": true,
203
- "mode": "optional",
204
- "field": "tenantId",
205
- "allowSuperAdminBypass": false
136
+ "fields": {},
137
+ "methods": {
138
+ "getLevel": {
139
+ "name": "getLevel",
140
+ "async": true,
141
+ "parameters": [
142
+ {
143
+ "name": "skuId",
144
+ "type": "string",
145
+ "optional": false
146
+ },
147
+ {
148
+ "name": "locationId",
149
+ "type": "string",
150
+ "optional": false
151
+ },
152
+ {
153
+ "name": "state",
154
+ "type": "StockState",
155
+ "optional": true,
156
+ "default": "available"
206
157
  }
207
- }
208
- },
209
- "skuId": {
210
- "type": "text",
211
- "required": true,
212
- "default": "",
213
- "_meta": {
214
- "required": true
215
- }
158
+ ],
159
+ "returnType": "Promise<StockLevel | null>",
160
+ "isStatic": false,
161
+ "isPublic": true
216
162
  },
217
- "locationId": {
218
- "type": "text",
219
- "required": true,
220
- "default": "",
221
- "_meta": {
222
- "required": true
223
- }
163
+ "findBySku": {
164
+ "name": "findBySku",
165
+ "async": true,
166
+ "parameters": [
167
+ {
168
+ "name": "skuId",
169
+ "type": "string",
170
+ "optional": false
171
+ }
172
+ ],
173
+ "returnType": "Promise<StockLevel[]>",
174
+ "isStatic": false,
175
+ "isPublic": true
224
176
  },
225
- "state": {
226
- "type": "text",
227
- "required": true,
228
- "default": "available",
229
- "_meta": {
230
- "required": true
231
- }
177
+ "findByLocation": {
178
+ "name": "findByLocation",
179
+ "async": true,
180
+ "parameters": [
181
+ {
182
+ "name": "locationId",
183
+ "type": "string",
184
+ "optional": false
185
+ }
186
+ ],
187
+ "returnType": "Promise<StockLevel[]>",
188
+ "isStatic": false,
189
+ "isPublic": true
232
190
  },
233
- "qty": {
234
- "type": "decimal",
235
- "required": false,
236
- "_meta": {}
191
+ "totalForSku": {
192
+ "name": "totalForSku",
193
+ "async": true,
194
+ "parameters": [
195
+ {
196
+ "name": "skuId",
197
+ "type": "string",
198
+ "optional": false
199
+ },
200
+ {
201
+ "name": "state",
202
+ "type": "StockState",
203
+ "optional": true
204
+ }
205
+ ],
206
+ "returnType": "Promise<number>",
207
+ "isStatic": false,
208
+ "isPublic": true
209
+ },
210
+ "totalForLocation": {
211
+ "name": "totalForLocation",
212
+ "async": true,
213
+ "parameters": [
214
+ {
215
+ "name": "locationId",
216
+ "type": "string",
217
+ "optional": false
218
+ },
219
+ {
220
+ "name": "state",
221
+ "type": "StockState",
222
+ "optional": true
223
+ }
224
+ ],
225
+ "returnType": "Promise<number>",
226
+ "isStatic": false,
227
+ "isPublic": true
237
228
  }
238
229
  },
239
- "methods": {},
240
230
  "decoratorConfig": {
241
- "tableName": "inventory_stock_levels",
242
- "conflictColumns": [
243
- "sku_id",
244
- "location_id",
245
- "state",
246
- "tenant_id"
247
- ],
248
- "api": {
249
- "include": [
250
- "list",
251
- "get"
252
- ]
253
- },
254
- "mcp": {
255
- "include": [
256
- "list",
257
- "get"
258
- ]
259
- },
260
- "cli": {
261
- "include": [
262
- "list",
263
- "get"
264
- ]
265
- },
266
- "tenantScoped": {
267
- "mode": "optional"
268
- }
231
+ "tableName": "inventory_stock_levels"
269
232
  },
270
- "extends": "SmrtObject",
271
- "exportName": "StockLevel",
272
- "collectionExportName": "StockLevelCollection",
273
- "validationRules": [
274
- {
275
- "field": "skuId",
276
- "rule": "required",
277
- "fieldType": "text"
278
- },
279
- {
280
- "field": "locationId",
281
- "rule": "required",
282
- "fieldType": "text"
283
- },
284
- {
285
- "field": "state",
286
- "rule": "required",
287
- "fieldType": "text"
288
- }
289
- ],
233
+ "extends": "SmrtCollection",
234
+ "extendsTypeArg": "StockLevel",
235
+ "exportName": "StockLevelCollection",
236
+ "collectionExportName": "StockLevelCollectionCollection",
290
237
  "schema": {
291
238
  "tableName": "inventory_stock_levels",
292
- "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_levels\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"sku_id\" TEXT NOT NULL DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"state\" TEXT NOT NULL DEFAULT 'available',\n \"qty\" REAL\n);",
239
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_levels\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
293
240
  "columns": {
294
241
  "id": {
295
242
  "type": "UUID",
@@ -315,35 +262,6 @@
315
262
  "type": "TIMESTAMP",
316
263
  "notNull": true,
317
264
  "default": "current_timestamp"
318
- },
319
- "tenant_id": {
320
- "type": "UUID",
321
- "referenceKind": "tenantId",
322
- "notNull": false,
323
- "unique": false
324
- },
325
- "sku_id": {
326
- "type": "TEXT",
327
- "notNull": true,
328
- "unique": false,
329
- "default": ""
330
- },
331
- "location_id": {
332
- "type": "TEXT",
333
- "notNull": true,
334
- "unique": false,
335
- "default": ""
336
- },
337
- "state": {
338
- "type": "TEXT",
339
- "notNull": true,
340
- "unique": false,
341
- "default": "available"
342
- },
343
- "qty": {
344
- "type": "REAL",
345
- "notNull": false,
346
- "unique": false
347
265
  }
348
266
  },
349
267
  "indexes": [
@@ -354,112 +272,212 @@
354
272
  ]
355
273
  },
356
274
  {
357
- "name": "inventory_stock_levels_sku_id_location_id_idx",
275
+ "name": "inventory_stock_levels_slug_context_idx",
358
276
  "columns": [
359
- "sku_id",
360
- "location_id",
361
- "state",
362
- "tenant_id"
277
+ "slug",
278
+ "context"
363
279
  ],
364
280
  "unique": true
365
281
  }
366
282
  ],
367
- "version": "7b08362b"
283
+ "version": "d858b8a5"
368
284
  }
369
285
  },
370
- "@happyvertical/smrt-inventory:StockMovement": {
371
- "name": "stockmovement",
372
- "className": "StockMovement",
373
- "qualifiedName": "@happyvertical/smrt-inventory:StockMovement",
286
+ "@happyvertical/smrt-inventory:StockMovementCollection": {
287
+ "name": "stockmovementcollection",
288
+ "className": "StockMovementCollection",
289
+ "qualifiedName": "@happyvertical/smrt-inventory:StockMovementCollection",
374
290
  "collection": "stockmovements",
375
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/StockMovement.ts",
291
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts",
376
292
  "packageName": "@happyvertical/smrt-inventory",
377
- "fields": {
378
- "tenantId": {
379
- "type": "text",
380
- "required": false,
381
- "_meta": {
382
- "sqlType": "UUID",
383
- "nullable": true,
384
- "__tenancy": {
385
- "isTenantIdField": true,
386
- "autoFilter": true,
387
- "required": false,
388
- "autoPopulate": true,
389
- "nullable": true,
390
- "mode": "optional",
391
- "field": "tenantId",
392
- "allowSuperAdminBypass": false
293
+ "fields": {},
294
+ "methods": {
295
+ "findBySku": {
296
+ "name": "findBySku",
297
+ "async": true,
298
+ "parameters": [
299
+ {
300
+ "name": "skuId",
301
+ "type": "string",
302
+ "optional": false
393
303
  }
394
- }
304
+ ],
305
+ "returnType": "Promise<StockMovement[]>",
306
+ "isStatic": false,
307
+ "isPublic": true
395
308
  },
396
- "skuId": {
397
- "type": "text",
398
- "required": true,
399
- "default": "",
400
- "_meta": {
401
- "required": true
402
- }
309
+ "findByLocation": {
310
+ "name": "findByLocation",
311
+ "async": true,
312
+ "parameters": [
313
+ {
314
+ "name": "locationId",
315
+ "type": "string",
316
+ "optional": false
317
+ }
318
+ ],
319
+ "returnType": "Promise<StockMovement[]>",
320
+ "isStatic": false,
321
+ "isPublic": true
403
322
  },
404
- "locationId": {
405
- "type": "text",
406
- "required": true,
407
- "default": "",
408
- "_meta": {
409
- "required": true
410
- }
323
+ "findBySource": {
324
+ "name": "findBySource",
325
+ "async": true,
326
+ "parameters": [
327
+ {
328
+ "name": "sourceType",
329
+ "type": "string",
330
+ "optional": false
331
+ },
332
+ {
333
+ "name": "sourceId",
334
+ "type": "string",
335
+ "optional": false
336
+ }
337
+ ],
338
+ "returnType": "Promise<StockMovement[]>",
339
+ "isStatic": false,
340
+ "isPublic": true
411
341
  },
412
- "fromState": {
413
- "type": "text",
414
- "required": false
342
+ "findByReason": {
343
+ "name": "findByReason",
344
+ "async": true,
345
+ "parameters": [
346
+ {
347
+ "name": "reasonCode",
348
+ "type": "StockMovementReason",
349
+ "optional": false
350
+ }
351
+ ],
352
+ "returnType": "Promise<StockMovement[]>",
353
+ "isStatic": false,
354
+ "isPublic": true
355
+ }
356
+ },
357
+ "decoratorConfig": {
358
+ "tableName": "inventory_stock_movements"
359
+ },
360
+ "extends": "SmrtCollection",
361
+ "extendsTypeArg": "StockMovement",
362
+ "exportName": "StockMovementCollection",
363
+ "collectionExportName": "StockMovementCollectionCollection",
364
+ "schema": {
365
+ "tableName": "inventory_stock_movements",
366
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_movements\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
367
+ "columns": {
368
+ "id": {
369
+ "type": "UUID",
370
+ "primaryKey": true,
371
+ "referenceKind": "id",
372
+ "notNull": true
373
+ },
374
+ "slug": {
375
+ "type": "TEXT",
376
+ "notNull": true
377
+ },
378
+ "context": {
379
+ "type": "TEXT",
380
+ "notNull": true,
381
+ "default": ""
382
+ },
383
+ "created_at": {
384
+ "type": "TIMESTAMP",
385
+ "notNull": true,
386
+ "default": "current_timestamp"
387
+ },
388
+ "updated_at": {
389
+ "type": "TIMESTAMP",
390
+ "notNull": true,
391
+ "default": "current_timestamp"
392
+ }
415
393
  },
416
- "toState": {
394
+ "indexes": [
395
+ {
396
+ "name": "inventory_stock_movements_id_idx",
397
+ "columns": [
398
+ "id"
399
+ ]
400
+ },
401
+ {
402
+ "name": "inventory_stock_movements_slug_context_idx",
403
+ "columns": [
404
+ "slug",
405
+ "context"
406
+ ],
407
+ "unique": true
408
+ }
409
+ ],
410
+ "version": "54d9d8f6"
411
+ }
412
+ },
413
+ "@happyvertical/smrt-inventory:InventoryLocation": {
414
+ "name": "inventorylocation",
415
+ "className": "InventoryLocation",
416
+ "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocation",
417
+ "collection": "inventorylocations",
418
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts",
419
+ "packageName": "@happyvertical/smrt-inventory",
420
+ "fields": {
421
+ "tenantId": {
417
422
  "type": "text",
418
- "required": false
419
- },
420
- "qty": {
421
- "type": "decimal",
422
423
  "required": false,
423
- "_meta": {}
424
+ "_meta": {
425
+ "sqlType": "UUID",
426
+ "nullable": true,
427
+ "__tenancy": {
428
+ "isTenantIdField": true,
429
+ "autoFilter": true,
430
+ "required": false,
431
+ "autoPopulate": true,
432
+ "nullable": true,
433
+ "mode": "optional",
434
+ "field": "tenantId",
435
+ "allowSuperAdminBypass": false
436
+ }
437
+ }
424
438
  },
425
- "reasonCode": {
439
+ "code": {
426
440
  "type": "text",
427
441
  "required": true,
428
- "default": "adjustment",
442
+ "default": "",
429
443
  "_meta": {
430
444
  "required": true
431
445
  }
432
446
  },
433
- "sourceType": {
447
+ "name": {
434
448
  "type": "text",
435
449
  "required": false,
436
450
  "default": ""
437
451
  },
438
- "sourceId": {
452
+ "kind": {
439
453
  "type": "text",
440
454
  "required": false,
441
- "default": ""
455
+ "default": "warehouse"
442
456
  },
443
- "note": {
457
+ "placeId": {
444
458
  "type": "text",
445
459
  "required": false,
446
460
  "default": ""
447
461
  },
448
- "occurredAt": {
449
- "type": "datetime",
450
- "required": false
462
+ "active": {
463
+ "type": "boolean",
464
+ "required": false,
465
+ "default": true
451
466
  }
452
467
  },
453
468
  "methods": {},
454
469
  "decoratorConfig": {
455
- "tableName": "inventory_stock_movements",
470
+ "tableName": "inventory_locations",
456
471
  "conflictColumns": [
457
- "id"
472
+ "code",
473
+ "tenant_id"
458
474
  ],
459
475
  "api": {
460
476
  "include": [
461
477
  "list",
462
- "get"
478
+ "get",
479
+ "create",
480
+ "update"
463
481
  ]
464
482
  },
465
483
  "mcp": {
@@ -468,39 +486,24 @@
468
486
  "get"
469
487
  ]
470
488
  },
471
- "cli": {
472
- "include": [
473
- "list",
474
- "get"
475
- ]
476
- },
489
+ "cli": true,
477
490
  "tenantScoped": {
478
491
  "mode": "optional"
479
492
  }
480
493
  },
481
494
  "extends": "SmrtObject",
482
- "exportName": "StockMovement",
483
- "collectionExportName": "StockMovementCollection",
495
+ "exportName": "InventoryLocation",
496
+ "collectionExportName": "InventoryLocationCollection",
484
497
  "validationRules": [
485
498
  {
486
- "field": "skuId",
487
- "rule": "required",
488
- "fieldType": "text"
489
- },
490
- {
491
- "field": "locationId",
492
- "rule": "required",
493
- "fieldType": "text"
494
- },
495
- {
496
- "field": "reasonCode",
499
+ "field": "code",
497
500
  "rule": "required",
498
501
  "fieldType": "text"
499
502
  }
500
503
  ],
501
504
  "schema": {
502
- "tableName": "inventory_stock_movements",
503
- "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_movements\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"sku_id\" TEXT NOT NULL DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"from_state\" TEXT,\n \"to_state\" TEXT,\n \"qty\" REAL,\n \"reason_code\" TEXT NOT NULL DEFAULT 'adjustment',\n \"source_type\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"note\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP\n);",
505
+ "tableName": "inventory_locations",
506
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_locations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"code\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"kind\" TEXT DEFAULT 'warehouse',\n \"place_id\" TEXT DEFAULT '',\n \"active\" BOOLEAN DEFAULT TRUE\n);",
504
507
  "columns": {
505
508
  "id": {
506
509
  "type": "UUID",
@@ -533,157 +536,166 @@
533
536
  "notNull": false,
534
537
  "unique": false
535
538
  },
536
- "sku_id": {
537
- "type": "TEXT",
538
- "notNull": true,
539
- "unique": false,
540
- "default": ""
541
- },
542
- "location_id": {
539
+ "code": {
543
540
  "type": "TEXT",
544
541
  "notNull": true,
545
542
  "unique": false,
546
543
  "default": ""
547
544
  },
548
- "from_state": {
549
- "type": "TEXT",
550
- "notNull": false,
551
- "unique": false
552
- },
553
- "to_state": {
554
- "type": "TEXT",
555
- "notNull": false,
556
- "unique": false
557
- },
558
- "qty": {
559
- "type": "REAL",
560
- "notNull": false,
561
- "unique": false
562
- },
563
- "reason_code": {
564
- "type": "TEXT",
565
- "notNull": true,
566
- "unique": false,
567
- "default": "adjustment"
568
- },
569
- "source_type": {
545
+ "name": {
570
546
  "type": "TEXT",
571
547
  "notNull": false,
572
548
  "unique": false,
573
549
  "default": ""
574
550
  },
575
- "source_id": {
551
+ "kind": {
576
552
  "type": "TEXT",
577
553
  "notNull": false,
578
554
  "unique": false,
579
- "default": ""
555
+ "default": "warehouse"
580
556
  },
581
- "note": {
557
+ "place_id": {
582
558
  "type": "TEXT",
583
559
  "notNull": false,
584
560
  "unique": false,
585
561
  "default": ""
586
562
  },
587
- "occurred_at": {
588
- "type": "TIMESTAMP",
563
+ "active": {
564
+ "type": "BOOLEAN",
589
565
  "notNull": false,
590
- "unique": false
566
+ "unique": false,
567
+ "default": true
591
568
  }
592
569
  },
593
570
  "indexes": [
594
571
  {
595
- "name": "inventory_stock_movements_id_idx",
572
+ "name": "inventory_locations_id_idx",
596
573
  "columns": [
597
574
  "id"
598
575
  ]
599
576
  },
600
577
  {
601
- "name": "inventory_stock_movements_id_idx",
578
+ "name": "inventory_locations_code_tenant_id_idx",
602
579
  "columns": [
603
- "id"
580
+ "code",
581
+ "tenant_id"
604
582
  ],
605
583
  "unique": true
606
584
  }
607
585
  ],
608
- "version": "3c5a0445"
586
+ "version": "401c28a1"
609
587
  }
610
588
  },
611
- "@happyvertical/smrt-inventory:InventoryLocationCollection": {
612
- "name": "inventorylocationcollection",
613
- "className": "InventoryLocationCollection",
614
- "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocationCollection",
615
- "collection": "inventorylocations",
616
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/InventoryLocationCollection.ts",
589
+ "@happyvertical/smrt-inventory:StockLevel": {
590
+ "name": "stocklevel",
591
+ "className": "StockLevel",
592
+ "qualifiedName": "@happyvertical/smrt-inventory:StockLevel",
593
+ "collection": "stocklevels",
594
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/StockLevel.ts",
617
595
  "packageName": "@happyvertical/smrt-inventory",
618
- "fields": {},
619
- "methods": {
620
- "findByCode": {
621
- "name": "findByCode",
622
- "async": true,
623
- "parameters": [
624
- {
625
- "name": "code",
626
- "type": "string",
627
- "optional": false
596
+ "fields": {
597
+ "tenantId": {
598
+ "type": "text",
599
+ "required": false,
600
+ "_meta": {
601
+ "sqlType": "UUID",
602
+ "nullable": true,
603
+ "__tenancy": {
604
+ "isTenantIdField": true,
605
+ "autoFilter": true,
606
+ "required": false,
607
+ "autoPopulate": true,
608
+ "nullable": true,
609
+ "mode": "optional",
610
+ "field": "tenantId",
611
+ "allowSuperAdminBypass": false
628
612
  }
629
- ],
630
- "returnType": "Promise<InventoryLocation | null>",
631
- "isStatic": false,
632
- "isPublic": true
613
+ }
633
614
  },
634
- "findByKind": {
635
- "name": "findByKind",
636
- "async": true,
637
- "parameters": [
638
- {
639
- "name": "kind",
640
- "type": "InventoryLocationKind",
641
- "optional": false
642
- }
643
- ],
644
- "returnType": "Promise<InventoryLocation[]>",
645
- "isStatic": false,
646
- "isPublic": true
615
+ "skuId": {
616
+ "type": "text",
617
+ "required": true,
618
+ "default": "",
619
+ "_meta": {
620
+ "required": true
621
+ }
647
622
  },
648
- "findByPlace": {
649
- "name": "findByPlace",
650
- "async": true,
651
- "parameters": [
652
- {
653
- "name": "placeId",
654
- "type": "string",
655
- "optional": false
656
- }
657
- ],
658
- "returnType": "Promise<InventoryLocation[]>",
659
- "isStatic": false,
660
- "isPublic": true
623
+ "locationId": {
624
+ "type": "text",
625
+ "required": true,
626
+ "default": "",
627
+ "_meta": {
628
+ "required": true
629
+ }
661
630
  },
662
- "findActive": {
663
- "name": "findActive",
664
- "async": true,
665
- "parameters": [
666
- {
667
- "name": "kind",
668
- "type": "InventoryLocationKind",
669
- "optional": true
670
- }
671
- ],
672
- "returnType": "Promise<InventoryLocation[]>",
673
- "isStatic": false,
674
- "isPublic": true
631
+ "state": {
632
+ "type": "text",
633
+ "required": true,
634
+ "default": "available",
635
+ "_meta": {
636
+ "required": true
637
+ }
638
+ },
639
+ "qty": {
640
+ "type": "decimal",
641
+ "required": false,
642
+ "_meta": {}
675
643
  }
676
644
  },
645
+ "methods": {},
677
646
  "decoratorConfig": {
678
- "tableName": "inventory_locations"
647
+ "tableName": "inventory_stock_levels",
648
+ "conflictColumns": [
649
+ "sku_id",
650
+ "location_id",
651
+ "state",
652
+ "tenant_id"
653
+ ],
654
+ "api": {
655
+ "include": [
656
+ "list",
657
+ "get"
658
+ ]
659
+ },
660
+ "mcp": {
661
+ "include": [
662
+ "list",
663
+ "get"
664
+ ]
665
+ },
666
+ "cli": {
667
+ "include": [
668
+ "list",
669
+ "get"
670
+ ]
671
+ },
672
+ "tenantScoped": {
673
+ "mode": "optional"
674
+ }
679
675
  },
680
- "extends": "SmrtCollection",
681
- "extendsTypeArg": "InventoryLocation",
682
- "exportName": "InventoryLocationCollection",
683
- "collectionExportName": "InventoryLocationCollectionCollection",
676
+ "extends": "SmrtObject",
677
+ "exportName": "StockLevel",
678
+ "collectionExportName": "StockLevelCollection",
679
+ "validationRules": [
680
+ {
681
+ "field": "skuId",
682
+ "rule": "required",
683
+ "fieldType": "text"
684
+ },
685
+ {
686
+ "field": "locationId",
687
+ "rule": "required",
688
+ "fieldType": "text"
689
+ },
690
+ {
691
+ "field": "state",
692
+ "rule": "required",
693
+ "fieldType": "text"
694
+ }
695
+ ],
684
696
  "schema": {
685
- "tableName": "inventory_locations",
686
- "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_locations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
697
+ "tableName": "inventory_stock_levels",
698
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_levels\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"sku_id\" TEXT NOT NULL DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"state\" TEXT NOT NULL DEFAULT 'available',\n \"qty\" REAL\n);",
687
699
  "columns": {
688
700
  "id": {
689
701
  "type": "UUID",
@@ -709,138 +721,192 @@
709
721
  "type": "TIMESTAMP",
710
722
  "notNull": true,
711
723
  "default": "current_timestamp"
724
+ },
725
+ "tenant_id": {
726
+ "type": "UUID",
727
+ "referenceKind": "tenantId",
728
+ "notNull": false,
729
+ "unique": false
730
+ },
731
+ "sku_id": {
732
+ "type": "TEXT",
733
+ "notNull": true,
734
+ "unique": false,
735
+ "default": ""
736
+ },
737
+ "location_id": {
738
+ "type": "TEXT",
739
+ "notNull": true,
740
+ "unique": false,
741
+ "default": ""
742
+ },
743
+ "state": {
744
+ "type": "TEXT",
745
+ "notNull": true,
746
+ "unique": false,
747
+ "default": "available"
748
+ },
749
+ "qty": {
750
+ "type": "REAL",
751
+ "notNull": false,
752
+ "unique": false
712
753
  }
713
754
  },
714
755
  "indexes": [
715
756
  {
716
- "name": "inventory_locations_id_idx",
757
+ "name": "inventory_stock_levels_id_idx",
717
758
  "columns": [
718
759
  "id"
719
760
  ]
720
761
  },
721
762
  {
722
- "name": "inventory_locations_slug_context_idx",
763
+ "name": "inventory_stock_levels_sku_id_location_id_idx",
723
764
  "columns": [
724
- "slug",
725
- "context"
765
+ "sku_id",
766
+ "location_id",
767
+ "state",
768
+ "tenant_id"
726
769
  ],
727
770
  "unique": true
728
771
  }
729
772
  ],
730
- "version": "a8cccfa5"
773
+ "version": "7b08362b"
731
774
  }
732
775
  },
733
- "@happyvertical/smrt-inventory:StockLevelCollection": {
734
- "name": "stocklevelcollection",
735
- "className": "StockLevelCollection",
736
- "qualifiedName": "@happyvertical/smrt-inventory:StockLevelCollection",
737
- "collection": "stocklevels",
738
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts",
776
+ "@happyvertical/smrt-inventory:StockMovement": {
777
+ "name": "stockmovement",
778
+ "className": "StockMovement",
779
+ "qualifiedName": "@happyvertical/smrt-inventory:StockMovement",
780
+ "collection": "stockmovements",
781
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/StockMovement.ts",
739
782
  "packageName": "@happyvertical/smrt-inventory",
740
- "fields": {},
741
- "methods": {
742
- "getLevel": {
743
- "name": "getLevel",
744
- "async": true,
745
- "parameters": [
746
- {
747
- "name": "skuId",
748
- "type": "string",
749
- "optional": false
750
- },
751
- {
752
- "name": "locationId",
753
- "type": "string",
754
- "optional": false
755
- },
756
- {
757
- "name": "state",
758
- "type": "StockState",
759
- "optional": true,
760
- "default": "available"
783
+ "fields": {
784
+ "tenantId": {
785
+ "type": "text",
786
+ "required": false,
787
+ "_meta": {
788
+ "sqlType": "UUID",
789
+ "nullable": true,
790
+ "__tenancy": {
791
+ "isTenantIdField": true,
792
+ "autoFilter": true,
793
+ "required": false,
794
+ "autoPopulate": true,
795
+ "nullable": true,
796
+ "mode": "optional",
797
+ "field": "tenantId",
798
+ "allowSuperAdminBypass": false
761
799
  }
762
- ],
763
- "returnType": "Promise<StockLevel | null>",
764
- "isStatic": false,
765
- "isPublic": true
800
+ }
766
801
  },
767
- "findBySku": {
768
- "name": "findBySku",
769
- "async": true,
770
- "parameters": [
771
- {
772
- "name": "skuId",
773
- "type": "string",
774
- "optional": false
775
- }
776
- ],
777
- "returnType": "Promise<StockLevel[]>",
778
- "isStatic": false,
779
- "isPublic": true
802
+ "skuId": {
803
+ "type": "text",
804
+ "required": true,
805
+ "default": "",
806
+ "_meta": {
807
+ "required": true
808
+ }
780
809
  },
781
- "findByLocation": {
782
- "name": "findByLocation",
783
- "async": true,
784
- "parameters": [
785
- {
786
- "name": "locationId",
787
- "type": "string",
788
- "optional": false
789
- }
790
- ],
791
- "returnType": "Promise<StockLevel[]>",
792
- "isStatic": false,
793
- "isPublic": true
810
+ "locationId": {
811
+ "type": "text",
812
+ "required": true,
813
+ "default": "",
814
+ "_meta": {
815
+ "required": true
816
+ }
794
817
  },
795
- "totalForSku": {
796
- "name": "totalForSku",
797
- "async": true,
798
- "parameters": [
799
- {
800
- "name": "skuId",
801
- "type": "string",
802
- "optional": false
803
- },
804
- {
805
- "name": "state",
806
- "type": "StockState",
807
- "optional": true
808
- }
809
- ],
810
- "returnType": "Promise<number>",
811
- "isStatic": false,
812
- "isPublic": true
818
+ "fromState": {
819
+ "type": "text",
820
+ "required": false
821
+ },
822
+ "toState": {
823
+ "type": "text",
824
+ "required": false
825
+ },
826
+ "qty": {
827
+ "type": "decimal",
828
+ "required": false,
829
+ "_meta": {}
830
+ },
831
+ "reasonCode": {
832
+ "type": "text",
833
+ "required": true,
834
+ "default": "adjustment",
835
+ "_meta": {
836
+ "required": true
837
+ }
838
+ },
839
+ "sourceType": {
840
+ "type": "text",
841
+ "required": false,
842
+ "default": ""
843
+ },
844
+ "sourceId": {
845
+ "type": "text",
846
+ "required": false,
847
+ "default": ""
813
848
  },
814
- "totalForLocation": {
815
- "name": "totalForLocation",
816
- "async": true,
817
- "parameters": [
818
- {
819
- "name": "locationId",
820
- "type": "string",
821
- "optional": false
822
- },
823
- {
824
- "name": "state",
825
- "type": "StockState",
826
- "optional": true
827
- }
828
- ],
829
- "returnType": "Promise<number>",
830
- "isStatic": false,
831
- "isPublic": true
849
+ "note": {
850
+ "type": "text",
851
+ "required": false,
852
+ "default": ""
853
+ },
854
+ "occurredAt": {
855
+ "type": "datetime",
856
+ "required": false
832
857
  }
833
858
  },
859
+ "methods": {},
834
860
  "decoratorConfig": {
835
- "tableName": "inventory_stock_levels"
861
+ "tableName": "inventory_stock_movements",
862
+ "conflictColumns": [
863
+ "id"
864
+ ],
865
+ "api": {
866
+ "include": [
867
+ "list",
868
+ "get"
869
+ ]
870
+ },
871
+ "mcp": {
872
+ "include": [
873
+ "list",
874
+ "get"
875
+ ]
876
+ },
877
+ "cli": {
878
+ "include": [
879
+ "list",
880
+ "get"
881
+ ]
882
+ },
883
+ "tenantScoped": {
884
+ "mode": "optional"
885
+ }
836
886
  },
837
- "extends": "SmrtCollection",
838
- "extendsTypeArg": "StockLevel",
839
- "exportName": "StockLevelCollection",
840
- "collectionExportName": "StockLevelCollectionCollection",
887
+ "extends": "SmrtObject",
888
+ "exportName": "StockMovement",
889
+ "collectionExportName": "StockMovementCollection",
890
+ "validationRules": [
891
+ {
892
+ "field": "skuId",
893
+ "rule": "required",
894
+ "fieldType": "text"
895
+ },
896
+ {
897
+ "field": "locationId",
898
+ "rule": "required",
899
+ "fieldType": "text"
900
+ },
901
+ {
902
+ "field": "reasonCode",
903
+ "rule": "required",
904
+ "fieldType": "text"
905
+ }
906
+ ],
841
907
  "schema": {
842
- "tableName": "inventory_stock_levels",
843
- "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_levels\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
908
+ "tableName": "inventory_stock_movements",
909
+ "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_movements\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"sku_id\" TEXT NOT NULL DEFAULT '',\n \"location_id\" TEXT NOT NULL DEFAULT '',\n \"from_state\" TEXT,\n \"to_state\" TEXT,\n \"qty\" REAL,\n \"reason_code\" TEXT NOT NULL DEFAULT 'adjustment',\n \"source_type\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"note\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP\n);",
844
910
  "columns": {
845
911
  "id": {
846
912
  "type": "UUID",
@@ -866,133 +932,68 @@
866
932
  "type": "TIMESTAMP",
867
933
  "notNull": true,
868
934
  "default": "current_timestamp"
869
- }
870
- },
871
- "indexes": [
872
- {
873
- "name": "inventory_stock_levels_id_idx",
874
- "columns": [
875
- "id"
876
- ]
877
935
  },
878
- {
879
- "name": "inventory_stock_levels_slug_context_idx",
880
- "columns": [
881
- "slug",
882
- "context"
883
- ],
884
- "unique": true
885
- }
886
- ],
887
- "version": "d858b8a5"
888
- }
889
- },
890
- "@happyvertical/smrt-inventory:StockMovementCollection": {
891
- "name": "stockmovementcollection",
892
- "className": "StockMovementCollection",
893
- "qualifiedName": "@happyvertical/smrt-inventory:StockMovementCollection",
894
- "collection": "stockmovements",
895
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts",
896
- "packageName": "@happyvertical/smrt-inventory",
897
- "fields": {},
898
- "methods": {
899
- "findBySku": {
900
- "name": "findBySku",
901
- "async": true,
902
- "parameters": [
903
- {
904
- "name": "skuId",
905
- "type": "string",
906
- "optional": false
907
- }
908
- ],
909
- "returnType": "Promise<StockMovement[]>",
910
- "isStatic": false,
911
- "isPublic": true
912
- },
913
- "findByLocation": {
914
- "name": "findByLocation",
915
- "async": true,
916
- "parameters": [
917
- {
918
- "name": "locationId",
919
- "type": "string",
920
- "optional": false
921
- }
922
- ],
923
- "returnType": "Promise<StockMovement[]>",
924
- "isStatic": false,
925
- "isPublic": true
926
- },
927
- "findBySource": {
928
- "name": "findBySource",
929
- "async": true,
930
- "parameters": [
931
- {
932
- "name": "sourceType",
933
- "type": "string",
934
- "optional": false
935
- },
936
- {
937
- "name": "sourceId",
938
- "type": "string",
939
- "optional": false
940
- }
941
- ],
942
- "returnType": "Promise<StockMovement[]>",
943
- "isStatic": false,
944
- "isPublic": true
945
- },
946
- "findByReason": {
947
- "name": "findByReason",
948
- "async": true,
949
- "parameters": [
950
- {
951
- "name": "reasonCode",
952
- "type": "StockMovementReason",
953
- "optional": false
954
- }
955
- ],
956
- "returnType": "Promise<StockMovement[]>",
957
- "isStatic": false,
958
- "isPublic": true
959
- }
960
- },
961
- "decoratorConfig": {
962
- "tableName": "inventory_stock_movements"
963
- },
964
- "extends": "SmrtCollection",
965
- "extendsTypeArg": "StockMovement",
966
- "exportName": "StockMovementCollection",
967
- "collectionExportName": "StockMovementCollectionCollection",
968
- "schema": {
969
- "tableName": "inventory_stock_movements",
970
- "ddl": "CREATE TABLE IF NOT EXISTS \"inventory_stock_movements\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
971
- "columns": {
972
- "id": {
936
+ "tenant_id": {
973
937
  "type": "UUID",
974
- "primaryKey": true,
975
- "referenceKind": "id",
976
- "notNull": true
938
+ "referenceKind": "tenantId",
939
+ "notNull": false,
940
+ "unique": false
977
941
  },
978
- "slug": {
942
+ "sku_id": {
979
943
  "type": "TEXT",
980
- "notNull": true
944
+ "notNull": true,
945
+ "unique": false,
946
+ "default": ""
981
947
  },
982
- "context": {
948
+ "location_id": {
983
949
  "type": "TEXT",
984
950
  "notNull": true,
951
+ "unique": false,
985
952
  "default": ""
986
953
  },
987
- "created_at": {
988
- "type": "TIMESTAMP",
954
+ "from_state": {
955
+ "type": "TEXT",
956
+ "notNull": false,
957
+ "unique": false
958
+ },
959
+ "to_state": {
960
+ "type": "TEXT",
961
+ "notNull": false,
962
+ "unique": false
963
+ },
964
+ "qty": {
965
+ "type": "REAL",
966
+ "notNull": false,
967
+ "unique": false
968
+ },
969
+ "reason_code": {
970
+ "type": "TEXT",
989
971
  "notNull": true,
990
- "default": "current_timestamp"
972
+ "unique": false,
973
+ "default": "adjustment"
991
974
  },
992
- "updated_at": {
975
+ "source_type": {
976
+ "type": "TEXT",
977
+ "notNull": false,
978
+ "unique": false,
979
+ "default": ""
980
+ },
981
+ "source_id": {
982
+ "type": "TEXT",
983
+ "notNull": false,
984
+ "unique": false,
985
+ "default": ""
986
+ },
987
+ "note": {
988
+ "type": "TEXT",
989
+ "notNull": false,
990
+ "unique": false,
991
+ "default": ""
992
+ },
993
+ "occurred_at": {
993
994
  "type": "TIMESTAMP",
994
- "notNull": true,
995
- "default": "current_timestamp"
995
+ "notNull": false,
996
+ "unique": false
996
997
  }
997
998
  },
998
999
  "indexes": [
@@ -1003,15 +1004,14 @@
1003
1004
  ]
1004
1005
  },
1005
1006
  {
1006
- "name": "inventory_stock_movements_slug_context_idx",
1007
+ "name": "inventory_stock_movements_id_idx",
1007
1008
  "columns": [
1008
- "slug",
1009
- "context"
1009
+ "id"
1010
1010
  ],
1011
1011
  "unique": true
1012
1012
  }
1013
1013
  ],
1014
- "version": "54d9d8f6"
1014
+ "version": "3c5a0445"
1015
1015
  }
1016
1016
  }
1017
1017
  },