@happyvertical/smrt-inventory 0.40.21 → 0.40.23

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,85 +1,103 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "timestamp": 1785008659814,
3
+ "timestamp": 1785027413620,
4
4
  "packageName": "@happyvertical/smrt-inventory",
5
- "packageVersion": "0.40.21",
5
+ "packageVersion": "0.40.23",
6
6
  "objects": {
7
- "@happyvertical/smrt-inventory:InventoryLocationCollection": {
8
- "name": "inventorylocationcollection",
9
- "className": "InventoryLocationCollection",
10
- "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocationCollection",
7
+ "@happyvertical/smrt-inventory:InventoryLocation": {
8
+ "name": "inventorylocation",
9
+ "className": "InventoryLocation",
10
+ "qualifiedName": "@happyvertical/smrt-inventory:InventoryLocation",
11
11
  "collection": "inventorylocations",
12
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/InventoryLocationCollection.ts",
12
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/InventoryLocation.ts",
13
13
  "packageName": "@happyvertical/smrt-inventory",
14
- "fields": {},
15
- "methods": {
16
- "findByCode": {
17
- "name": "findByCode",
18
- "async": true,
19
- "parameters": [
20
- {
21
- "name": "code",
22
- "type": "string",
23
- "optional": false
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
24
30
  }
25
- ],
26
- "returnType": "Promise<InventoryLocation | null>",
27
- "isStatic": false,
28
- "isPublic": true
31
+ }
29
32
  },
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
33
+ "code": {
34
+ "type": "text",
35
+ "required": true,
36
+ "default": "",
37
+ "_meta": {
38
+ "required": true
39
+ }
43
40
  },
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
41
+ "name": {
42
+ "type": "text",
43
+ "required": false,
44
+ "default": ""
57
45
  },
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
46
+ "kind": {
47
+ "type": "text",
48
+ "required": false,
49
+ "default": "warehouse"
50
+ },
51
+ "placeId": {
52
+ "type": "text",
53
+ "required": false,
54
+ "default": ""
55
+ },
56
+ "active": {
57
+ "type": "boolean",
58
+ "required": false,
59
+ "default": true
71
60
  }
72
61
  },
62
+ "methods": {},
73
63
  "decoratorConfig": {
74
- "tableName": "inventory_locations"
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
+ }
75
87
  },
76
- "extends": "SmrtCollection",
77
- "extendsTypeArg": "InventoryLocation",
78
- "exportName": "InventoryLocationCollection",
79
- "collectionExportName": "InventoryLocationCollectionCollection",
88
+ "extends": "SmrtObject",
89
+ "exportName": "InventoryLocation",
90
+ "collectionExportName": "InventoryLocationCollection",
91
+ "validationRules": [
92
+ {
93
+ "field": "code",
94
+ "rule": "required",
95
+ "fieldType": "text"
96
+ }
97
+ ],
80
98
  "schema": {
81
99
  "tableName": "inventory_locations",
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);",
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);",
83
101
  "columns": {
84
102
  "id": {
85
103
  "type": "UUID",
@@ -105,6 +123,42 @@
105
123
  "type": "TIMESTAMP",
106
124
  "notNull": true,
107
125
  "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
108
162
  }
109
163
  },
110
164
  "indexes": [
@@ -115,128 +169,127 @@
115
169
  ]
116
170
  },
117
171
  {
118
- "name": "inventory_locations_slug_context_idx",
172
+ "name": "inventory_locations_code_tenant_id_idx",
119
173
  "columns": [
120
- "slug",
121
- "context"
174
+ "code",
175
+ "tenant_id"
122
176
  ],
123
177
  "unique": true
124
178
  }
125
179
  ],
126
- "version": "a8cccfa5"
180
+ "version": "401c28a1"
127
181
  }
128
182
  },
129
- "@happyvertical/smrt-inventory:StockLevelCollection": {
130
- "name": "stocklevelcollection",
131
- "className": "StockLevelCollection",
132
- "qualifiedName": "@happyvertical/smrt-inventory:StockLevelCollection",
183
+ "@happyvertical/smrt-inventory:StockLevel": {
184
+ "name": "stocklevel",
185
+ "className": "StockLevel",
186
+ "qualifiedName": "@happyvertical/smrt-inventory:StockLevel",
133
187
  "collection": "stocklevels",
134
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/StockLevelCollection.ts",
188
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/StockLevel.ts",
135
189
  "packageName": "@happyvertical/smrt-inventory",
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"
157
- }
158
- ],
159
- "returnType": "Promise<StockLevel | null>",
160
- "isStatic": false,
161
- "isPublic": true
162
- },
163
- "findBySku": {
164
- "name": "findBySku",
165
- "async": true,
166
- "parameters": [
167
- {
168
- "name": "skuId",
169
- "type": "string",
170
- "optional": false
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
171
206
  }
172
- ],
173
- "returnType": "Promise<StockLevel[]>",
174
- "isStatic": false,
175
- "isPublic": true
207
+ }
176
208
  },
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
209
+ "skuId": {
210
+ "type": "text",
211
+ "required": true,
212
+ "default": "",
213
+ "_meta": {
214
+ "required": true
215
+ }
190
216
  },
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
217
+ "locationId": {
218
+ "type": "text",
219
+ "required": true,
220
+ "default": "",
221
+ "_meta": {
222
+ "required": true
223
+ }
209
224
  },
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
225
+ "state": {
226
+ "type": "text",
227
+ "required": true,
228
+ "default": "available",
229
+ "_meta": {
230
+ "required": true
231
+ }
232
+ },
233
+ "qty": {
234
+ "type": "decimal",
235
+ "required": false,
236
+ "_meta": {}
228
237
  }
229
238
  },
239
+ "methods": {},
230
240
  "decoratorConfig": {
231
- "tableName": "inventory_stock_levels"
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
+ }
232
269
  },
233
- "extends": "SmrtCollection",
234
- "extendsTypeArg": "StockLevel",
235
- "exportName": "StockLevelCollection",
236
- "collectionExportName": "StockLevelCollectionCollection",
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
+ ],
237
290
  "schema": {
238
291
  "tableName": "inventory_stock_levels",
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);",
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);",
240
293
  "columns": {
241
294
  "id": {
242
295
  "type": "UUID",
@@ -262,6 +315,35 @@
262
315
  "type": "TIMESTAMP",
263
316
  "notNull": true,
264
317
  "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
265
347
  }
266
348
  },
267
349
  "indexes": [
@@ -272,212 +354,112 @@
272
354
  ]
273
355
  },
274
356
  {
275
- "name": "inventory_stock_levels_slug_context_idx",
357
+ "name": "inventory_stock_levels_sku_id_location_id_idx",
276
358
  "columns": [
277
- "slug",
278
- "context"
359
+ "sku_id",
360
+ "location_id",
361
+ "state",
362
+ "tenant_id"
279
363
  ],
280
364
  "unique": true
281
365
  }
282
366
  ],
283
- "version": "d858b8a5"
367
+ "version": "7b08362b"
284
368
  }
285
369
  },
286
- "@happyvertical/smrt-inventory:StockMovementCollection": {
287
- "name": "stockmovementcollection",
288
- "className": "StockMovementCollection",
289
- "qualifiedName": "@happyvertical/smrt-inventory:StockMovementCollection",
370
+ "@happyvertical/smrt-inventory:StockMovement": {
371
+ "name": "stockmovement",
372
+ "className": "StockMovement",
373
+ "qualifiedName": "@happyvertical/smrt-inventory:StockMovement",
290
374
  "collection": "stockmovements",
291
- "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/collections/StockMovementCollection.ts",
375
+ "filePath": "/home/runner/_work/smrt/smrt/packages/inventory/src/models/StockMovement.ts",
292
376
  "packageName": "@happyvertical/smrt-inventory",
293
- "fields": {},
294
- "methods": {
295
- "findBySku": {
296
- "name": "findBySku",
297
- "async": true,
298
- "parameters": [
299
- {
300
- "name": "skuId",
301
- "type": "string",
302
- "optional": false
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
303
393
  }
304
- ],
305
- "returnType": "Promise<StockMovement[]>",
306
- "isStatic": false,
307
- "isPublic": true
394
+ }
308
395
  },
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
396
+ "skuId": {
397
+ "type": "text",
398
+ "required": true,
399
+ "default": "",
400
+ "_meta": {
401
+ "required": true
402
+ }
322
403
  },
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
404
+ "locationId": {
405
+ "type": "text",
406
+ "required": true,
407
+ "default": "",
408
+ "_meta": {
409
+ "required": true
410
+ }
341
411
  },
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
- }
412
+ "fromState": {
413
+ "type": "text",
414
+ "required": false
393
415
  },
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": {
416
+ "toState": {
422
417
  "type": "text",
418
+ "required": false
419
+ },
420
+ "qty": {
421
+ "type": "decimal",
423
422
  "required": false,
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
- }
423
+ "_meta": {}
438
424
  },
439
- "code": {
425
+ "reasonCode": {
440
426
  "type": "text",
441
427
  "required": true,
442
- "default": "",
428
+ "default": "adjustment",
443
429
  "_meta": {
444
430
  "required": true
445
431
  }
446
432
  },
447
- "name": {
433
+ "sourceType": {
448
434
  "type": "text",
449
435
  "required": false,
450
436
  "default": ""
451
437
  },
452
- "kind": {
438
+ "sourceId": {
453
439
  "type": "text",
454
440
  "required": false,
455
- "default": "warehouse"
441
+ "default": ""
456
442
  },
457
- "placeId": {
443
+ "note": {
458
444
  "type": "text",
459
445
  "required": false,
460
446
  "default": ""
461
447
  },
462
- "active": {
463
- "type": "boolean",
464
- "required": false,
465
- "default": true
448
+ "occurredAt": {
449
+ "type": "datetime",
450
+ "required": false
466
451
  }
467
452
  },
468
453
  "methods": {},
469
454
  "decoratorConfig": {
470
- "tableName": "inventory_locations",
455
+ "tableName": "inventory_stock_movements",
471
456
  "conflictColumns": [
472
- "code",
473
- "tenant_id"
457
+ "id"
474
458
  ],
475
459
  "api": {
476
460
  "include": [
477
461
  "list",
478
- "get",
479
- "create",
480
- "update"
462
+ "get"
481
463
  ]
482
464
  },
483
465
  "mcp": {
@@ -486,24 +468,39 @@
486
468
  "get"
487
469
  ]
488
470
  },
489
- "cli": true,
471
+ "cli": {
472
+ "include": [
473
+ "list",
474
+ "get"
475
+ ]
476
+ },
490
477
  "tenantScoped": {
491
478
  "mode": "optional"
492
479
  }
493
480
  },
494
481
  "extends": "SmrtObject",
495
- "exportName": "InventoryLocation",
496
- "collectionExportName": "InventoryLocationCollection",
482
+ "exportName": "StockMovement",
483
+ "collectionExportName": "StockMovementCollection",
497
484
  "validationRules": [
498
485
  {
499
- "field": "code",
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",
500
497
  "rule": "required",
501
498
  "fieldType": "text"
502
499
  }
503
500
  ],
504
501
  "schema": {
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);",
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);",
507
504
  "columns": {
508
505
  "id": {
509
506
  "type": "UUID",
@@ -536,166 +533,157 @@
536
533
  "notNull": false,
537
534
  "unique": false
538
535
  },
539
- "code": {
536
+ "sku_id": {
540
537
  "type": "TEXT",
541
538
  "notNull": true,
542
539
  "unique": false,
543
540
  "default": ""
544
541
  },
545
- "name": {
542
+ "location_id": {
546
543
  "type": "TEXT",
547
- "notNull": false,
544
+ "notNull": true,
548
545
  "unique": false,
549
546
  "default": ""
550
547
  },
551
- "kind": {
548
+ "from_state": {
549
+ "type": "TEXT",
550
+ "notNull": false,
551
+ "unique": false
552
+ },
553
+ "to_state": {
552
554
  "type": "TEXT",
553
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,
554
566
  "unique": false,
555
- "default": "warehouse"
567
+ "default": "adjustment"
556
568
  },
557
- "place_id": {
569
+ "source_type": {
558
570
  "type": "TEXT",
559
571
  "notNull": false,
560
572
  "unique": false,
561
573
  "default": ""
562
574
  },
563
- "active": {
564
- "type": "BOOLEAN",
575
+ "source_id": {
576
+ "type": "TEXT",
565
577
  "notNull": false,
566
578
  "unique": false,
567
- "default": true
579
+ "default": ""
580
+ },
581
+ "note": {
582
+ "type": "TEXT",
583
+ "notNull": false,
584
+ "unique": false,
585
+ "default": ""
586
+ },
587
+ "occurred_at": {
588
+ "type": "TIMESTAMP",
589
+ "notNull": false,
590
+ "unique": false
568
591
  }
569
592
  },
570
593
  "indexes": [
571
594
  {
572
- "name": "inventory_locations_id_idx",
595
+ "name": "inventory_stock_movements_id_idx",
573
596
  "columns": [
574
597
  "id"
575
598
  ]
576
599
  },
577
600
  {
578
- "name": "inventory_locations_code_tenant_id_idx",
601
+ "name": "inventory_stock_movements_id_idx",
579
602
  "columns": [
580
- "code",
581
- "tenant_id"
603
+ "id"
582
604
  ],
583
605
  "unique": true
584
606
  }
585
607
  ],
586
- "version": "401c28a1"
608
+ "version": "3c5a0445"
587
609
  }
588
610
  },
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",
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",
595
617
  "packageName": "@happyvertical/smrt-inventory",
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
618
+ "fields": {},
619
+ "methods": {
620
+ "findByCode": {
621
+ "name": "findByCode",
622
+ "async": true,
623
+ "parameters": [
624
+ {
625
+ "name": "code",
626
+ "type": "string",
627
+ "optional": false
612
628
  }
613
- }
629
+ ],
630
+ "returnType": "Promise<InventoryLocation | null>",
631
+ "isStatic": false,
632
+ "isPublic": true
614
633
  },
615
- "skuId": {
616
- "type": "text",
617
- "required": true,
618
- "default": "",
619
- "_meta": {
620
- "required": true
621
- }
622
- },
623
- "locationId": {
624
- "type": "text",
625
- "required": true,
626
- "default": "",
627
- "_meta": {
628
- "required": true
629
- }
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
630
647
  },
631
- "state": {
632
- "type": "text",
633
- "required": true,
634
- "default": "available",
635
- "_meta": {
636
- "required": true
637
- }
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
638
661
  },
639
- "qty": {
640
- "type": "decimal",
641
- "required": false,
642
- "_meta": {}
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
643
675
  }
644
676
  },
645
- "methods": {},
646
677
  "decoratorConfig": {
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
- }
678
+ "tableName": "inventory_locations"
675
679
  },
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
- ],
680
+ "extends": "SmrtCollection",
681
+ "extendsTypeArg": "InventoryLocation",
682
+ "exportName": "InventoryLocationCollection",
683
+ "collectionExportName": "InventoryLocationCollectionCollection",
696
684
  "schema": {
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);",
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);",
699
687
  "columns": {
700
688
  "id": {
701
689
  "type": "UUID",
@@ -721,192 +709,138 @@
721
709
  "type": "TIMESTAMP",
722
710
  "notNull": true,
723
711
  "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
753
712
  }
754
713
  },
755
714
  "indexes": [
756
715
  {
757
- "name": "inventory_stock_levels_id_idx",
716
+ "name": "inventory_locations_id_idx",
758
717
  "columns": [
759
718
  "id"
760
719
  ]
761
720
  },
762
721
  {
763
- "name": "inventory_stock_levels_sku_id_location_id_idx",
722
+ "name": "inventory_locations_slug_context_idx",
764
723
  "columns": [
765
- "sku_id",
766
- "location_id",
767
- "state",
768
- "tenant_id"
724
+ "slug",
725
+ "context"
769
726
  ],
770
727
  "unique": true
771
728
  }
772
729
  ],
773
- "version": "7b08362b"
730
+ "version": "a8cccfa5"
774
731
  }
775
732
  },
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",
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",
782
739
  "packageName": "@happyvertical/smrt-inventory",
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
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"
799
761
  }
800
- }
801
- },
802
- "skuId": {
803
- "type": "text",
804
- "required": true,
805
- "default": "",
806
- "_meta": {
807
- "required": true
808
- }
809
- },
810
- "locationId": {
811
- "type": "text",
812
- "required": true,
813
- "default": "",
814
- "_meta": {
815
- "required": true
816
- }
817
- },
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
- }
762
+ ],
763
+ "returnType": "Promise<StockLevel | null>",
764
+ "isStatic": false,
765
+ "isPublic": true
838
766
  },
839
- "sourceType": {
840
- "type": "text",
841
- "required": false,
842
- "default": ""
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
843
780
  },
844
- "sourceId": {
845
- "type": "text",
846
- "required": false,
847
- "default": ""
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
848
794
  },
849
- "note": {
850
- "type": "text",
851
- "required": false,
852
- "default": ""
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
853
813
  },
854
- "occurredAt": {
855
- "type": "datetime",
856
- "required": false
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
857
832
  }
858
833
  },
859
- "methods": {},
860
834
  "decoratorConfig": {
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
- }
835
+ "tableName": "inventory_stock_levels"
886
836
  },
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
- ],
837
+ "extends": "SmrtCollection",
838
+ "extendsTypeArg": "StockLevel",
839
+ "exportName": "StockLevelCollection",
840
+ "collectionExportName": "StockLevelCollectionCollection",
907
841
  "schema": {
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);",
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);",
910
844
  "columns": {
911
845
  "id": {
912
846
  "type": "UUID",
@@ -932,68 +866,133 @@
932
866
  "type": "TIMESTAMP",
933
867
  "notNull": true,
934
868
  "default": "current_timestamp"
869
+ }
870
+ },
871
+ "indexes": [
872
+ {
873
+ "name": "inventory_stock_levels_id_idx",
874
+ "columns": [
875
+ "id"
876
+ ]
935
877
  },
936
- "tenant_id": {
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": {
937
973
  "type": "UUID",
938
- "referenceKind": "tenantId",
939
- "notNull": false,
940
- "unique": false
974
+ "primaryKey": true,
975
+ "referenceKind": "id",
976
+ "notNull": true
941
977
  },
942
- "sku_id": {
978
+ "slug": {
943
979
  "type": "TEXT",
944
- "notNull": true,
945
- "unique": false,
946
- "default": ""
980
+ "notNull": true
947
981
  },
948
- "location_id": {
982
+ "context": {
949
983
  "type": "TEXT",
950
984
  "notNull": true,
951
- "unique": false,
952
985
  "default": ""
953
986
  },
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",
987
+ "created_at": {
988
+ "type": "TIMESTAMP",
971
989
  "notNull": true,
972
- "unique": false,
973
- "default": "adjustment"
974
- },
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": ""
990
+ "default": "current_timestamp"
992
991
  },
993
- "occurred_at": {
992
+ "updated_at": {
994
993
  "type": "TIMESTAMP",
995
- "notNull": false,
996
- "unique": false
994
+ "notNull": true,
995
+ "default": "current_timestamp"
997
996
  }
998
997
  },
999
998
  "indexes": [
@@ -1004,14 +1003,15 @@
1004
1003
  ]
1005
1004
  },
1006
1005
  {
1007
- "name": "inventory_stock_movements_id_idx",
1006
+ "name": "inventory_stock_movements_slug_context_idx",
1008
1007
  "columns": [
1009
- "id"
1008
+ "slug",
1009
+ "context"
1010
1010
  ],
1011
1011
  "unique": true
1012
1012
  }
1013
1013
  ],
1014
- "version": "3c5a0445"
1014
+ "version": "54d9d8f6"
1015
1015
  }
1016
1016
  }
1017
1017
  },