@managesome/eposmatic-toolkit 0.2.427 → 0.2.430
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/lib/helpers/order/generate-purchase-order-rfq.d.ts +3 -0
- package/lib/helpers/order/generate-purchase-order-rfq.js +64 -0
- package/lib/helpers/order/index.d.ts +1 -0
- package/lib/helpers/order/index.js +1 -0
- package/lib/helpers/store/index.d.ts +1 -0
- package/lib/helpers/store/index.js +1 -0
- package/lib/helpers/store/purchase-order-rfq-cart-actions.d.ts +19 -0
- package/lib/helpers/store/purchase-order-rfq-cart-actions.js +373 -0
- package/lib/schemas/models/applied_order_discounts.d.ts +80 -0
- package/lib/schemas/models/applied_order_discounts.js +106 -0
- package/lib/schemas/models/brands.d.ts +45 -0
- package/lib/schemas/models/brands.js +45 -0
- package/lib/schemas/models/categories.d.ts +60 -0
- package/lib/schemas/models/categories.js +67 -0
- package/lib/schemas/models/close_dates.js +2 -2
- package/lib/schemas/models/dinein_tables.d.ts +6 -6
- package/lib/schemas/models/dinein_tables_fingerprints.d.ts +65 -0
- package/lib/schemas/models/dinein_tables_fingerprints.js +85 -0
- package/lib/schemas/models/discounts.js +3 -3
- package/lib/schemas/models/expense_categories.d.ts +83 -0
- package/lib/schemas/models/expense_categories.js +64 -0
- package/lib/schemas/models/halfhalf_setup.js +3 -3
- package/lib/schemas/models/index.d.ts +23 -23
- package/lib/schemas/models/index.js +23 -23
- package/lib/schemas/models/inventories.d.ts +99 -0
- package/lib/schemas/models/inventories.js +87 -0
- package/lib/schemas/models/inventory_lot_serial_numbers.d.ts +15 -15
- package/lib/schemas/models/items.d.ts +11269 -0
- package/lib/schemas/models/items.js +333 -0
- package/lib/schemas/models/menus.d.ts +941 -0
- package/lib/schemas/models/menus.js +69 -0
- package/lib/schemas/models/offers.js +3 -3
- package/lib/schemas/models/orders.d.ts +15437 -0
- package/lib/schemas/models/orders.js +891 -0
- package/lib/schemas/models/public_holidays.js +2 -2
- package/lib/schemas/models/purchase_order_receipts.d.ts +3 -3
- package/lib/schemas/models/purchase_order_receipts.js +2 -2
- package/lib/schemas/models/purchase_order_rfqs.d.ts +1959 -0
- package/lib/schemas/models/purchase_order_rfqs.js +328 -0
- package/lib/schemas/models/purchase_order_vendor_returns.d.ts +15 -15
- package/lib/schemas/models/purchase_order_vendor_returns.js +2 -2
- package/lib/schemas/models/purchase_orders.js +4 -4
- package/lib/schemas/models/riders.d.ts +65 -0
- package/lib/schemas/models/riders.js +74 -0
- package/lib/schemas/models/specials.js +3 -3
- package/lib/schemas/models/tenant_staffs.d.ts +932 -0
- package/lib/schemas/models/tenant_staffs.js +96 -0
- package/lib/schemas/models/tenants.d.ts +528 -0
- package/lib/schemas/models/tenants.js +755 -0
- package/lib/schemas/models/track_order_numbers.d.ts +413 -0
- package/lib/schemas/models/track_order_numbers.js +45 -0
- package/lib/schemas/models/void_purchase_order_items.js +2 -2
- package/lib/schemas/models/void_warehouse_invoice_items.d.ts +6 -6
- package/lib/schemas/models/void_warehouse_invoice_items.js +2 -2
- package/lib/schemas/models/wallets.d.ts +38 -0
- package/lib/schemas/models/wallets.js +37 -0
- package/lib/schemas/models/warehouse-activity-logs.js +2 -2
- package/lib/schemas/models/warehouse_communications.d.ts +228 -0
- package/lib/schemas/models/warehouse_communications.js +216 -0
- package/lib/schemas/models/warehouse_internal_movements.d.ts +33 -34
- package/lib/schemas/models/warehouse_internal_movements.js +2 -34
- package/lib/schemas/models/warehouse_invoices.js +2 -2
- package/lib/schemas/models/warehouse_items.js +2 -2
- package/lib/schemas/models/warehouse_sale_deliveries.d.ts +167 -0
- package/lib/schemas/models/warehouse_sale_deliveries.js +155 -0
- package/lib/schemas/models/warehouse_sale_invoices.d.ts +227 -0
- package/lib/schemas/models/warehouse_sale_invoices.js +206 -0
- package/lib/schemas/models/warehouse_sale_order_rfqs.d.ts +1938 -0
- package/lib/schemas/models/warehouse_sale_order_rfqs.js +309 -0
- package/lib/schemas/models/warehouse_sale_orders.d.ts +1943 -0
- package/lib/schemas/models/warehouse_sale_orders.js +324 -0
- package/lib/schemas/models/warehouse_staffs.d.ts +65 -0
- package/lib/schemas/models/warehouse_staffs.js +78 -0
- package/lib/schemas/models/warehouse_track_order_numbers.d.ts +50 -0
- package/lib/schemas/models/warehouse_track_order_numbers.js +52 -0
- package/lib/schemas/models/warehouse_vendors.d.ts +3 -3
- package/lib/schemas/models/warehouses.d.ts +162 -0
- package/lib/schemas/models/warehouses.js +222 -0
- package/lib/schemas/types/applied_order_discounts.d.ts +22 -0
- package/lib/schemas/types/applied_order_discounts.js +2 -0
- package/lib/schemas/types/brands.d.ts +32 -0
- package/lib/schemas/types/brands.js +2 -0
- package/lib/schemas/types/categories.d.ts +15 -0
- package/lib/schemas/types/categories.js +2 -0
- package/lib/schemas/types/deliveries.d.ts +1 -1
- package/lib/schemas/types/expense_categories.d.ts +20 -0
- package/lib/schemas/types/expense_categories.js +2 -0
- package/lib/schemas/types/expense_details.d.ts +1 -1
- package/lib/schemas/types/index.d.ts +22 -22
- package/lib/schemas/types/index.js +22 -22
- package/lib/schemas/types/inventories.d.ts +48 -0
- package/lib/schemas/types/inventories.js +2 -0
- package/lib/schemas/types/items.d.ts +89 -0
- package/lib/schemas/types/items.js +2 -0
- package/lib/schemas/types/menus.d.ts +17 -0
- package/lib/schemas/types/menus.js +2 -0
- package/lib/schemas/types/multi_tenants.d.ts +2 -2
- package/lib/schemas/types/orders.d.ts +242 -0
- package/lib/schemas/types/orders.js +2 -0
- package/lib/schemas/types/purchase_order_common.d.ts +1 -1
- package/lib/schemas/types/purchase_order_rfqs.d.ts +33 -0
- package/lib/schemas/types/purchase_order_rfqs.js +2 -0
- package/lib/schemas/types/purchase_orders.d.ts +1 -1
- package/lib/schemas/types/reservations.d.ts +1 -1
- package/lib/schemas/types/riders.d.ts +16 -0
- package/lib/schemas/types/riders.js +2 -0
- package/lib/schemas/types/sale_order_common.d.ts +1 -1
- package/lib/schemas/types/specials.d.ts +1 -1
- package/lib/schemas/types/tenant_staffs.d.ts +22 -0
- package/lib/schemas/types/tenant_staffs.js +2 -0
- package/lib/schemas/types/tenants.d.ts +205 -0
- package/lib/schemas/types/tenants.js +2 -0
- package/lib/schemas/types/track_order_numbers.d.ts +10 -0
- package/lib/schemas/types/track_order_numbers.js +2 -0
- package/lib/schemas/types/wallets.d.ts +7 -0
- package/lib/schemas/types/wallets.js +2 -0
- package/lib/schemas/types/warehouse_communications.d.ts +54 -0
- package/lib/schemas/types/warehouse_communications.js +2 -0
- package/lib/schemas/types/warehouse_internal_movements.d.ts +2 -2
- package/lib/schemas/types/warehouse_invoices.d.ts +1 -1
- package/lib/schemas/types/warehouse_sale_deliveries.d.ts +67 -0
- package/lib/schemas/types/warehouse_sale_deliveries.js +2 -0
- package/lib/schemas/types/warehouse_sale_invoices.d.ts +49 -0
- package/lib/schemas/types/warehouse_sale_invoices.js +2 -0
- package/lib/schemas/types/warehouse_sale_order_rfqs.d.ts +25 -0
- package/lib/schemas/types/warehouse_sale_order_rfqs.js +2 -0
- package/lib/schemas/types/warehouse_sale_orders.d.ts +30 -0
- package/lib/schemas/types/warehouse_sale_orders.js +2 -0
- package/lib/schemas/types/warehouse_staffs.d.ts +17 -0
- package/lib/schemas/types/warehouse_staffs.js +2 -0
- package/lib/schemas/types/warehouse_track_order_numbers.d.ts +11 -0
- package/lib/schemas/types/warehouse_track_order_numbers.js +2 -0
- package/lib/schemas/types/warehouses.d.ts +49 -0
- package/lib/schemas/types/warehouses.js +2 -0
- package/package.json +1 -1
|
@@ -53,7 +53,6 @@ const WarehouseInternalMovementItemSchema = new mongoose_1.Schema({
|
|
|
53
53
|
notes: {
|
|
54
54
|
type: String,
|
|
55
55
|
required: false,
|
|
56
|
-
default: null,
|
|
57
56
|
},
|
|
58
57
|
}, {
|
|
59
58
|
_id: false,
|
|
@@ -141,150 +140,121 @@ exports.WarehouseInternalMovementsSchema = new mongoose_1.Schema({
|
|
|
141
140
|
parent_movement_id: {
|
|
142
141
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
143
142
|
required: false,
|
|
144
|
-
default: null,
|
|
145
143
|
ref: exports.WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_NAME,
|
|
146
144
|
},
|
|
147
145
|
notes: {
|
|
148
146
|
type: String,
|
|
149
147
|
required: false,
|
|
150
|
-
default: null,
|
|
151
148
|
},
|
|
152
149
|
requested_at: {
|
|
153
150
|
type: mongoose_1.Schema.Types.Date,
|
|
154
151
|
required: false,
|
|
155
|
-
default: null,
|
|
156
152
|
},
|
|
157
153
|
approved_at: {
|
|
158
154
|
type: mongoose_1.Schema.Types.Date,
|
|
159
155
|
required: false,
|
|
160
|
-
default: null,
|
|
161
156
|
},
|
|
162
157
|
dispatched_at: {
|
|
163
158
|
type: mongoose_1.Schema.Types.Date,
|
|
164
159
|
required: false,
|
|
165
|
-
default: null,
|
|
166
160
|
},
|
|
167
161
|
delivered_at: {
|
|
168
162
|
type: mongoose_1.Schema.Types.Date,
|
|
169
163
|
required: false,
|
|
170
|
-
default: null,
|
|
171
164
|
},
|
|
172
165
|
received_at: {
|
|
173
166
|
type: mongoose_1.Schema.Types.Date,
|
|
174
167
|
required: false,
|
|
175
|
-
default: null,
|
|
176
168
|
},
|
|
177
169
|
cancelled_at: {
|
|
178
170
|
type: mongoose_1.Schema.Types.Date,
|
|
179
171
|
required: false,
|
|
180
|
-
default: null,
|
|
181
172
|
},
|
|
182
173
|
requested_by: {
|
|
183
174
|
type: WarehouseInternalMovementActorSchema,
|
|
184
175
|
required: false,
|
|
185
|
-
default: null,
|
|
186
176
|
},
|
|
187
177
|
approved_by: {
|
|
188
178
|
type: WarehouseInternalMovementActorSchema,
|
|
189
179
|
required: false,
|
|
190
|
-
default: null,
|
|
191
180
|
},
|
|
192
181
|
dispatched_by: {
|
|
193
182
|
type: WarehouseInternalMovementActorSchema,
|
|
194
183
|
required: false,
|
|
195
|
-
default: null,
|
|
196
184
|
},
|
|
197
185
|
delivered_by: {
|
|
198
186
|
type: WarehouseInternalMovementActorSchema,
|
|
199
187
|
required: false,
|
|
200
|
-
default: null,
|
|
201
188
|
},
|
|
202
189
|
received_by: {
|
|
203
190
|
type: WarehouseInternalMovementActorSchema,
|
|
204
191
|
required: false,
|
|
205
|
-
default: null,
|
|
206
192
|
},
|
|
207
193
|
cancelled_by: {
|
|
208
194
|
type: WarehouseInternalMovementActorSchema,
|
|
209
195
|
required: false,
|
|
210
|
-
default: null,
|
|
211
196
|
},
|
|
212
197
|
edit_request_status: {
|
|
213
198
|
type: String,
|
|
214
199
|
enum: constants_1.ALL_INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_NAMES,
|
|
215
|
-
required:
|
|
216
|
-
default: constants_1.INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_ENUM.NONE,
|
|
200
|
+
required: false,
|
|
217
201
|
},
|
|
218
202
|
edit_requested_at: {
|
|
219
203
|
type: mongoose_1.Schema.Types.Date,
|
|
220
204
|
required: false,
|
|
221
|
-
default: null,
|
|
222
205
|
},
|
|
223
206
|
edit_requested_by: {
|
|
224
207
|
type: WarehouseInternalMovementActorSchema,
|
|
225
208
|
required: false,
|
|
226
|
-
default: null,
|
|
227
209
|
},
|
|
228
210
|
edit_request_note: {
|
|
229
211
|
type: String,
|
|
230
212
|
required: false,
|
|
231
|
-
default: null,
|
|
232
213
|
},
|
|
233
214
|
edit_request_reviewed_at: {
|
|
234
215
|
type: mongoose_1.Schema.Types.Date,
|
|
235
216
|
required: false,
|
|
236
|
-
default: null,
|
|
237
217
|
},
|
|
238
218
|
edit_request_reviewed_by: {
|
|
239
219
|
type: WarehouseInternalMovementActorSchema,
|
|
240
220
|
required: false,
|
|
241
|
-
default: null,
|
|
242
221
|
},
|
|
243
222
|
edit_request_decision_note: {
|
|
244
223
|
type: String,
|
|
245
224
|
required: false,
|
|
246
|
-
default: null,
|
|
247
225
|
},
|
|
248
226
|
edit_approved_for_context_id: {
|
|
249
227
|
type: String,
|
|
250
228
|
required: false,
|
|
251
|
-
default: null,
|
|
252
229
|
},
|
|
253
230
|
cancel_request_status: {
|
|
254
231
|
type: String,
|
|
255
232
|
enum: constants_1.ALL_INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_NAMES,
|
|
256
|
-
required:
|
|
257
|
-
default: constants_1.INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_ENUM.NONE,
|
|
233
|
+
required: false,
|
|
258
234
|
},
|
|
259
235
|
cancel_requested_at: {
|
|
260
236
|
type: mongoose_1.Schema.Types.Date,
|
|
261
237
|
required: false,
|
|
262
|
-
default: null,
|
|
263
238
|
},
|
|
264
239
|
cancel_requested_by: {
|
|
265
240
|
type: WarehouseInternalMovementActorSchema,
|
|
266
241
|
required: false,
|
|
267
|
-
default: null,
|
|
268
242
|
},
|
|
269
243
|
cancel_request_note: {
|
|
270
244
|
type: String,
|
|
271
245
|
required: false,
|
|
272
|
-
default: null,
|
|
273
246
|
},
|
|
274
247
|
cancel_request_reviewed_at: {
|
|
275
248
|
type: mongoose_1.Schema.Types.Date,
|
|
276
249
|
required: false,
|
|
277
|
-
default: null,
|
|
278
250
|
},
|
|
279
251
|
cancel_request_reviewed_by: {
|
|
280
252
|
type: WarehouseInternalMovementActorSchema,
|
|
281
253
|
required: false,
|
|
282
|
-
default: null,
|
|
283
254
|
},
|
|
284
255
|
cancel_request_decision_note: {
|
|
285
256
|
type: String,
|
|
286
257
|
required: false,
|
|
287
|
-
default: null,
|
|
288
258
|
},
|
|
289
259
|
created_by: {
|
|
290
260
|
type: WarehouseInternalMovementActorSchema,
|
|
@@ -293,12 +263,10 @@ exports.WarehouseInternalMovementsSchema = new mongoose_1.Schema({
|
|
|
293
263
|
updated_by: {
|
|
294
264
|
type: WarehouseInternalMovementActorSchema,
|
|
295
265
|
required: false,
|
|
296
|
-
default: null,
|
|
297
266
|
},
|
|
298
267
|
cancelled_reason: {
|
|
299
268
|
type: String,
|
|
300
269
|
required: false,
|
|
301
|
-
default: null,
|
|
302
270
|
},
|
|
303
271
|
is_deleted: {
|
|
304
272
|
type: Boolean,
|
|
@@ -4,8 +4,8 @@ exports.WAREHOUSE_INVOICES_COLLECTION_NAME = exports.WarehouseClientInvoicesSche
|
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const common_models_1 = require("./common-models");
|
|
7
|
-
const warehouse_1 = require("./warehouse");
|
|
8
7
|
const warehouse_clients_1 = require("./warehouse_clients");
|
|
8
|
+
const warehouses_1 = require("./warehouses");
|
|
9
9
|
const StaffDetailsSchema = new mongoose_1.Schema({
|
|
10
10
|
staff_id: {
|
|
11
11
|
type: String,
|
|
@@ -179,7 +179,7 @@ exports.WarehouseClientInvoicesSchema = new mongoose_1.Schema({
|
|
|
179
179
|
warehouse_id: {
|
|
180
180
|
type: String,
|
|
181
181
|
required: true,
|
|
182
|
-
ref:
|
|
182
|
+
ref: warehouses_1.WAREHOUSE_SETTINGS_COLLECTION_NAME,
|
|
183
183
|
},
|
|
184
184
|
client_id: {
|
|
185
185
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WAREHOUSE_ITEMS_COLLECTION_NAME = exports.WarehouseItemSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
|
-
const
|
|
6
|
+
const items_1 = require("./items");
|
|
7
7
|
// Custom price schema for warehouse items that allows any string keys
|
|
8
8
|
const WarehousePriceSchema = new mongoose_1.Schema({
|
|
9
9
|
BASE_PRICE: {
|
|
@@ -97,7 +97,7 @@ exports.WarehouseItemSchema = new mongoose_1.Schema({
|
|
|
97
97
|
default: 'BASE_ITEM',
|
|
98
98
|
},
|
|
99
99
|
ingredients: {
|
|
100
|
-
type: [
|
|
100
|
+
type: [items_1.IngredientSchema],
|
|
101
101
|
default: null,
|
|
102
102
|
},
|
|
103
103
|
keywords: {
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
export declare const WAREHOUSE_SALE_DELIVERY_COLLECTION_NAME = "warehouse_sale_deliveries";
|
|
3
|
+
export declare const SaleOrderDeliveriesSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
4
|
+
timestamps: true;
|
|
5
|
+
versionKey: false;
|
|
6
|
+
minimize: false;
|
|
7
|
+
}, {
|
|
8
|
+
createdAt: NativeDate;
|
|
9
|
+
updatedAt: NativeDate;
|
|
10
|
+
} & {
|
|
11
|
+
_id: import("mongoose").Types.ObjectId;
|
|
12
|
+
createdAt_mins: number;
|
|
13
|
+
createdAt: NativeDate;
|
|
14
|
+
updatedAt: NativeDate;
|
|
15
|
+
items: import("mongoose").Types.DocumentArray<{
|
|
16
|
+
quantity: number;
|
|
17
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
18
|
+
item_name: string;
|
|
19
|
+
reason?: string | null | undefined;
|
|
20
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
21
|
+
quantity: number;
|
|
22
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
23
|
+
item_name: string;
|
|
24
|
+
reason?: string | null | undefined;
|
|
25
|
+
}> & {
|
|
26
|
+
quantity: number;
|
|
27
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
28
|
+
item_name: string;
|
|
29
|
+
reason?: string | null | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
status: import("../../constants").SALE_ORDER_DELIVERY_STATUS_ENUM | import("../../constants").SALE_ORDER_DELIVERY_RETURN_STATUS_ENUM;
|
|
32
|
+
warehouse_id: string;
|
|
33
|
+
doc_kind: import("../../constants").SALE_ORDER_PHYSICAL_DOC_KIND_ENUM;
|
|
34
|
+
sale_order_id: import("mongoose").Types.ObjectId;
|
|
35
|
+
cancel_reason?: string | null | undefined;
|
|
36
|
+
notes?: string | null | undefined;
|
|
37
|
+
created_by?: {
|
|
38
|
+
_id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
} | null | undefined;
|
|
41
|
+
delivered_at?: NativeDate | null | undefined;
|
|
42
|
+
cancelled_at?: NativeDate | null | undefined;
|
|
43
|
+
delivered_by?: {
|
|
44
|
+
_id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
} | null | undefined;
|
|
47
|
+
cancelled_by?: {
|
|
48
|
+
_id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
} | null | undefined;
|
|
51
|
+
inventory_consumed?: boolean | null | undefined;
|
|
52
|
+
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
53
|
+
inventory_restocked?: boolean | null | undefined;
|
|
54
|
+
returned_by?: {
|
|
55
|
+
_id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
} | null | undefined;
|
|
58
|
+
returned_at?: NativeDate | null | undefined;
|
|
59
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
60
|
+
createdAt: NativeDate;
|
|
61
|
+
updatedAt: NativeDate;
|
|
62
|
+
} & {
|
|
63
|
+
_id: import("mongoose").Types.ObjectId;
|
|
64
|
+
createdAt_mins: number;
|
|
65
|
+
createdAt: NativeDate;
|
|
66
|
+
updatedAt: NativeDate;
|
|
67
|
+
items: import("mongoose").Types.DocumentArray<{
|
|
68
|
+
quantity: number;
|
|
69
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
70
|
+
item_name: string;
|
|
71
|
+
reason?: string | null | undefined;
|
|
72
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
73
|
+
quantity: number;
|
|
74
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
75
|
+
item_name: string;
|
|
76
|
+
reason?: string | null | undefined;
|
|
77
|
+
}> & {
|
|
78
|
+
quantity: number;
|
|
79
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
80
|
+
item_name: string;
|
|
81
|
+
reason?: string | null | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
status: import("../../constants").SALE_ORDER_DELIVERY_STATUS_ENUM | import("../../constants").SALE_ORDER_DELIVERY_RETURN_STATUS_ENUM;
|
|
84
|
+
warehouse_id: string;
|
|
85
|
+
doc_kind: import("../../constants").SALE_ORDER_PHYSICAL_DOC_KIND_ENUM;
|
|
86
|
+
sale_order_id: import("mongoose").Types.ObjectId;
|
|
87
|
+
cancel_reason?: string | null | undefined;
|
|
88
|
+
notes?: string | null | undefined;
|
|
89
|
+
created_by?: {
|
|
90
|
+
_id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
} | null | undefined;
|
|
93
|
+
delivered_at?: NativeDate | null | undefined;
|
|
94
|
+
cancelled_at?: NativeDate | null | undefined;
|
|
95
|
+
delivered_by?: {
|
|
96
|
+
_id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
} | null | undefined;
|
|
99
|
+
cancelled_by?: {
|
|
100
|
+
_id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
} | null | undefined;
|
|
103
|
+
inventory_consumed?: boolean | null | undefined;
|
|
104
|
+
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
105
|
+
inventory_restocked?: boolean | null | undefined;
|
|
106
|
+
returned_by?: {
|
|
107
|
+
_id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
} | null | undefined;
|
|
110
|
+
returned_at?: NativeDate | null | undefined;
|
|
111
|
+
}>> & import("mongoose").FlatRecord<{
|
|
112
|
+
createdAt: NativeDate;
|
|
113
|
+
updatedAt: NativeDate;
|
|
114
|
+
} & {
|
|
115
|
+
_id: import("mongoose").Types.ObjectId;
|
|
116
|
+
createdAt_mins: number;
|
|
117
|
+
createdAt: NativeDate;
|
|
118
|
+
updatedAt: NativeDate;
|
|
119
|
+
items: import("mongoose").Types.DocumentArray<{
|
|
120
|
+
quantity: number;
|
|
121
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
122
|
+
item_name: string;
|
|
123
|
+
reason?: string | null | undefined;
|
|
124
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
125
|
+
quantity: number;
|
|
126
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
127
|
+
item_name: string;
|
|
128
|
+
reason?: string | null | undefined;
|
|
129
|
+
}> & {
|
|
130
|
+
quantity: number;
|
|
131
|
+
item_id: import("mongoose").Types.ObjectId;
|
|
132
|
+
item_name: string;
|
|
133
|
+
reason?: string | null | undefined;
|
|
134
|
+
}>;
|
|
135
|
+
status: import("../../constants").SALE_ORDER_DELIVERY_STATUS_ENUM | import("../../constants").SALE_ORDER_DELIVERY_RETURN_STATUS_ENUM;
|
|
136
|
+
warehouse_id: string;
|
|
137
|
+
doc_kind: import("../../constants").SALE_ORDER_PHYSICAL_DOC_KIND_ENUM;
|
|
138
|
+
sale_order_id: import("mongoose").Types.ObjectId;
|
|
139
|
+
cancel_reason?: string | null | undefined;
|
|
140
|
+
notes?: string | null | undefined;
|
|
141
|
+
created_by?: {
|
|
142
|
+
_id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
} | null | undefined;
|
|
145
|
+
delivered_at?: NativeDate | null | undefined;
|
|
146
|
+
cancelled_at?: NativeDate | null | undefined;
|
|
147
|
+
delivered_by?: {
|
|
148
|
+
_id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
} | null | undefined;
|
|
151
|
+
cancelled_by?: {
|
|
152
|
+
_id: string;
|
|
153
|
+
name: string;
|
|
154
|
+
} | null | undefined;
|
|
155
|
+
inventory_consumed?: boolean | null | undefined;
|
|
156
|
+
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
157
|
+
inventory_restocked?: boolean | null | undefined;
|
|
158
|
+
returned_by?: {
|
|
159
|
+
_id: string;
|
|
160
|
+
name: string;
|
|
161
|
+
} | null | undefined;
|
|
162
|
+
returned_at?: NativeDate | null | undefined;
|
|
163
|
+
}> & Required<{
|
|
164
|
+
_id: import("mongoose").Types.ObjectId;
|
|
165
|
+
}> & {
|
|
166
|
+
__v: number;
|
|
167
|
+
}>;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaleOrderDeliveriesSchema = exports.WAREHOUSE_SALE_DELIVERY_COLLECTION_NAME = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const warehouse_items_1 = require("./warehouse_items");
|
|
7
|
+
const warehouse_sale_orders_1 = require("./warehouse_sale_orders");
|
|
8
|
+
const warehouses_1 = require("./warehouses");
|
|
9
|
+
exports.WAREHOUSE_SALE_DELIVERY_COLLECTION_NAME = 'warehouse_sale_deliveries';
|
|
10
|
+
const ALL_SALE_ORDER_PHYSICAL_DOC_STATUS_NAMES = Array.from(new Set([...constants_1.ALL_SALE_ORDER_DELIVERY_STATUS_NAMES, ...constants_1.ALL_SALE_ORDER_DELIVERY_RETURN_STATUS_NAMES]));
|
|
11
|
+
const SaleOrderDeliveryActorSchema = new mongoose_1.Schema({
|
|
12
|
+
_id: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: '',
|
|
19
|
+
},
|
|
20
|
+
}, {
|
|
21
|
+
_id: false,
|
|
22
|
+
minimize: false,
|
|
23
|
+
});
|
|
24
|
+
const SaleOrderDeliveryItemsSchema = new mongoose_1.Schema({
|
|
25
|
+
item_id: {
|
|
26
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
27
|
+
required: true,
|
|
28
|
+
ref: warehouse_items_1.WAREHOUSE_ITEMS_COLLECTION_NAME,
|
|
29
|
+
},
|
|
30
|
+
item_name: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
quantity: {
|
|
35
|
+
type: Number,
|
|
36
|
+
min: 0,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
reason: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: false,
|
|
42
|
+
},
|
|
43
|
+
}, {
|
|
44
|
+
_id: false,
|
|
45
|
+
minimize: false,
|
|
46
|
+
});
|
|
47
|
+
exports.SaleOrderDeliveriesSchema = new mongoose_1.Schema({
|
|
48
|
+
_id: {
|
|
49
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
50
|
+
required: true,
|
|
51
|
+
immutable: true,
|
|
52
|
+
},
|
|
53
|
+
doc_kind: {
|
|
54
|
+
type: String,
|
|
55
|
+
enum: constants_1.ALL_SALE_ORDER_PHYSICAL_DOC_KIND_NAMES,
|
|
56
|
+
required: true,
|
|
57
|
+
},
|
|
58
|
+
warehouse_id: {
|
|
59
|
+
type: String,
|
|
60
|
+
required: true,
|
|
61
|
+
ref: warehouses_1.WAREHOUSE_SETTINGS_COLLECTION_NAME,
|
|
62
|
+
},
|
|
63
|
+
sale_order_id: {
|
|
64
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
65
|
+
required: true,
|
|
66
|
+
ref: warehouse_sale_orders_1.SALE_ORDER_COLLECTION_NAME,
|
|
67
|
+
},
|
|
68
|
+
// Present for delivery-return records.
|
|
69
|
+
applied_to_doc_id: {
|
|
70
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
71
|
+
required: false,
|
|
72
|
+
ref: exports.WAREHOUSE_SALE_DELIVERY_COLLECTION_NAME,
|
|
73
|
+
},
|
|
74
|
+
items: {
|
|
75
|
+
type: [SaleOrderDeliveryItemsSchema],
|
|
76
|
+
default: [],
|
|
77
|
+
},
|
|
78
|
+
status: {
|
|
79
|
+
type: String,
|
|
80
|
+
enum: ALL_SALE_ORDER_PHYSICAL_DOC_STATUS_NAMES,
|
|
81
|
+
required: true,
|
|
82
|
+
},
|
|
83
|
+
notes: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: false,
|
|
86
|
+
},
|
|
87
|
+
// Delivery-side stock flag.
|
|
88
|
+
inventory_consumed: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: false,
|
|
91
|
+
required: false,
|
|
92
|
+
},
|
|
93
|
+
// Delivery-return-side stock flag.
|
|
94
|
+
inventory_restocked: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false,
|
|
97
|
+
required: false,
|
|
98
|
+
},
|
|
99
|
+
created_by: {
|
|
100
|
+
type: SaleOrderDeliveryActorSchema,
|
|
101
|
+
required: false,
|
|
102
|
+
},
|
|
103
|
+
delivered_by: {
|
|
104
|
+
type: SaleOrderDeliveryActorSchema,
|
|
105
|
+
required: false,
|
|
106
|
+
},
|
|
107
|
+
returned_by: {
|
|
108
|
+
type: SaleOrderDeliveryActorSchema,
|
|
109
|
+
required: false,
|
|
110
|
+
},
|
|
111
|
+
cancelled_by: {
|
|
112
|
+
type: SaleOrderDeliveryActorSchema,
|
|
113
|
+
required: false,
|
|
114
|
+
},
|
|
115
|
+
delivered_at: {
|
|
116
|
+
type: mongoose_1.Schema.Types.Date,
|
|
117
|
+
required: false,
|
|
118
|
+
},
|
|
119
|
+
returned_at: {
|
|
120
|
+
type: mongoose_1.Schema.Types.Date,
|
|
121
|
+
required: false,
|
|
122
|
+
},
|
|
123
|
+
cancelled_at: {
|
|
124
|
+
type: mongoose_1.Schema.Types.Date,
|
|
125
|
+
required: false,
|
|
126
|
+
},
|
|
127
|
+
cancel_reason: {
|
|
128
|
+
type: String,
|
|
129
|
+
required: false,
|
|
130
|
+
},
|
|
131
|
+
createdAt_mins: {
|
|
132
|
+
type: Number,
|
|
133
|
+
required: true,
|
|
134
|
+
immutable: true,
|
|
135
|
+
default: () => {
|
|
136
|
+
const date = new Date();
|
|
137
|
+
return Math.floor(date.getHours() * 60 + date.getMinutes());
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
createdAt: {
|
|
141
|
+
type: mongoose_1.Schema.Types.Date,
|
|
142
|
+
required: true,
|
|
143
|
+
default: () => new Date(),
|
|
144
|
+
immutable: true,
|
|
145
|
+
},
|
|
146
|
+
updatedAt: {
|
|
147
|
+
type: mongoose_1.Schema.Types.Date,
|
|
148
|
+
required: true,
|
|
149
|
+
default: () => new Date(),
|
|
150
|
+
},
|
|
151
|
+
}, {
|
|
152
|
+
timestamps: true,
|
|
153
|
+
versionKey: false,
|
|
154
|
+
minimize: false,
|
|
155
|
+
});
|