@managemint-solutions/sdk 0.66.0 → 0.68.0
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/dist/audit/index.d.ts +1 -1
- package/dist/audit/index.js +14 -0
- package/dist/billing/dto.d.ts +8 -0
- package/dist/billing/dto.js +22 -1
- package/dist/client.d.ts +7 -0
- package/dist/client.js +14 -0
- package/dist/documents/content.js +6 -1
- package/dist/documents/document-templates.js +12 -5
- package/dist/documents/documents.d.ts +7 -2
- package/dist/documents/documents.js +4 -0
- package/dist/documents/dto.d.ts +7 -2
- package/dist/documents/dto.js +21 -1
- package/dist/documents/render/html.d.ts +5 -0
- package/dist/documents/render/html.js +10 -3
- package/dist/documents/render/index.d.ts +1 -1
- package/dist/documents/render/index.js +2 -1
- package/dist/documents/render/values.d.ts +4 -1
- package/dist/documents/render/values.js +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +35 -4
- package/dist/inventory/dto.d.ts +134 -0
- package/dist/inventory/dto.js +684 -0
- package/dist/inventory/index.d.ts +7 -0
- package/dist/inventory/index.js +30 -0
- package/dist/inventory/items.d.ts +65 -0
- package/dist/inventory/items.js +216 -0
- package/dist/inventory/levels.d.ts +52 -0
- package/dist/inventory/levels.js +157 -0
- package/dist/inventory/locations.d.ts +29 -0
- package/dist/inventory/locations.js +158 -0
- package/dist/inventory/movements.d.ts +36 -0
- package/dist/inventory/movements.js +103 -0
- package/dist/inventory/stocktakes.d.ts +36 -0
- package/dist/inventory/stocktakes.js +70 -0
- package/dist/inventory/transfers.d.ts +73 -0
- package/dist/inventory/transfers.js +134 -0
- package/dist/organizations/dto.d.ts +3 -1
- package/dist/organizations/dto.js +12 -0
- package/dist/organizations/index.js +3 -0
- package/dist/permissions/dto.d.ts +4 -0
- package/dist/permissions/dto.js +20 -0
- package/dist/service-client/index.d.ts +12 -0
- package/dist/service-client/index.js +20 -0
- package/dist/users/paths.d.ts +5 -6
- package/dist/users/paths.js +12 -12
- package/package.json +2 -2
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ReceiveInventoryTransferDto = exports.UpdateInventoryTransferDto = exports.CreateInventoryTransferDto = exports.CreateInventoryTransferLineDto = exports.InventoryTransferIdDto = exports.GetInventoryTransfersDto = exports.InventoryStocktakeIdDto = exports.GetInventoryStocktakesDto = exports.CountInventoryDto = exports.CountInventoryLineDto = exports.CreateInventoryMovementDto = exports.GetInventoryMovementsDto = exports.UpdateInventoryLevelDto = exports.InventoryLevelKeyDto = exports.ImportInventoryItemsDto = exports.ImportInventoryItemDto = exports.UpdateInventoryItemDto = exports.CreateInventoryItemDto = exports.InventoryItemFieldsDto = exports.InventoryItemIdDto = exports.StaffGetInventoryItemsDto = exports.GetInventoryItemsDto = exports.SuggestAddressesDto = exports.GeocodeAddressDto = exports.UpdateInventoryLocationDto = exports.CreateInventoryLocationDto = exports.InventoryLocationIdDto = exports.GetInventoryLocationsDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const enum_1 = require("@managemint-solutions/entities/inventory/enum");
|
|
16
|
+
const validators_1 = require("../validators");
|
|
17
|
+
// class-validator versions of the shared DTO types from @managemint-solutions/entities, so the
|
|
18
|
+
// wire contract cannot drift. Quantities are numbers with up to three decimals (the columns are
|
|
19
|
+
// numeric(14, 3)); money is whole minor units. Every value rule lives here or in the api's
|
|
20
|
+
// InventoryService - the tables carry no check constraints.
|
|
21
|
+
/** The most of anything one movement, line or count may carry: past it the figure is a typo. */
|
|
22
|
+
const MAX_QUANTITY = 1_000_000_000;
|
|
23
|
+
/** One transfer or one count names at most this many items. */
|
|
24
|
+
const MAX_LINES = 500;
|
|
25
|
+
const toBoolean = ({ value }) => value === 'true' ? true : value === 'false' ? false : value;
|
|
26
|
+
// ---- Locations ----
|
|
27
|
+
class GetInventoryLocationsDto {
|
|
28
|
+
archive = false;
|
|
29
|
+
}
|
|
30
|
+
exports.GetInventoryLocationsDto = GetInventoryLocationsDto;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
|
+
(0, validators_1.IsNullable)(),
|
|
34
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? value === 'true' : false), { toClassOnly: true }),
|
|
35
|
+
(0, class_validator_1.IsBoolean)({ message: 'Include archived must be a boolean' }),
|
|
36
|
+
__metadata("design:type", Boolean)
|
|
37
|
+
], GetInventoryLocationsDto.prototype, "archive", void 0);
|
|
38
|
+
class InventoryLocationIdDto {
|
|
39
|
+
locationId;
|
|
40
|
+
}
|
|
41
|
+
exports.InventoryLocationIdDto = InventoryLocationIdDto;
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid location ID format' }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], InventoryLocationIdDto.prototype, "locationId", void 0);
|
|
46
|
+
class CreateInventoryLocationDto {
|
|
47
|
+
name;
|
|
48
|
+
kind;
|
|
49
|
+
address;
|
|
50
|
+
// Both or neither: a point needs two coordinates, and the api refuses one without the other.
|
|
51
|
+
latitude;
|
|
52
|
+
longitude;
|
|
53
|
+
is_default;
|
|
54
|
+
}
|
|
55
|
+
exports.CreateInventoryLocationDto = CreateInventoryLocationDto;
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, validators_1.Trim)(),
|
|
58
|
+
(0, class_validator_1.IsString)({ message: 'Invalid name' }),
|
|
59
|
+
(0, class_validator_1.MinLength)(1, { message: 'Name cannot be empty' }),
|
|
60
|
+
(0, class_validator_1.MaxLength)(100, { message: 'Name cannot exceed 100 characters' }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], CreateInventoryLocationDto.prototype, "name", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_validator_1.IsEnum)(enum_1.InventoryLocationKind, { message: 'Invalid location kind' }),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], CreateInventoryLocationDto.prototype, "kind", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, class_validator_1.IsOptional)(),
|
|
69
|
+
(0, validators_1.Trim)(),
|
|
70
|
+
(0, validators_1.EmptyToNull)(),
|
|
71
|
+
(0, validators_1.IsNullable)(),
|
|
72
|
+
(0, class_validator_1.IsString)({ message: 'Invalid address' }),
|
|
73
|
+
(0, class_validator_1.MaxLength)(500, { message: 'Address cannot exceed 500 characters' }),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], CreateInventoryLocationDto.prototype, "address", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, class_validator_1.IsOptional)(),
|
|
78
|
+
(0, validators_1.IsNullable)(),
|
|
79
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 6 }, { message: 'Latitude must be a number with at most 6 decimals' }),
|
|
80
|
+
(0, class_validator_1.Min)(-90, { message: 'Latitude must be between -90 and 90' }),
|
|
81
|
+
(0, class_validator_1.Max)(90, { message: 'Latitude must be between -90 and 90' }),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], CreateInventoryLocationDto.prototype, "latitude", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, class_validator_1.IsOptional)(),
|
|
86
|
+
(0, validators_1.IsNullable)(),
|
|
87
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 6 }, { message: 'Longitude must be a number with at most 6 decimals' }),
|
|
88
|
+
(0, class_validator_1.Min)(-180, { message: 'Longitude must be between -180 and 180' }),
|
|
89
|
+
(0, class_validator_1.Max)(180, { message: 'Longitude must be between -180 and 180' }),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], CreateInventoryLocationDto.prototype, "longitude", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, class_validator_1.IsOptional)(),
|
|
94
|
+
(0, class_validator_1.IsBoolean)({ message: 'Default must be a boolean' }),
|
|
95
|
+
__metadata("design:type", Boolean)
|
|
96
|
+
], CreateInventoryLocationDto.prototype, "is_default", void 0);
|
|
97
|
+
class UpdateInventoryLocationDto extends CreateInventoryLocationDto {
|
|
98
|
+
}
|
|
99
|
+
exports.UpdateInventoryLocationDto = UpdateInventoryLocationDto;
|
|
100
|
+
// One of the two: a suggestion's place id when one was picked, else the typed address.
|
|
101
|
+
class GeocodeAddressDto {
|
|
102
|
+
address;
|
|
103
|
+
place_id;
|
|
104
|
+
}
|
|
105
|
+
exports.GeocodeAddressDto = GeocodeAddressDto;
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, class_validator_1.ValidateIf)((dto) => !dto.place_id),
|
|
108
|
+
(0, validators_1.Trim)(),
|
|
109
|
+
(0, class_validator_1.IsString)({ message: 'Invalid address' }),
|
|
110
|
+
(0, class_validator_1.MinLength)(3, { message: 'Type the address first' }),
|
|
111
|
+
(0, class_validator_1.MaxLength)(500, { message: 'Address cannot exceed 500 characters' }),
|
|
112
|
+
__metadata("design:type", Object)
|
|
113
|
+
], GeocodeAddressDto.prototype, "address", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, class_validator_1.ValidateIf)((dto) => !dto.address),
|
|
116
|
+
(0, class_validator_1.IsString)({ message: 'Invalid place' }),
|
|
117
|
+
(0, class_validator_1.MinLength)(1, { message: 'Invalid place' }),
|
|
118
|
+
(0, class_validator_1.MaxLength)(300, { message: 'Invalid place' }),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], GeocodeAddressDto.prototype, "place_id", void 0);
|
|
121
|
+
class SuggestAddressesDto {
|
|
122
|
+
query;
|
|
123
|
+
}
|
|
124
|
+
exports.SuggestAddressesDto = SuggestAddressesDto;
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, validators_1.Trim)(),
|
|
127
|
+
(0, class_validator_1.IsString)({ message: 'Invalid address' }),
|
|
128
|
+
(0, class_validator_1.MinLength)(3, { message: 'Type at least three characters' }),
|
|
129
|
+
(0, class_validator_1.MaxLength)(200, { message: 'Address cannot exceed 200 characters' }),
|
|
130
|
+
__metadata("design:type", String)
|
|
131
|
+
], SuggestAddressesDto.prototype, "query", void 0);
|
|
132
|
+
// ---- Items ----
|
|
133
|
+
class GetInventoryItemsDto {
|
|
134
|
+
search;
|
|
135
|
+
page = 1;
|
|
136
|
+
page_size = 10;
|
|
137
|
+
archive = false;
|
|
138
|
+
group_name;
|
|
139
|
+
location_id;
|
|
140
|
+
below_reorder;
|
|
141
|
+
}
|
|
142
|
+
exports.GetInventoryItemsDto = GetInventoryItemsDto;
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, class_validator_1.IsOptional)(),
|
|
145
|
+
(0, validators_1.IsNullable)(),
|
|
146
|
+
(0, class_validator_1.IsString)({ message: 'Search query must be a string' }),
|
|
147
|
+
(0, class_validator_1.MinLength)(1, { message: 'Search query cannot be empty' }),
|
|
148
|
+
(0, class_validator_1.MaxLength)(255, { message: 'Search query cannot exceed 255 characters' }),
|
|
149
|
+
__metadata("design:type", Object)
|
|
150
|
+
], GetInventoryItemsDto.prototype, "search", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, class_validator_1.IsOptional)(),
|
|
153
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 1), { toClassOnly: true }),
|
|
154
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page must be a number' }),
|
|
155
|
+
(0, class_validator_1.Min)(1, { message: 'Page must be at least 1' }),
|
|
156
|
+
__metadata("design:type", Number)
|
|
157
|
+
], GetInventoryItemsDto.prototype, "page", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, class_validator_1.IsOptional)(),
|
|
160
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 10), { toClassOnly: true }),
|
|
161
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page size must be a number' }),
|
|
162
|
+
(0, class_validator_1.Min)(1, { message: 'Page size must be at least 1' }),
|
|
163
|
+
(0, class_validator_1.Max)(100, { message: 'Page size cannot exceed 100' }),
|
|
164
|
+
__metadata("design:type", Number)
|
|
165
|
+
], GetInventoryItemsDto.prototype, "page_size", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, class_validator_1.IsOptional)(),
|
|
168
|
+
(0, validators_1.IsNullable)(),
|
|
169
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? value === 'true' : false), { toClassOnly: true }),
|
|
170
|
+
(0, class_validator_1.IsBoolean)({ message: 'Include archived must be a boolean' }),
|
|
171
|
+
__metadata("design:type", Boolean)
|
|
172
|
+
], GetInventoryItemsDto.prototype, "archive", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
(0, class_validator_1.IsOptional)(),
|
|
175
|
+
(0, validators_1.IsNullable)(),
|
|
176
|
+
(0, class_validator_1.IsString)({ message: 'Group must be a string' }),
|
|
177
|
+
(0, class_validator_1.MaxLength)(100, { message: 'Group cannot exceed 100 characters' }),
|
|
178
|
+
__metadata("design:type", Object)
|
|
179
|
+
], GetInventoryItemsDto.prototype, "group_name", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, class_validator_1.IsOptional)(),
|
|
182
|
+
(0, validators_1.IsNullable)(),
|
|
183
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid location ID format' }),
|
|
184
|
+
__metadata("design:type", Object)
|
|
185
|
+
], GetInventoryItemsDto.prototype, "location_id", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
(0, class_validator_1.IsOptional)(),
|
|
188
|
+
(0, validators_1.IsNullable)(),
|
|
189
|
+
(0, class_transformer_1.Transform)(toBoolean, { toClassOnly: true }),
|
|
190
|
+
(0, class_validator_1.IsBoolean)({ message: 'Below reorder must be true or false' }),
|
|
191
|
+
__metadata("design:type", Object)
|
|
192
|
+
], GetInventoryItemsDto.prototype, "below_reorder", void 0);
|
|
193
|
+
/** A staff read across organizations, optionally narrowed to one of them. */
|
|
194
|
+
class StaffGetInventoryItemsDto extends GetInventoryItemsDto {
|
|
195
|
+
organization_id;
|
|
196
|
+
}
|
|
197
|
+
exports.StaffGetInventoryItemsDto = StaffGetInventoryItemsDto;
|
|
198
|
+
__decorate([
|
|
199
|
+
(0, class_validator_1.IsOptional)(),
|
|
200
|
+
(0, validators_1.IsNullable)(),
|
|
201
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid organization ID format' }),
|
|
202
|
+
__metadata("design:type", Object)
|
|
203
|
+
], StaffGetInventoryItemsDto.prototype, "organization_id", void 0);
|
|
204
|
+
class InventoryItemIdDto {
|
|
205
|
+
itemId;
|
|
206
|
+
}
|
|
207
|
+
exports.InventoryItemIdDto = InventoryItemIdDto;
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid item ID format' }),
|
|
210
|
+
__metadata("design:type", String)
|
|
211
|
+
], InventoryItemIdDto.prototype, "itemId", void 0);
|
|
212
|
+
class InventoryItemFieldsDto {
|
|
213
|
+
name;
|
|
214
|
+
sku;
|
|
215
|
+
description;
|
|
216
|
+
group_name;
|
|
217
|
+
cost_minor;
|
|
218
|
+
price_minor;
|
|
219
|
+
track_stock;
|
|
220
|
+
}
|
|
221
|
+
exports.InventoryItemFieldsDto = InventoryItemFieldsDto;
|
|
222
|
+
__decorate([
|
|
223
|
+
(0, validators_1.Trim)(),
|
|
224
|
+
(0, class_validator_1.IsString)({ message: 'Invalid name' }),
|
|
225
|
+
(0, class_validator_1.MinLength)(1, { message: 'Name cannot be empty' }),
|
|
226
|
+
(0, class_validator_1.MaxLength)(150, { message: 'Name cannot exceed 150 characters' }),
|
|
227
|
+
__metadata("design:type", String)
|
|
228
|
+
], InventoryItemFieldsDto.prototype, "name", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
(0, class_validator_1.IsOptional)(),
|
|
231
|
+
(0, validators_1.Trim)(),
|
|
232
|
+
(0, validators_1.EmptyToNull)(),
|
|
233
|
+
(0, validators_1.IsNullable)(),
|
|
234
|
+
(0, class_validator_1.IsString)({ message: 'Invalid SKU' }),
|
|
235
|
+
(0, class_validator_1.MaxLength)(60, { message: 'SKU cannot exceed 60 characters' }),
|
|
236
|
+
__metadata("design:type", Object)
|
|
237
|
+
], InventoryItemFieldsDto.prototype, "sku", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
(0, class_validator_1.IsOptional)(),
|
|
240
|
+
(0, validators_1.Trim)(),
|
|
241
|
+
(0, validators_1.EmptyToNull)(),
|
|
242
|
+
(0, validators_1.IsNullable)(),
|
|
243
|
+
(0, class_validator_1.IsString)({ message: 'Invalid description' }),
|
|
244
|
+
(0, class_validator_1.MaxLength)(2000, { message: 'Description cannot exceed 2000 characters' }),
|
|
245
|
+
__metadata("design:type", Object)
|
|
246
|
+
], InventoryItemFieldsDto.prototype, "description", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
(0, class_validator_1.IsOptional)(),
|
|
249
|
+
(0, validators_1.Trim)(),
|
|
250
|
+
(0, validators_1.EmptyToNull)(),
|
|
251
|
+
(0, validators_1.IsNullable)(),
|
|
252
|
+
(0, class_validator_1.IsString)({ message: 'Invalid group' }),
|
|
253
|
+
(0, class_validator_1.MaxLength)(100, { message: 'Group cannot exceed 100 characters' }),
|
|
254
|
+
__metadata("design:type", Object)
|
|
255
|
+
], InventoryItemFieldsDto.prototype, "group_name", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
(0, class_validator_1.IsOptional)(),
|
|
258
|
+
(0, validators_1.IsNullable)(),
|
|
259
|
+
(0, class_validator_1.IsInt)({ message: 'Cost must be a whole number of minor units' }),
|
|
260
|
+
(0, class_validator_1.Min)(0, { message: 'Cost must be at least 0' }),
|
|
261
|
+
__metadata("design:type", Object)
|
|
262
|
+
], InventoryItemFieldsDto.prototype, "cost_minor", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
(0, class_validator_1.IsOptional)(),
|
|
265
|
+
(0, validators_1.IsNullable)(),
|
|
266
|
+
(0, class_validator_1.IsInt)({ message: 'Price must be a whole number of minor units' }),
|
|
267
|
+
(0, class_validator_1.Min)(0, { message: 'Price must be at least 0' }),
|
|
268
|
+
__metadata("design:type", Object)
|
|
269
|
+
], InventoryItemFieldsDto.prototype, "price_minor", void 0);
|
|
270
|
+
__decorate([
|
|
271
|
+
(0, class_validator_1.IsOptional)(),
|
|
272
|
+
(0, class_validator_1.IsBoolean)({ message: 'Track stock must be a boolean' }),
|
|
273
|
+
__metadata("design:type", Boolean)
|
|
274
|
+
], InventoryItemFieldsDto.prototype, "track_stock", void 0);
|
|
275
|
+
/** A new item with what is already on the shelf: the opening quantity lands at the named location, or the default one. */
|
|
276
|
+
class CreateInventoryItemDto extends InventoryItemFieldsDto {
|
|
277
|
+
opening_quantity;
|
|
278
|
+
location_id;
|
|
279
|
+
}
|
|
280
|
+
exports.CreateInventoryItemDto = CreateInventoryItemDto;
|
|
281
|
+
__decorate([
|
|
282
|
+
(0, class_validator_1.IsOptional)(),
|
|
283
|
+
(0, validators_1.IsNullable)(),
|
|
284
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 3 }, { message: 'Opening quantity must be a number with at most 3 decimals' }),
|
|
285
|
+
(0, class_validator_1.Min)(0, { message: 'Opening quantity must be at least 0' }),
|
|
286
|
+
(0, class_validator_1.Max)(MAX_QUANTITY, { message: 'Opening quantity is too large' }),
|
|
287
|
+
__metadata("design:type", Object)
|
|
288
|
+
], CreateInventoryItemDto.prototype, "opening_quantity", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
(0, class_validator_1.IsOptional)(),
|
|
291
|
+
(0, validators_1.IsNullable)(),
|
|
292
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid location ID format' }),
|
|
293
|
+
__metadata("design:type", Object)
|
|
294
|
+
], CreateInventoryItemDto.prototype, "location_id", void 0);
|
|
295
|
+
class UpdateInventoryItemDto extends InventoryItemFieldsDto {
|
|
296
|
+
}
|
|
297
|
+
exports.UpdateInventoryItemDto = UpdateInventoryItemDto;
|
|
298
|
+
/** One CSV row: the item plus an optional opening quantity at a named location. */
|
|
299
|
+
class ImportInventoryItemDto extends InventoryItemFieldsDto {
|
|
300
|
+
opening_quantity;
|
|
301
|
+
location_name;
|
|
302
|
+
}
|
|
303
|
+
exports.ImportInventoryItemDto = ImportInventoryItemDto;
|
|
304
|
+
__decorate([
|
|
305
|
+
(0, class_validator_1.IsOptional)(),
|
|
306
|
+
(0, validators_1.IsNullable)(),
|
|
307
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 3 }, { message: 'Opening quantity must be a number with at most 3 decimals' }),
|
|
308
|
+
(0, class_validator_1.Min)(0, { message: 'Opening quantity must be at least 0' }),
|
|
309
|
+
(0, class_validator_1.Max)(MAX_QUANTITY, { message: 'Opening quantity is too large' }),
|
|
310
|
+
__metadata("design:type", Object)
|
|
311
|
+
], ImportInventoryItemDto.prototype, "opening_quantity", void 0);
|
|
312
|
+
__decorate([
|
|
313
|
+
(0, class_validator_1.IsOptional)(),
|
|
314
|
+
(0, validators_1.Trim)(),
|
|
315
|
+
(0, validators_1.EmptyToNull)(),
|
|
316
|
+
(0, validators_1.IsNullable)(),
|
|
317
|
+
(0, class_validator_1.IsString)({ message: 'Invalid location name' }),
|
|
318
|
+
(0, class_validator_1.MaxLength)(100, { message: 'Location name cannot exceed 100 characters' }),
|
|
319
|
+
__metadata("design:type", Object)
|
|
320
|
+
], ImportInventoryItemDto.prototype, "location_name", void 0);
|
|
321
|
+
class ImportInventoryItemsDto {
|
|
322
|
+
items;
|
|
323
|
+
}
|
|
324
|
+
exports.ImportInventoryItemsDto = ImportInventoryItemsDto;
|
|
325
|
+
__decorate([
|
|
326
|
+
(0, class_validator_1.IsArray)({ message: 'Items must be a list' }),
|
|
327
|
+
(0, class_validator_1.ArrayMinSize)(1, { message: 'Import at least one item' }),
|
|
328
|
+
(0, class_validator_1.ArrayMaxSize)(MAX_LINES, { message: `An import cannot exceed ${MAX_LINES} items at a time` }),
|
|
329
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
330
|
+
(0, class_transformer_1.Type)(() => ImportInventoryItemDto),
|
|
331
|
+
__metadata("design:type", Array)
|
|
332
|
+
], ImportInventoryItemsDto.prototype, "items", void 0);
|
|
333
|
+
// ---- Levels ----
|
|
334
|
+
class InventoryLevelKeyDto {
|
|
335
|
+
itemId;
|
|
336
|
+
locationId;
|
|
337
|
+
}
|
|
338
|
+
exports.InventoryLevelKeyDto = InventoryLevelKeyDto;
|
|
339
|
+
__decorate([
|
|
340
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid item ID format' }),
|
|
341
|
+
__metadata("design:type", String)
|
|
342
|
+
], InventoryLevelKeyDto.prototype, "itemId", void 0);
|
|
343
|
+
__decorate([
|
|
344
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid location ID format' }),
|
|
345
|
+
__metadata("design:type", String)
|
|
346
|
+
], InventoryLevelKeyDto.prototype, "locationId", void 0);
|
|
347
|
+
class UpdateInventoryLevelDto {
|
|
348
|
+
reorder_point;
|
|
349
|
+
reorder_quantity;
|
|
350
|
+
bin;
|
|
351
|
+
}
|
|
352
|
+
exports.UpdateInventoryLevelDto = UpdateInventoryLevelDto;
|
|
353
|
+
__decorate([
|
|
354
|
+
(0, validators_1.IsNullable)(),
|
|
355
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 3 }, { message: 'Reorder point must be a number with at most 3 decimals' }),
|
|
356
|
+
(0, class_validator_1.Min)(0, { message: 'Reorder point must be at least 0' }),
|
|
357
|
+
(0, class_validator_1.Max)(MAX_QUANTITY, { message: 'Reorder point is too large' }),
|
|
358
|
+
__metadata("design:type", Object)
|
|
359
|
+
], UpdateInventoryLevelDto.prototype, "reorder_point", void 0);
|
|
360
|
+
__decorate([
|
|
361
|
+
(0, validators_1.IsNullable)(),
|
|
362
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 3 }, { message: 'Reorder quantity must be a number with at most 3 decimals' }),
|
|
363
|
+
(0, class_validator_1.Min)(0, { message: 'Reorder quantity must be at least 0' }),
|
|
364
|
+
(0, class_validator_1.Max)(MAX_QUANTITY, { message: 'Reorder quantity is too large' }),
|
|
365
|
+
__metadata("design:type", Object)
|
|
366
|
+
], UpdateInventoryLevelDto.prototype, "reorder_quantity", void 0);
|
|
367
|
+
__decorate([
|
|
368
|
+
(0, class_validator_1.IsOptional)(),
|
|
369
|
+
(0, validators_1.Trim)(),
|
|
370
|
+
(0, validators_1.EmptyToNull)(),
|
|
371
|
+
(0, validators_1.IsNullable)(),
|
|
372
|
+
(0, class_validator_1.IsString)({ message: 'Invalid bin' }),
|
|
373
|
+
(0, class_validator_1.MaxLength)(60, { message: 'Bin cannot exceed 60 characters' }),
|
|
374
|
+
__metadata("design:type", Object)
|
|
375
|
+
], UpdateInventoryLevelDto.prototype, "bin", void 0);
|
|
376
|
+
// ---- Movements ----
|
|
377
|
+
class GetInventoryMovementsDto {
|
|
378
|
+
page = 1;
|
|
379
|
+
page_size = 10;
|
|
380
|
+
item_id;
|
|
381
|
+
location_id;
|
|
382
|
+
type;
|
|
383
|
+
}
|
|
384
|
+
exports.GetInventoryMovementsDto = GetInventoryMovementsDto;
|
|
385
|
+
__decorate([
|
|
386
|
+
(0, class_validator_1.IsOptional)(),
|
|
387
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 1), { toClassOnly: true }),
|
|
388
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page must be a number' }),
|
|
389
|
+
(0, class_validator_1.Min)(1, { message: 'Page must be at least 1' }),
|
|
390
|
+
__metadata("design:type", Number)
|
|
391
|
+
], GetInventoryMovementsDto.prototype, "page", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
(0, class_validator_1.IsOptional)(),
|
|
394
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 10), { toClassOnly: true }),
|
|
395
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page size must be a number' }),
|
|
396
|
+
(0, class_validator_1.Min)(1, { message: 'Page size must be at least 1' }),
|
|
397
|
+
(0, class_validator_1.Max)(100, { message: 'Page size cannot exceed 100' }),
|
|
398
|
+
__metadata("design:type", Number)
|
|
399
|
+
], GetInventoryMovementsDto.prototype, "page_size", void 0);
|
|
400
|
+
__decorate([
|
|
401
|
+
(0, class_validator_1.IsOptional)(),
|
|
402
|
+
(0, validators_1.IsNullable)(),
|
|
403
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid item ID format' }),
|
|
404
|
+
__metadata("design:type", Object)
|
|
405
|
+
], GetInventoryMovementsDto.prototype, "item_id", void 0);
|
|
406
|
+
__decorate([
|
|
407
|
+
(0, class_validator_1.IsOptional)(),
|
|
408
|
+
(0, validators_1.IsNullable)(),
|
|
409
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid location ID format' }),
|
|
410
|
+
__metadata("design:type", Object)
|
|
411
|
+
], GetInventoryMovementsDto.prototype, "location_id", void 0);
|
|
412
|
+
__decorate([
|
|
413
|
+
(0, class_validator_1.IsOptional)(),
|
|
414
|
+
(0, validators_1.IsNullable)(),
|
|
415
|
+
(0, class_validator_1.IsEnum)(enum_1.InventoryMovementType, { message: 'Invalid movement type' }),
|
|
416
|
+
__metadata("design:type", Object)
|
|
417
|
+
], GetInventoryMovementsDto.prototype, "type", void 0);
|
|
418
|
+
class CreateInventoryMovementDto {
|
|
419
|
+
item_id;
|
|
420
|
+
location_id;
|
|
421
|
+
// Only the three a person posts; transfers and counts write the other three themselves.
|
|
422
|
+
type;
|
|
423
|
+
// How much for a receipt or an issue (the service refuses 0 and below), the signed variance
|
|
424
|
+
// for an adjustment (the service refuses 0).
|
|
425
|
+
quantity;
|
|
426
|
+
unit_cost_minor;
|
|
427
|
+
reason;
|
|
428
|
+
supplier;
|
|
429
|
+
supplier_reference;
|
|
430
|
+
notes;
|
|
431
|
+
}
|
|
432
|
+
exports.CreateInventoryMovementDto = CreateInventoryMovementDto;
|
|
433
|
+
__decorate([
|
|
434
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid item ID format' }),
|
|
435
|
+
__metadata("design:type", String)
|
|
436
|
+
], CreateInventoryMovementDto.prototype, "item_id", void 0);
|
|
437
|
+
__decorate([
|
|
438
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid location ID format' }),
|
|
439
|
+
__metadata("design:type", String)
|
|
440
|
+
], CreateInventoryMovementDto.prototype, "location_id", void 0);
|
|
441
|
+
__decorate([
|
|
442
|
+
(0, class_validator_1.IsEnum)(enum_1.MANUAL_MOVEMENT_TYPES.reduce((all, type) => ({ ...all, [type]: type }), {}), {
|
|
443
|
+
message: 'Type must be receipt, issue or adjustment',
|
|
444
|
+
}),
|
|
445
|
+
__metadata("design:type", String)
|
|
446
|
+
], CreateInventoryMovementDto.prototype, "type", void 0);
|
|
447
|
+
__decorate([
|
|
448
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 3 }, { message: 'Quantity must be a number with at most 3 decimals' }),
|
|
449
|
+
(0, class_validator_1.Min)(-MAX_QUANTITY, { message: 'Quantity is too large' }),
|
|
450
|
+
(0, class_validator_1.Max)(MAX_QUANTITY, { message: 'Quantity is too large' }),
|
|
451
|
+
__metadata("design:type", Number)
|
|
452
|
+
], CreateInventoryMovementDto.prototype, "quantity", void 0);
|
|
453
|
+
__decorate([
|
|
454
|
+
(0, class_validator_1.IsOptional)(),
|
|
455
|
+
(0, validators_1.IsNullable)(),
|
|
456
|
+
(0, class_validator_1.IsInt)({ message: 'Unit cost must be a whole number of minor units' }),
|
|
457
|
+
(0, class_validator_1.Min)(0, { message: 'Unit cost must be at least 0' }),
|
|
458
|
+
__metadata("design:type", Object)
|
|
459
|
+
], CreateInventoryMovementDto.prototype, "unit_cost_minor", void 0);
|
|
460
|
+
__decorate([
|
|
461
|
+
(0, class_validator_1.IsOptional)(),
|
|
462
|
+
(0, validators_1.Trim)(),
|
|
463
|
+
(0, validators_1.EmptyToNull)(),
|
|
464
|
+
(0, validators_1.IsNullable)(),
|
|
465
|
+
(0, class_validator_1.IsString)({ message: 'Invalid reason' }),
|
|
466
|
+
(0, class_validator_1.MaxLength)(200, { message: 'Reason cannot exceed 200 characters' }),
|
|
467
|
+
__metadata("design:type", Object)
|
|
468
|
+
], CreateInventoryMovementDto.prototype, "reason", void 0);
|
|
469
|
+
__decorate([
|
|
470
|
+
(0, class_validator_1.IsOptional)(),
|
|
471
|
+
(0, validators_1.Trim)(),
|
|
472
|
+
(0, validators_1.EmptyToNull)(),
|
|
473
|
+
(0, validators_1.IsNullable)(),
|
|
474
|
+
(0, class_validator_1.IsString)({ message: 'Invalid supplier' }),
|
|
475
|
+
(0, class_validator_1.MaxLength)(150, { message: 'Supplier cannot exceed 150 characters' }),
|
|
476
|
+
__metadata("design:type", Object)
|
|
477
|
+
], CreateInventoryMovementDto.prototype, "supplier", void 0);
|
|
478
|
+
__decorate([
|
|
479
|
+
(0, class_validator_1.IsOptional)(),
|
|
480
|
+
(0, validators_1.Trim)(),
|
|
481
|
+
(0, validators_1.EmptyToNull)(),
|
|
482
|
+
(0, validators_1.IsNullable)(),
|
|
483
|
+
(0, class_validator_1.IsString)({ message: 'Invalid supplier reference' }),
|
|
484
|
+
(0, class_validator_1.MaxLength)(100, { message: 'Supplier reference cannot exceed 100 characters' }),
|
|
485
|
+
__metadata("design:type", Object)
|
|
486
|
+
], CreateInventoryMovementDto.prototype, "supplier_reference", void 0);
|
|
487
|
+
__decorate([
|
|
488
|
+
(0, class_validator_1.IsOptional)(),
|
|
489
|
+
(0, validators_1.Trim)(),
|
|
490
|
+
(0, validators_1.EmptyToNull)(),
|
|
491
|
+
(0, validators_1.IsNullable)(),
|
|
492
|
+
(0, class_validator_1.IsString)({ message: 'Invalid notes' }),
|
|
493
|
+
(0, class_validator_1.MaxLength)(1000, { message: 'Notes cannot exceed 1000 characters' }),
|
|
494
|
+
__metadata("design:type", Object)
|
|
495
|
+
], CreateInventoryMovementDto.prototype, "notes", void 0);
|
|
496
|
+
class CountInventoryLineDto {
|
|
497
|
+
item_id;
|
|
498
|
+
counted;
|
|
499
|
+
reason;
|
|
500
|
+
}
|
|
501
|
+
exports.CountInventoryLineDto = CountInventoryLineDto;
|
|
502
|
+
__decorate([
|
|
503
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid item ID format' }),
|
|
504
|
+
__metadata("design:type", String)
|
|
505
|
+
], CountInventoryLineDto.prototype, "item_id", void 0);
|
|
506
|
+
__decorate([
|
|
507
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 3 }, { message: 'Counted must be a number with at most 3 decimals' }),
|
|
508
|
+
(0, class_validator_1.Min)(0, { message: 'Counted must be at least 0' }),
|
|
509
|
+
(0, class_validator_1.Max)(MAX_QUANTITY, { message: 'Counted is too large' }),
|
|
510
|
+
__metadata("design:type", Number)
|
|
511
|
+
], CountInventoryLineDto.prototype, "counted", void 0);
|
|
512
|
+
__decorate([
|
|
513
|
+
(0, class_validator_1.IsOptional)(),
|
|
514
|
+
(0, validators_1.Trim)(),
|
|
515
|
+
(0, validators_1.EmptyToNull)(),
|
|
516
|
+
(0, validators_1.IsNullable)(),
|
|
517
|
+
(0, class_validator_1.IsString)({ message: 'Invalid reason' }),
|
|
518
|
+
(0, class_validator_1.MaxLength)(200, { message: 'Reason cannot exceed 200 characters' }),
|
|
519
|
+
__metadata("design:type", Object)
|
|
520
|
+
], CountInventoryLineDto.prototype, "reason", void 0);
|
|
521
|
+
class CountInventoryDto {
|
|
522
|
+
lines;
|
|
523
|
+
notes;
|
|
524
|
+
}
|
|
525
|
+
exports.CountInventoryDto = CountInventoryDto;
|
|
526
|
+
__decorate([
|
|
527
|
+
(0, class_validator_1.IsArray)({ message: 'Lines must be a list' }),
|
|
528
|
+
(0, class_validator_1.ArrayMinSize)(1, { message: 'Count at least one item' }),
|
|
529
|
+
(0, class_validator_1.ArrayMaxSize)(MAX_LINES, { message: `A count cannot exceed ${MAX_LINES} items` }),
|
|
530
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
531
|
+
(0, class_transformer_1.Type)(() => CountInventoryLineDto),
|
|
532
|
+
__metadata("design:type", Array)
|
|
533
|
+
], CountInventoryDto.prototype, "lines", void 0);
|
|
534
|
+
__decorate([
|
|
535
|
+
(0, class_validator_1.IsOptional)(),
|
|
536
|
+
(0, validators_1.Trim)(),
|
|
537
|
+
(0, validators_1.EmptyToNull)(),
|
|
538
|
+
(0, validators_1.IsNullable)(),
|
|
539
|
+
(0, class_validator_1.IsString)({ message: 'Invalid notes' }),
|
|
540
|
+
(0, class_validator_1.MaxLength)(1000, { message: 'Notes cannot exceed 1000 characters' }),
|
|
541
|
+
__metadata("design:type", Object)
|
|
542
|
+
], CountInventoryDto.prototype, "notes", void 0);
|
|
543
|
+
// ---- Stocktakes ----
|
|
544
|
+
class GetInventoryStocktakesDto {
|
|
545
|
+
page = 1;
|
|
546
|
+
page_size = 10;
|
|
547
|
+
location_id;
|
|
548
|
+
}
|
|
549
|
+
exports.GetInventoryStocktakesDto = GetInventoryStocktakesDto;
|
|
550
|
+
__decorate([
|
|
551
|
+
(0, class_validator_1.IsOptional)(),
|
|
552
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 1), { toClassOnly: true }),
|
|
553
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page must be a number' }),
|
|
554
|
+
(0, class_validator_1.Min)(1, { message: 'Page must be at least 1' }),
|
|
555
|
+
__metadata("design:type", Number)
|
|
556
|
+
], GetInventoryStocktakesDto.prototype, "page", void 0);
|
|
557
|
+
__decorate([
|
|
558
|
+
(0, class_validator_1.IsOptional)(),
|
|
559
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 10), { toClassOnly: true }),
|
|
560
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page size must be a number' }),
|
|
561
|
+
(0, class_validator_1.Min)(1, { message: 'Page size must be at least 1' }),
|
|
562
|
+
(0, class_validator_1.Max)(100, { message: 'Page size cannot exceed 100' }),
|
|
563
|
+
__metadata("design:type", Number)
|
|
564
|
+
], GetInventoryStocktakesDto.prototype, "page_size", void 0);
|
|
565
|
+
__decorate([
|
|
566
|
+
(0, class_validator_1.IsOptional)(),
|
|
567
|
+
(0, validators_1.IsNullable)(),
|
|
568
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid location ID format' }),
|
|
569
|
+
__metadata("design:type", Object)
|
|
570
|
+
], GetInventoryStocktakesDto.prototype, "location_id", void 0);
|
|
571
|
+
class InventoryStocktakeIdDto {
|
|
572
|
+
stocktakeId;
|
|
573
|
+
}
|
|
574
|
+
exports.InventoryStocktakeIdDto = InventoryStocktakeIdDto;
|
|
575
|
+
__decorate([
|
|
576
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid stocktake ID format' }),
|
|
577
|
+
__metadata("design:type", String)
|
|
578
|
+
], InventoryStocktakeIdDto.prototype, "stocktakeId", void 0);
|
|
579
|
+
// ---- Transfers ----
|
|
580
|
+
class GetInventoryTransfersDto {
|
|
581
|
+
page = 1;
|
|
582
|
+
page_size = 10;
|
|
583
|
+
status;
|
|
584
|
+
location_id;
|
|
585
|
+
}
|
|
586
|
+
exports.GetInventoryTransfersDto = GetInventoryTransfersDto;
|
|
587
|
+
__decorate([
|
|
588
|
+
(0, class_validator_1.IsOptional)(),
|
|
589
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 1), { toClassOnly: true }),
|
|
590
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page must be a number' }),
|
|
591
|
+
(0, class_validator_1.Min)(1, { message: 'Page must be at least 1' }),
|
|
592
|
+
__metadata("design:type", Number)
|
|
593
|
+
], GetInventoryTransfersDto.prototype, "page", void 0);
|
|
594
|
+
__decorate([
|
|
595
|
+
(0, class_validator_1.IsOptional)(),
|
|
596
|
+
(0, class_transformer_1.Transform)(({ value }) => (value ? Number(value) : 10), { toClassOnly: true }),
|
|
597
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page size must be a number' }),
|
|
598
|
+
(0, class_validator_1.Min)(1, { message: 'Page size must be at least 1' }),
|
|
599
|
+
(0, class_validator_1.Max)(100, { message: 'Page size cannot exceed 100' }),
|
|
600
|
+
__metadata("design:type", Number)
|
|
601
|
+
], GetInventoryTransfersDto.prototype, "page_size", void 0);
|
|
602
|
+
__decorate([
|
|
603
|
+
(0, class_validator_1.IsOptional)(),
|
|
604
|
+
(0, validators_1.IsNullable)(),
|
|
605
|
+
(0, class_validator_1.IsEnum)(enum_1.InventoryTransferStatus, { message: 'Invalid transfer status' }),
|
|
606
|
+
__metadata("design:type", Object)
|
|
607
|
+
], GetInventoryTransfersDto.prototype, "status", void 0);
|
|
608
|
+
__decorate([
|
|
609
|
+
(0, class_validator_1.IsOptional)(),
|
|
610
|
+
(0, validators_1.IsNullable)(),
|
|
611
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid location ID format' }),
|
|
612
|
+
__metadata("design:type", Object)
|
|
613
|
+
], GetInventoryTransfersDto.prototype, "location_id", void 0);
|
|
614
|
+
class InventoryTransferIdDto {
|
|
615
|
+
transferId;
|
|
616
|
+
}
|
|
617
|
+
exports.InventoryTransferIdDto = InventoryTransferIdDto;
|
|
618
|
+
__decorate([
|
|
619
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid transfer ID format' }),
|
|
620
|
+
__metadata("design:type", String)
|
|
621
|
+
], InventoryTransferIdDto.prototype, "transferId", void 0);
|
|
622
|
+
class CreateInventoryTransferLineDto {
|
|
623
|
+
item_id;
|
|
624
|
+
quantity;
|
|
625
|
+
}
|
|
626
|
+
exports.CreateInventoryTransferLineDto = CreateInventoryTransferLineDto;
|
|
627
|
+
__decorate([
|
|
628
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid item ID format' }),
|
|
629
|
+
__metadata("design:type", String)
|
|
630
|
+
], CreateInventoryTransferLineDto.prototype, "item_id", void 0);
|
|
631
|
+
__decorate([
|
|
632
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 3 }, { message: 'Quantity must be a number with at most 3 decimals' }),
|
|
633
|
+
(0, class_validator_1.Min)(0.001, { message: 'Quantity must be more than 0' }),
|
|
634
|
+
(0, class_validator_1.Max)(MAX_QUANTITY, { message: 'Quantity is too large' }),
|
|
635
|
+
__metadata("design:type", Number)
|
|
636
|
+
], CreateInventoryTransferLineDto.prototype, "quantity", void 0);
|
|
637
|
+
class CreateInventoryTransferDto {
|
|
638
|
+
from_location_id;
|
|
639
|
+
to_location_id;
|
|
640
|
+
lines;
|
|
641
|
+
notes;
|
|
642
|
+
}
|
|
643
|
+
exports.CreateInventoryTransferDto = CreateInventoryTransferDto;
|
|
644
|
+
__decorate([
|
|
645
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid from location ID format' }),
|
|
646
|
+
__metadata("design:type", String)
|
|
647
|
+
], CreateInventoryTransferDto.prototype, "from_location_id", void 0);
|
|
648
|
+
__decorate([
|
|
649
|
+
(0, class_validator_1.IsUUID)('7', { message: 'Invalid to location ID format' }),
|
|
650
|
+
__metadata("design:type", String)
|
|
651
|
+
], CreateInventoryTransferDto.prototype, "to_location_id", void 0);
|
|
652
|
+
__decorate([
|
|
653
|
+
(0, class_validator_1.IsArray)({ message: 'Lines must be a list' }),
|
|
654
|
+
(0, class_validator_1.ArrayMinSize)(1, { message: 'Add at least one item' }),
|
|
655
|
+
(0, class_validator_1.ArrayMaxSize)(MAX_LINES, { message: `A transfer cannot exceed ${MAX_LINES} lines` }),
|
|
656
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
657
|
+
(0, class_transformer_1.Type)(() => CreateInventoryTransferLineDto),
|
|
658
|
+
__metadata("design:type", Array)
|
|
659
|
+
], CreateInventoryTransferDto.prototype, "lines", void 0);
|
|
660
|
+
__decorate([
|
|
661
|
+
(0, class_validator_1.IsOptional)(),
|
|
662
|
+
(0, validators_1.Trim)(),
|
|
663
|
+
(0, validators_1.EmptyToNull)(),
|
|
664
|
+
(0, validators_1.IsNullable)(),
|
|
665
|
+
(0, class_validator_1.IsString)({ message: 'Invalid notes' }),
|
|
666
|
+
(0, class_validator_1.MaxLength)(1000, { message: 'Notes cannot exceed 1000 characters' }),
|
|
667
|
+
__metadata("design:type", Object)
|
|
668
|
+
], CreateInventoryTransferDto.prototype, "notes", void 0);
|
|
669
|
+
class UpdateInventoryTransferDto extends CreateInventoryTransferDto {
|
|
670
|
+
}
|
|
671
|
+
exports.UpdateInventoryTransferDto = UpdateInventoryTransferDto;
|
|
672
|
+
class ReceiveInventoryTransferDto {
|
|
673
|
+
lines;
|
|
674
|
+
}
|
|
675
|
+
exports.ReceiveInventoryTransferDto = ReceiveInventoryTransferDto;
|
|
676
|
+
__decorate([
|
|
677
|
+
(0, class_validator_1.IsOptional)(),
|
|
678
|
+
(0, validators_1.IsNullable)(),
|
|
679
|
+
(0, class_validator_1.IsArray)({ message: 'Lines must be a list' }),
|
|
680
|
+
(0, class_validator_1.ArrayMaxSize)(MAX_LINES, { message: `A receipt cannot exceed ${MAX_LINES} lines` }),
|
|
681
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
682
|
+
(0, class_transformer_1.Type)(() => CreateInventoryTransferLineDto),
|
|
683
|
+
__metadata("design:type", Object)
|
|
684
|
+
], ReceiveInventoryTransferDto.prototype, "lines", void 0);
|