@managesome/eposmatic-toolkit 0.2.646 → 0.2.648
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/store/catalog-actions.d.ts +7 -7
- package/lib/helpers/store/catalog-actions.js +34 -10
- package/lib/schemas/models/tenant_purchase_orders.d.ts +24 -0
- package/lib/schemas/models/tenant_purchase_orders.js +23 -1
- package/lib/schemas/models/tenant_staffs.d.ts +38 -0
- package/lib/schemas/models/tenant_staffs.js +37 -1
- package/lib/schemas/models/tenants.d.ts +23 -0
- package/lib/schemas/models/tenants.js +22 -1
- package/lib/schemas/models/warehouse-activity-logs.d.ts +18 -0
- package/lib/schemas/models/warehouse-activity-logs.js +17 -1
- package/lib/schemas/models/warehouse_categories.d.ts +17 -0
- package/lib/schemas/models/warehouse_categories.js +16 -1
- package/lib/schemas/models/warehouse_clients.d.ts +17 -0
- package/lib/schemas/models/warehouse_clients.js +16 -1
- package/lib/schemas/models/warehouse_communications.d.ts +16 -0
- package/lib/schemas/models/warehouse_communications.js +15 -1
- package/lib/schemas/models/warehouse_internal_movements.d.ts +52 -1
- package/lib/schemas/models/warehouse_internal_movements.js +54 -4
- package/lib/schemas/models/warehouse_purchase_order_receipts.d.ts +17 -0
- package/lib/schemas/models/warehouse_purchase_order_receipts.js +16 -1
- package/lib/schemas/models/warehouse_purchase_order_rfqs.d.ts +15 -0
- package/lib/schemas/models/warehouse_purchase_order_rfqs.js +14 -1
- package/lib/schemas/models/warehouse_purchase_order_vendor_returns.d.ts +16 -0
- package/lib/schemas/models/warehouse_purchase_order_vendor_returns.js +15 -1
- package/lib/schemas/models/warehouse_sale_invoices.d.ts +25 -0
- package/lib/schemas/models/warehouse_sale_invoices.js +24 -1
- package/lib/schemas/models/warehouse_sale_order_rfqs.d.ts +15 -0
- package/lib/schemas/models/warehouse_sale_order_rfqs.js +14 -1
- package/lib/schemas/models/warehouse_staffs.d.ts +31 -0
- package/lib/schemas/models/warehouse_staffs.js +30 -1
- package/lib/schemas/models/warehouses.d.ts +19 -0
- package/lib/schemas/models/warehouses.js +18 -1
- package/package.json +1 -1
|
@@ -21,12 +21,7 @@ export declare function getSelectedVendorCatalogs(menus: {
|
|
|
21
21
|
_id: string;
|
|
22
22
|
included_categories: IIncludedCategory[];
|
|
23
23
|
}[], selectedVendorId: string | null, mappedCatalog: Record<string, IWarehouseCatalog>): IWarehouseCatalog[];
|
|
24
|
-
|
|
25
|
-
* Group inventory items by category_id for O(1) lookup.
|
|
26
|
-
* Mirrors the warehouse's mappedCatalog. Items with a null/undefined
|
|
27
|
-
* category_id are stored under the key '' (empty string).
|
|
28
|
-
*/
|
|
29
|
-
export declare function getInventoryMappedItems(inventory: IKitchenInventory[]): Record<string, IKitchenInventory[]>;
|
|
24
|
+
export declare function getInventoryMappedItems(inventory: IKitchenInventory[], categories?: IInventoryCategory[]): Record<string, IKitchenInventory[]>;
|
|
30
25
|
/**
|
|
31
26
|
* Filter inventory items by a vendor's included_categories (whitelist).
|
|
32
27
|
* Mirrors getSelectedCatalogs: iterates only the vendor's assigned
|
|
@@ -34,8 +29,13 @@ export declare function getInventoryMappedItems(inventory: IKitchenInventory[]):
|
|
|
34
29
|
* and filters out excluded_items per category.
|
|
35
30
|
*
|
|
36
31
|
* When includedCategories is empty, returns ALL items (no filter).
|
|
32
|
+
*
|
|
33
|
+
* When `categories` is provided, each included category_id (which a vendor
|
|
34
|
+
* may store as the canonical _id or, for legacy vendors, the ref_id) is
|
|
35
|
+
* resolved to the canonical _id before lookup — matching how
|
|
36
|
+
* getInventoryMappedItems buckets the items.
|
|
37
37
|
*/
|
|
38
|
-
export declare function getSelectedVendorInventoryItems(mappedInventory: Record<string, IKitchenInventory[]>, includedCategories: IInventoryIncludedCategory[]): IKitchenInventory[];
|
|
38
|
+
export declare function getSelectedVendorInventoryItems(mappedInventory: Record<string, IKitchenInventory[]>, includedCategories: IInventoryIncludedCategory[], categories?: IInventoryCategory[]): IKitchenInventory[];
|
|
39
39
|
/**
|
|
40
40
|
* Group inventory categories with their items, including a synthetic
|
|
41
41
|
* "Uncategorized" entry for items without a category_id.
|
|
@@ -222,19 +222,27 @@ function getSelectedVendorCatalogs(menus, selectedVendorId, mappedCatalog) {
|
|
|
222
222
|
// Mirrors getSelectedCatalogs / getSelectedVendorCatalogs but works with flat
|
|
223
223
|
// IKitchenInventory[] items (inventory utility) instead of IWarehouseCatalog[].
|
|
224
224
|
// ============================================================================
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
function getInventoryMappedItems(inventory, categories) {
|
|
226
|
+
// Resolve each synced category's ref_id → canonical _id (only when they
|
|
227
|
+
// differ) so items referencing a category by ref_id land under the same
|
|
228
|
+
// bucket as the canonical _id vendors store.
|
|
229
|
+
const refToId = new Map();
|
|
230
|
+
if (categories) {
|
|
231
|
+
for (let i = 0; i < categories.length; i++) {
|
|
232
|
+
const c = categories[i];
|
|
233
|
+
if (c.ref_id && c._id && c.ref_id !== c._id)
|
|
234
|
+
refToId.set(c.ref_id, c._id);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
231
237
|
const map = {};
|
|
232
238
|
for (let i = 0; i < inventory.length; i++) {
|
|
233
239
|
const item = inventory[i];
|
|
234
|
-
const
|
|
240
|
+
const raw = item.category_id ?? '';
|
|
241
|
+
const canonicalId = refToId.get(raw);
|
|
242
|
+
const key = canonicalId ?? raw;
|
|
235
243
|
if (!map[key])
|
|
236
244
|
map[key] = [];
|
|
237
|
-
map[key].push(item);
|
|
245
|
+
map[key].push(canonicalId ? { ...item, category_id: canonicalId } : item);
|
|
238
246
|
}
|
|
239
247
|
return map;
|
|
240
248
|
}
|
|
@@ -245,8 +253,13 @@ function getInventoryMappedItems(inventory) {
|
|
|
245
253
|
* and filters out excluded_items per category.
|
|
246
254
|
*
|
|
247
255
|
* When includedCategories is empty, returns ALL items (no filter).
|
|
256
|
+
*
|
|
257
|
+
* When `categories` is provided, each included category_id (which a vendor
|
|
258
|
+
* may store as the canonical _id or, for legacy vendors, the ref_id) is
|
|
259
|
+
* resolved to the canonical _id before lookup — matching how
|
|
260
|
+
* getInventoryMappedItems buckets the items.
|
|
248
261
|
*/
|
|
249
|
-
function getSelectedVendorInventoryItems(mappedInventory, includedCategories) {
|
|
262
|
+
function getSelectedVendorInventoryItems(mappedInventory, includedCategories, categories) {
|
|
250
263
|
if (!includedCategories || includedCategories.length === 0) {
|
|
251
264
|
const all = [];
|
|
252
265
|
const keys = Object.keys(mappedInventory);
|
|
@@ -258,10 +271,21 @@ function getSelectedVendorInventoryItems(mappedInventory, includedCategories) {
|
|
|
258
271
|
}
|
|
259
272
|
return all;
|
|
260
273
|
}
|
|
274
|
+
// Legacy vendors may store the ref_id instead of the canonical _id, so
|
|
275
|
+
// resolve each included category id the same way before the lookup.
|
|
276
|
+
const refToId = new Map();
|
|
277
|
+
if (categories) {
|
|
278
|
+
for (let i = 0; i < categories.length; i++) {
|
|
279
|
+
const c = categories[i];
|
|
280
|
+
if (c.ref_id && c._id && c.ref_id !== c._id)
|
|
281
|
+
refToId.set(c.ref_id, c._id);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
261
284
|
const result = [];
|
|
262
285
|
for (let i = 0; i < includedCategories.length; i++) {
|
|
263
286
|
const { category_id, excluded_items } = includedCategories[i];
|
|
264
|
-
const
|
|
287
|
+
const canonicalCategoryId = refToId.get(category_id ?? '') ?? category_id ?? '';
|
|
288
|
+
const items = mappedInventory[canonicalCategoryId];
|
|
265
289
|
if (!items)
|
|
266
290
|
continue;
|
|
267
291
|
if (excluded_items.length === 0) {
|
|
@@ -2781,3 +2781,27 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
|
|
|
2781
2781
|
__v: number;
|
|
2782
2782
|
}>;
|
|
2783
2783
|
export declare const TENANT_PURCHASE_ORDER_COLLECTION_NAME = "tenant_purchase_orders";
|
|
2784
|
+
/**
|
|
2785
|
+
* Describes the indexes for `tenant_purchase_orders`. Values are Mongo key
|
|
2786
|
+
* patterns that can be passed straight to `.hint()`.
|
|
2787
|
+
* - `_id`: unique primary key.
|
|
2788
|
+
* - `tenant_id__is_deleted__order_settled_at`: per-tenant purchase order
|
|
2789
|
+
* lookups filtered by is_deleted, by settled time, newest first.
|
|
2790
|
+
* - `tenant_id__is_deleted__createdAt`: per-tenant purchase order lookups
|
|
2791
|
+
* filtered by is_deleted, newest first.
|
|
2792
|
+
*/
|
|
2793
|
+
export declare const TENANT_PURCHASE_ORDER_COLLECTION_INDEXES: {
|
|
2794
|
+
_id: {
|
|
2795
|
+
_id: number;
|
|
2796
|
+
};
|
|
2797
|
+
tenant_id__is_deleted__order_settled_at: {
|
|
2798
|
+
tenant_id: number;
|
|
2799
|
+
is_deleted: number;
|
|
2800
|
+
order_settled_at: number;
|
|
2801
|
+
};
|
|
2802
|
+
tenant_id__is_deleted__createdAt: {
|
|
2803
|
+
tenant_id: number;
|
|
2804
|
+
is_deleted: number;
|
|
2805
|
+
createdAt: number;
|
|
2806
|
+
};
|
|
2807
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TENANT_PURCHASE_ORDER_COLLECTION_NAME = exports.TenantPurchaseOrderSchema = void 0;
|
|
3
|
+
exports.TENANT_PURCHASE_ORDER_COLLECTION_INDEXES = exports.TENANT_PURCHASE_ORDER_COLLECTION_NAME = exports.TenantPurchaseOrderSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const common_models_1 = require("./common-models");
|
|
@@ -137,3 +137,25 @@ exports.TenantPurchaseOrderSchema = new mongoose_1.Schema({
|
|
|
137
137
|
},
|
|
138
138
|
}, { timestamps: true, versionKey: false, minimize: false });
|
|
139
139
|
exports.TENANT_PURCHASE_ORDER_COLLECTION_NAME = 'tenant_purchase_orders';
|
|
140
|
+
/**
|
|
141
|
+
* Describes the indexes for `tenant_purchase_orders`. Values are Mongo key
|
|
142
|
+
* patterns that can be passed straight to `.hint()`.
|
|
143
|
+
* - `_id`: unique primary key.
|
|
144
|
+
* - `tenant_id__is_deleted__order_settled_at`: per-tenant purchase order
|
|
145
|
+
* lookups filtered by is_deleted, by settled time, newest first.
|
|
146
|
+
* - `tenant_id__is_deleted__createdAt`: per-tenant purchase order lookups
|
|
147
|
+
* filtered by is_deleted, newest first.
|
|
148
|
+
*/
|
|
149
|
+
exports.TENANT_PURCHASE_ORDER_COLLECTION_INDEXES = {
|
|
150
|
+
_id: { _id: 1 }, // Unique Index
|
|
151
|
+
tenant_id__is_deleted__order_settled_at: {
|
|
152
|
+
tenant_id: 1,
|
|
153
|
+
is_deleted: 1,
|
|
154
|
+
order_settled_at: -1,
|
|
155
|
+
}, // per-tenant purchase order lookups filtered by is_deleted, by settled time, newest first
|
|
156
|
+
tenant_id__is_deleted__createdAt: {
|
|
157
|
+
tenant_id: 1,
|
|
158
|
+
is_deleted: 1,
|
|
159
|
+
createdAt: -1,
|
|
160
|
+
}, // per-tenant purchase order lookups filtered by is_deleted, newest first
|
|
161
|
+
};
|
|
@@ -930,3 +930,41 @@ export declare const TenantStaffSchema: Schema<any, import("mongoose").Model<any
|
|
|
930
930
|
__v: number;
|
|
931
931
|
}>;
|
|
932
932
|
export declare const TENANT_STAFF_COLLECTION_NAME = "tenant_staffs";
|
|
933
|
+
/**
|
|
934
|
+
* Describes the indexes for `tenant_staffs`. Values are Mongo key patterns that
|
|
935
|
+
* can be passed straight to `.hint()`.
|
|
936
|
+
* - `_id`: unique primary key.
|
|
937
|
+
* - `uid__tenant_id`: staff lookups by uid, scoped by tenant.
|
|
938
|
+
* - `tenant_id__staff_auth_code`: per-tenant staff lookups by auth code.
|
|
939
|
+
* - `tenant_id__allowed_platforms`: per-tenant staff lookups by allowed
|
|
940
|
+
* platform (multikey).
|
|
941
|
+
* - `phone_number__is_disabled__allowed_platforms`: staff lookups by phone
|
|
942
|
+
* number and disabled state, scoped by allowed platform (multikey).
|
|
943
|
+
* - `tenant_id__phone_number`: per-tenant staff lookups by phone number.
|
|
944
|
+
*/
|
|
945
|
+
export declare const TENANT_STAFF_COLLECTION_INDEXES: {
|
|
946
|
+
_id: {
|
|
947
|
+
_id: number;
|
|
948
|
+
};
|
|
949
|
+
uid__tenant_id: {
|
|
950
|
+
uid: number;
|
|
951
|
+
tenant_id: number;
|
|
952
|
+
};
|
|
953
|
+
tenant_id__staff_auth_code: {
|
|
954
|
+
tenant_id: number;
|
|
955
|
+
staff_auth_code: number;
|
|
956
|
+
};
|
|
957
|
+
tenant_id__allowed_platforms: {
|
|
958
|
+
tenant_id: number;
|
|
959
|
+
allowed_platforms: number;
|
|
960
|
+
};
|
|
961
|
+
phone_number__is_disabled__allowed_platforms: {
|
|
962
|
+
phone_number: number;
|
|
963
|
+
is_disabled: number;
|
|
964
|
+
allowed_platforms: number;
|
|
965
|
+
};
|
|
966
|
+
tenant_id__phone_number: {
|
|
967
|
+
tenant_id: number;
|
|
968
|
+
phone_number: number;
|
|
969
|
+
};
|
|
970
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TENANT_STAFF_COLLECTION_NAME = exports.TenantStaffSchema = void 0;
|
|
3
|
+
exports.TENANT_STAFF_COLLECTION_INDEXES = exports.TENANT_STAFF_COLLECTION_NAME = exports.TenantStaffSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const items_1 = require("./items");
|
|
@@ -94,3 +94,39 @@ exports.TenantStaffSchema = new mongoose_1.Schema({
|
|
|
94
94
|
minimize: false,
|
|
95
95
|
});
|
|
96
96
|
exports.TENANT_STAFF_COLLECTION_NAME = 'tenant_staffs';
|
|
97
|
+
/**
|
|
98
|
+
* Describes the indexes for `tenant_staffs`. Values are Mongo key patterns that
|
|
99
|
+
* can be passed straight to `.hint()`.
|
|
100
|
+
* - `_id`: unique primary key.
|
|
101
|
+
* - `uid__tenant_id`: staff lookups by uid, scoped by tenant.
|
|
102
|
+
* - `tenant_id__staff_auth_code`: per-tenant staff lookups by auth code.
|
|
103
|
+
* - `tenant_id__allowed_platforms`: per-tenant staff lookups by allowed
|
|
104
|
+
* platform (multikey).
|
|
105
|
+
* - `phone_number__is_disabled__allowed_platforms`: staff lookups by phone
|
|
106
|
+
* number and disabled state, scoped by allowed platform (multikey).
|
|
107
|
+
* - `tenant_id__phone_number`: per-tenant staff lookups by phone number.
|
|
108
|
+
*/
|
|
109
|
+
exports.TENANT_STAFF_COLLECTION_INDEXES = {
|
|
110
|
+
_id: { _id: 1 }, // Unique Index
|
|
111
|
+
uid__tenant_id: {
|
|
112
|
+
uid: 1,
|
|
113
|
+
tenant_id: 1,
|
|
114
|
+
}, // staff lookups by uid, scoped by tenant
|
|
115
|
+
tenant_id__staff_auth_code: {
|
|
116
|
+
tenant_id: 1,
|
|
117
|
+
staff_auth_code: 1,
|
|
118
|
+
}, // per-tenant staff lookups by auth code
|
|
119
|
+
tenant_id__allowed_platforms: {
|
|
120
|
+
tenant_id: 1,
|
|
121
|
+
allowed_platforms: 1,
|
|
122
|
+
}, // per-tenant staff lookups by allowed platform (multikey)
|
|
123
|
+
phone_number__is_disabled__allowed_platforms: {
|
|
124
|
+
phone_number: 1,
|
|
125
|
+
is_disabled: 1,
|
|
126
|
+
allowed_platforms: 1,
|
|
127
|
+
}, // staff lookups by phone number and disabled state, scoped by allowed platform (multikey)
|
|
128
|
+
tenant_id__phone_number: {
|
|
129
|
+
tenant_id: 1,
|
|
130
|
+
phone_number: 1,
|
|
131
|
+
}, // per-tenant staff lookups by phone number
|
|
132
|
+
};
|
|
@@ -553,3 +553,26 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
553
553
|
__v: number;
|
|
554
554
|
}>;
|
|
555
555
|
export declare const TENANTS_COLLECTION_NAME = "tenants";
|
|
556
|
+
/**
|
|
557
|
+
* Describes the indexes for `tenants`. Values are Mongo key patterns that can
|
|
558
|
+
* be passed straight to `.hint()`.
|
|
559
|
+
* - `_id`: unique primary key.
|
|
560
|
+
* - `staff_ordering_domain`: tenant lookups by staff ordering domain.
|
|
561
|
+
* - `brand_id__active`: per-brand tenant lookups by active state.
|
|
562
|
+
* - `business_website`: tenant lookups by business website.
|
|
563
|
+
*/
|
|
564
|
+
export declare const TENANTS_COLLECTION_INDEXES: {
|
|
565
|
+
_id: {
|
|
566
|
+
_id: number;
|
|
567
|
+
};
|
|
568
|
+
staff_ordering_domain: {
|
|
569
|
+
staff_ordering_domain: number;
|
|
570
|
+
};
|
|
571
|
+
brand_id__active: {
|
|
572
|
+
brand_id: number;
|
|
573
|
+
active: number;
|
|
574
|
+
};
|
|
575
|
+
business_website: {
|
|
576
|
+
business_website: number;
|
|
577
|
+
};
|
|
578
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TENANTS_COLLECTION_NAME = exports.TenantSchema = void 0;
|
|
3
|
+
exports.TENANTS_COLLECTION_INDEXES = exports.TENANTS_COLLECTION_NAME = exports.TenantSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const items_1 = require("./items");
|
|
@@ -791,3 +791,24 @@ exports.TenantSchema = new mongoose_1.Schema({
|
|
|
791
791
|
minimize: false,
|
|
792
792
|
});
|
|
793
793
|
exports.TENANTS_COLLECTION_NAME = 'tenants';
|
|
794
|
+
/**
|
|
795
|
+
* Describes the indexes for `tenants`. Values are Mongo key patterns that can
|
|
796
|
+
* be passed straight to `.hint()`.
|
|
797
|
+
* - `_id`: unique primary key.
|
|
798
|
+
* - `staff_ordering_domain`: tenant lookups by staff ordering domain.
|
|
799
|
+
* - `brand_id__active`: per-brand tenant lookups by active state.
|
|
800
|
+
* - `business_website`: tenant lookups by business website.
|
|
801
|
+
*/
|
|
802
|
+
exports.TENANTS_COLLECTION_INDEXES = {
|
|
803
|
+
_id: { _id: 1 }, // Unique Index
|
|
804
|
+
staff_ordering_domain: {
|
|
805
|
+
staff_ordering_domain: 1,
|
|
806
|
+
}, // tenant lookups by staff ordering domain
|
|
807
|
+
brand_id__active: {
|
|
808
|
+
brand_id: 1,
|
|
809
|
+
active: 1,
|
|
810
|
+
}, // per-brand tenant lookups by active state
|
|
811
|
+
business_website: {
|
|
812
|
+
business_website: 1,
|
|
813
|
+
}, // tenant lookups by business website
|
|
814
|
+
};
|
|
@@ -118,3 +118,21 @@ export declare const WarehouseActivityLogSchema: Schema<any, import("mongoose").
|
|
|
118
118
|
__v: number;
|
|
119
119
|
}>;
|
|
120
120
|
export declare const WAREHOUSE_ACTIVITY_LOGS_COLLECTION_NAME = "warehouse_activity_logs";
|
|
121
|
+
/**
|
|
122
|
+
* Describes the indexes for `warehouse_activity_logs`. Values are Mongo key
|
|
123
|
+
* patterns that can be passed straight to `.hint()`.
|
|
124
|
+
* - `_id`: unique primary key.
|
|
125
|
+
* - `warehouse_id__entity_type__entity_id__createdAt`: per-warehouse activity
|
|
126
|
+
* log lookups by entity, newest first.
|
|
127
|
+
*/
|
|
128
|
+
export declare const WAREHOUSE_ACTIVITY_LOGS_COLLECTION_INDEXES: {
|
|
129
|
+
_id: {
|
|
130
|
+
_id: number;
|
|
131
|
+
};
|
|
132
|
+
warehouse_id__entity_type__entity_id__createdAt: {
|
|
133
|
+
warehouse_id: number;
|
|
134
|
+
entity_type: number;
|
|
135
|
+
entity_id: number;
|
|
136
|
+
createdAt: number;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_ACTIVITY_LOGS_COLLECTION_NAME = exports.WarehouseActivityLogSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_ACTIVITY_LOGS_COLLECTION_INDEXES = exports.WAREHOUSE_ACTIVITY_LOGS_COLLECTION_NAME = exports.WarehouseActivityLogSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouses_1 = require("./warehouses");
|
|
@@ -129,3 +129,19 @@ exports.WarehouseActivityLogSchema = new mongoose_1.Schema({
|
|
|
129
129
|
minimize: false,
|
|
130
130
|
});
|
|
131
131
|
exports.WAREHOUSE_ACTIVITY_LOGS_COLLECTION_NAME = 'warehouse_activity_logs';
|
|
132
|
+
/**
|
|
133
|
+
* Describes the indexes for `warehouse_activity_logs`. Values are Mongo key
|
|
134
|
+
* patterns that can be passed straight to `.hint()`.
|
|
135
|
+
* - `_id`: unique primary key.
|
|
136
|
+
* - `warehouse_id__entity_type__entity_id__createdAt`: per-warehouse activity
|
|
137
|
+
* log lookups by entity, newest first.
|
|
138
|
+
*/
|
|
139
|
+
exports.WAREHOUSE_ACTIVITY_LOGS_COLLECTION_INDEXES = {
|
|
140
|
+
_id: { _id: 1 }, // Unique Index
|
|
141
|
+
warehouse_id__entity_type__entity_id__createdAt: {
|
|
142
|
+
warehouse_id: 1,
|
|
143
|
+
entity_type: 1,
|
|
144
|
+
entity_id: 1,
|
|
145
|
+
createdAt: -1,
|
|
146
|
+
}, // per-warehouse activity log lookups by entity, newest first
|
|
147
|
+
};
|
|
@@ -58,3 +58,20 @@ export declare const WarehouseCategorySchema: Schema<any, import("mongoose").Mod
|
|
|
58
58
|
__v: number;
|
|
59
59
|
}>;
|
|
60
60
|
export declare const WAREHOUSE_CATEGORY_COLLECTION_NAME = "warehouse_categories";
|
|
61
|
+
/**
|
|
62
|
+
* Describes the indexes for `warehouse_categories`. Values are Mongo key
|
|
63
|
+
* patterns that can be passed straight to `.hint()`.
|
|
64
|
+
* - `_id`: unique primary key.
|
|
65
|
+
* - `warehouse_id__ref_id__brand_id`: UNIQUE per (warehouse_id, ref_id,
|
|
66
|
+
* brand_id) — one category per warehouse ref per brand.
|
|
67
|
+
*/
|
|
68
|
+
export declare const WAREHOUSE_CATEGORY_COLLECTION_INDEXES: {
|
|
69
|
+
_id: {
|
|
70
|
+
_id: number;
|
|
71
|
+
};
|
|
72
|
+
warehouse_id__ref_id__brand_id: {
|
|
73
|
+
warehouse_id: number;
|
|
74
|
+
ref_id: number;
|
|
75
|
+
brand_id: number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_CATEGORY_COLLECTION_NAME = exports.WarehouseCategorySchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_CATEGORY_COLLECTION_INDEXES = exports.WAREHOUSE_CATEGORY_COLLECTION_NAME = exports.WarehouseCategorySchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
exports.WarehouseCategorySchema = new mongoose_1.Schema({
|
|
@@ -69,3 +69,18 @@ exports.WarehouseCategorySchema = new mongoose_1.Schema({
|
|
|
69
69
|
minimize: false,
|
|
70
70
|
});
|
|
71
71
|
exports.WAREHOUSE_CATEGORY_COLLECTION_NAME = 'warehouse_categories';
|
|
72
|
+
/**
|
|
73
|
+
* Describes the indexes for `warehouse_categories`. Values are Mongo key
|
|
74
|
+
* patterns that can be passed straight to `.hint()`.
|
|
75
|
+
* - `_id`: unique primary key.
|
|
76
|
+
* - `warehouse_id__ref_id__brand_id`: UNIQUE per (warehouse_id, ref_id,
|
|
77
|
+
* brand_id) — one category per warehouse ref per brand.
|
|
78
|
+
*/
|
|
79
|
+
exports.WAREHOUSE_CATEGORY_COLLECTION_INDEXES = {
|
|
80
|
+
_id: { _id: 1 }, // Unique Index
|
|
81
|
+
warehouse_id__ref_id__brand_id: {
|
|
82
|
+
warehouse_id: 1,
|
|
83
|
+
ref_id: 1,
|
|
84
|
+
brand_id: 1,
|
|
85
|
+
}, // UNIQUE per (warehouse_id, ref_id, brand_id) — one category per warehouse ref per brand
|
|
86
|
+
};
|
|
@@ -57,3 +57,20 @@ export declare const WarehouseClientsSchema: Schema<any, import("mongoose").Mode
|
|
|
57
57
|
__v: number;
|
|
58
58
|
}>;
|
|
59
59
|
export declare const WAREHOUSE_CLIENTS_COLLECTION_NAME = "warehouse_clients";
|
|
60
|
+
/**
|
|
61
|
+
* Describes the indexes for `warehouse_clients`. Values are Mongo key patterns
|
|
62
|
+
* that can be passed straight to `.hint()`.
|
|
63
|
+
* - `_id`: unique primary key.
|
|
64
|
+
* - `warehouse_id__ref_id__type`: warehouse client lookups by ref, scoped by
|
|
65
|
+
* type.
|
|
66
|
+
*/
|
|
67
|
+
export declare const WAREHOUSE_CLIENTS_COLLECTION_INDEXES: {
|
|
68
|
+
_id: {
|
|
69
|
+
_id: number;
|
|
70
|
+
};
|
|
71
|
+
warehouse_id__ref_id__type: {
|
|
72
|
+
warehouse_id: number;
|
|
73
|
+
ref_id: number;
|
|
74
|
+
type: number;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_CLIENTS_COLLECTION_NAME = exports.WarehouseClientsSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_CLIENTS_COLLECTION_INDEXES = exports.WAREHOUSE_CLIENTS_COLLECTION_NAME = exports.WarehouseClientsSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
exports.WarehouseClientsSchema = new mongoose_1.Schema({
|
|
@@ -67,3 +67,18 @@ exports.WarehouseClientsSchema = new mongoose_1.Schema({
|
|
|
67
67
|
minimize: false,
|
|
68
68
|
});
|
|
69
69
|
exports.WAREHOUSE_CLIENTS_COLLECTION_NAME = 'warehouse_clients';
|
|
70
|
+
/**
|
|
71
|
+
* Describes the indexes for `warehouse_clients`. Values are Mongo key patterns
|
|
72
|
+
* that can be passed straight to `.hint()`.
|
|
73
|
+
* - `_id`: unique primary key.
|
|
74
|
+
* - `warehouse_id__ref_id__type`: warehouse client lookups by ref, scoped by
|
|
75
|
+
* type.
|
|
76
|
+
*/
|
|
77
|
+
exports.WAREHOUSE_CLIENTS_COLLECTION_INDEXES = {
|
|
78
|
+
_id: { _id: 1 }, // Unique Index
|
|
79
|
+
warehouse_id__ref_id__type: {
|
|
80
|
+
warehouse_id: 1,
|
|
81
|
+
ref_id: 1,
|
|
82
|
+
type: 1,
|
|
83
|
+
}, // warehouse client lookups by ref, scoped by type
|
|
84
|
+
};
|
|
@@ -226,3 +226,19 @@ export declare const WarehouseCommunicationsSchema: Schema<any, import("mongoose
|
|
|
226
226
|
__v: number;
|
|
227
227
|
}>;
|
|
228
228
|
export declare const WAREHOUSE_COMMUNICATIONS_COLLECTION_NAME = "warehouse_communications";
|
|
229
|
+
/**
|
|
230
|
+
* Describes the indexes for `warehouse_communications`. Values are Mongo key
|
|
231
|
+
* patterns that can be passed straight to `.hint()`.
|
|
232
|
+
* - `_id`: unique primary key.
|
|
233
|
+
* - `warehouse_id__createdAt`: per-warehouse communication lookups newest
|
|
234
|
+
* first.
|
|
235
|
+
*/
|
|
236
|
+
export declare const WAREHOUSE_COMMUNICATIONS_COLLECTION_INDEXES: {
|
|
237
|
+
_id: {
|
|
238
|
+
_id: number;
|
|
239
|
+
};
|
|
240
|
+
warehouse_id__createdAt: {
|
|
241
|
+
warehouse_id: number;
|
|
242
|
+
createdAt: number;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_COMMUNICATIONS_COLLECTION_NAME = exports.WarehouseCommunicationsSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_COMMUNICATIONS_COLLECTION_INDEXES = exports.WAREHOUSE_COMMUNICATIONS_COLLECTION_NAME = exports.WarehouseCommunicationsSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouses_1 = require("./warehouses");
|
|
@@ -213,3 +213,17 @@ exports.WarehouseCommunicationsSchema = new mongoose_1.Schema({
|
|
|
213
213
|
minimize: false,
|
|
214
214
|
});
|
|
215
215
|
exports.WAREHOUSE_COMMUNICATIONS_COLLECTION_NAME = 'warehouse_communications';
|
|
216
|
+
/**
|
|
217
|
+
* Describes the indexes for `warehouse_communications`. Values are Mongo key
|
|
218
|
+
* patterns that can be passed straight to `.hint()`.
|
|
219
|
+
* - `_id`: unique primary key.
|
|
220
|
+
* - `warehouse_id__createdAt`: per-warehouse communication lookups newest
|
|
221
|
+
* first.
|
|
222
|
+
*/
|
|
223
|
+
exports.WAREHOUSE_COMMUNICATIONS_COLLECTION_INDEXES = {
|
|
224
|
+
_id: { _id: 1 }, // Unique Index
|
|
225
|
+
warehouse_id__createdAt: {
|
|
226
|
+
warehouse_id: 1,
|
|
227
|
+
createdAt: -1,
|
|
228
|
+
}, // per-warehouse communication lookups newest first
|
|
229
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Schema } from 'mongoose';
|
|
2
|
-
export declare const WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_NAME = "warehouse_internal_movements";
|
|
3
2
|
export declare const WarehouseInternalMovementIterationSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
4
3
|
_id: false;
|
|
5
4
|
timestamps: false;
|
|
@@ -1833,3 +1832,55 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
1833
1832
|
}> & {
|
|
1834
1833
|
__v: number;
|
|
1835
1834
|
}>;
|
|
1835
|
+
export declare const WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_NAME = "warehouse_internal_movements";
|
|
1836
|
+
/**
|
|
1837
|
+
* Describes the indexes for `warehouse_internal_movements`. Values are Mongo key
|
|
1838
|
+
* patterns that can be passed straight to `.hint()`.
|
|
1839
|
+
* - `_id`: unique primary key.
|
|
1840
|
+
* - `ref_id__ref_type__is_deleted__createdAt`: movement lookups by ref, newest
|
|
1841
|
+
* first.
|
|
1842
|
+
* - `source_id__source_type__is_deleted__createdAt`: movement lookups by
|
|
1843
|
+
* source, newest first.
|
|
1844
|
+
* - `destination_id__destination_type__is_deleted__createdAt`: movement
|
|
1845
|
+
* lookups by destination, newest first.
|
|
1846
|
+
* - `source_id__source_type__is_deleted__items.item_id`: movement lookups by
|
|
1847
|
+
* source containing an item.
|
|
1848
|
+
* - `record_type__destination_id__destination_type__is_deleted__items.item_id`:
|
|
1849
|
+
* movement lookups by record type and destination containing an item.
|
|
1850
|
+
*/
|
|
1851
|
+
export declare const WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_INDEXES: {
|
|
1852
|
+
_id: {
|
|
1853
|
+
_id: number;
|
|
1854
|
+
};
|
|
1855
|
+
ref_id__ref_type__is_deleted__createdAt: {
|
|
1856
|
+
ref_id: number;
|
|
1857
|
+
ref_type: number;
|
|
1858
|
+
is_deleted: number;
|
|
1859
|
+
createdAt: number;
|
|
1860
|
+
};
|
|
1861
|
+
source_id__source_type__is_deleted__createdAt: {
|
|
1862
|
+
source_id: number;
|
|
1863
|
+
source_type: number;
|
|
1864
|
+
is_deleted: number;
|
|
1865
|
+
createdAt: number;
|
|
1866
|
+
};
|
|
1867
|
+
destination_id__destination_type__is_deleted__createdAt: {
|
|
1868
|
+
destination_id: number;
|
|
1869
|
+
destination_type: number;
|
|
1870
|
+
is_deleted: number;
|
|
1871
|
+
createdAt: number;
|
|
1872
|
+
};
|
|
1873
|
+
source_id__source_type__is_deleted__items_item_id: {
|
|
1874
|
+
source_id: number;
|
|
1875
|
+
source_type: number;
|
|
1876
|
+
is_deleted: number;
|
|
1877
|
+
'items.item_id': number;
|
|
1878
|
+
};
|
|
1879
|
+
record_type__destination_id__destination_type__is_deleted__items_item_id: {
|
|
1880
|
+
record_type: number;
|
|
1881
|
+
destination_id: number;
|
|
1882
|
+
destination_type: number;
|
|
1883
|
+
is_deleted: number;
|
|
1884
|
+
'items.item_id': number;
|
|
1885
|
+
};
|
|
1886
|
+
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_INDEXES = exports.WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_NAME = exports.WarehouseInternalMovementsSchema = exports.WarehouseInternalMovementIterationSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const common_models_1 = require("./common-models");
|
|
7
7
|
const warehouse_items_1 = require("./warehouse_items");
|
|
8
|
-
exports.WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_NAME = 'warehouse_internal_movements';
|
|
9
8
|
const WarehouseInternalMovementActorSchema = new mongoose_1.Schema({
|
|
10
9
|
uid: {
|
|
11
10
|
type: String,
|
|
@@ -264,8 +263,8 @@ exports.WarehouseInternalMovementsSchema = new mongoose_1.Schema({
|
|
|
264
263
|
},
|
|
265
264
|
parent_movement_id: {
|
|
266
265
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
267
|
-
required: false,
|
|
268
|
-
ref:
|
|
266
|
+
required: false, // ID of another warehouse internal movement that this movement is a child of (e.g., a dispatched movement may have a parent requested movement)
|
|
267
|
+
ref: 'warehouse_internal_movements',
|
|
269
268
|
},
|
|
270
269
|
notes: {
|
|
271
270
|
type: String,
|
|
@@ -414,3 +413,54 @@ exports.WarehouseInternalMovementsSchema = new mongoose_1.Schema({
|
|
|
414
413
|
versionKey: false,
|
|
415
414
|
minimize: false,
|
|
416
415
|
});
|
|
416
|
+
exports.WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_NAME = 'warehouse_internal_movements';
|
|
417
|
+
/**
|
|
418
|
+
* Describes the indexes for `warehouse_internal_movements`. Values are Mongo key
|
|
419
|
+
* patterns that can be passed straight to `.hint()`.
|
|
420
|
+
* - `_id`: unique primary key.
|
|
421
|
+
* - `ref_id__ref_type__is_deleted__createdAt`: movement lookups by ref, newest
|
|
422
|
+
* first.
|
|
423
|
+
* - `source_id__source_type__is_deleted__createdAt`: movement lookups by
|
|
424
|
+
* source, newest first.
|
|
425
|
+
* - `destination_id__destination_type__is_deleted__createdAt`: movement
|
|
426
|
+
* lookups by destination, newest first.
|
|
427
|
+
* - `source_id__source_type__is_deleted__items.item_id`: movement lookups by
|
|
428
|
+
* source containing an item.
|
|
429
|
+
* - `record_type__destination_id__destination_type__is_deleted__items.item_id`:
|
|
430
|
+
* movement lookups by record type and destination containing an item.
|
|
431
|
+
*/
|
|
432
|
+
// TODO: verify the real query shapes for the items.item_id indexes — they currently look unusual.
|
|
433
|
+
exports.WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_INDEXES = {
|
|
434
|
+
_id: { _id: 1 }, // Unique Index
|
|
435
|
+
ref_id__ref_type__is_deleted__createdAt: {
|
|
436
|
+
ref_id: 1,
|
|
437
|
+
ref_type: 1,
|
|
438
|
+
is_deleted: 1,
|
|
439
|
+
createdAt: -1,
|
|
440
|
+
}, // movement lookups by ref, newest first
|
|
441
|
+
source_id__source_type__is_deleted__createdAt: {
|
|
442
|
+
source_id: 1,
|
|
443
|
+
source_type: 1,
|
|
444
|
+
is_deleted: 1,
|
|
445
|
+
createdAt: -1,
|
|
446
|
+
}, // movement lookups by source, newest first
|
|
447
|
+
destination_id__destination_type__is_deleted__createdAt: {
|
|
448
|
+
destination_id: 1,
|
|
449
|
+
destination_type: 1,
|
|
450
|
+
is_deleted: 1,
|
|
451
|
+
createdAt: -1,
|
|
452
|
+
}, // movement lookups by destination, newest first
|
|
453
|
+
source_id__source_type__is_deleted__items_item_id: {
|
|
454
|
+
source_id: 1,
|
|
455
|
+
source_type: 1,
|
|
456
|
+
is_deleted: 1,
|
|
457
|
+
'items.item_id': 1,
|
|
458
|
+
}, // movement lookups by source containing an item
|
|
459
|
+
record_type__destination_id__destination_type__is_deleted__items_item_id: {
|
|
460
|
+
record_type: 1,
|
|
461
|
+
destination_id: 1,
|
|
462
|
+
destination_type: 1,
|
|
463
|
+
is_deleted: 1,
|
|
464
|
+
'items.item_id': 1,
|
|
465
|
+
}, // movement lookups by record type and destination containing an item
|
|
466
|
+
};
|
|
@@ -163,3 +163,20 @@ export declare const PurchaseOrderReceiptsSchema: Schema<any, import("mongoose")
|
|
|
163
163
|
__v: number;
|
|
164
164
|
}>;
|
|
165
165
|
export declare const WAREHOUSE_PURCHASE_ORDER_RECEIPTS_COLLECTION_NAME = "purchase_order_receipts";
|
|
166
|
+
/**
|
|
167
|
+
* Describes the indexes for `purchase_order_receipts`. Values are Mongo key
|
|
168
|
+
* patterns that can be passed straight to `.hint()`.
|
|
169
|
+
* - `_id`: unique primary key.
|
|
170
|
+
* - `warehouse_id__purchase_order_id__receipt_status`: receipt lookups by
|
|
171
|
+
* purchase order, scoped by receipt status.
|
|
172
|
+
*/
|
|
173
|
+
export declare const WAREHOUSE_PURCHASE_ORDER_RECEIPTS_COLLECTION_INDEXES: {
|
|
174
|
+
_id: {
|
|
175
|
+
_id: number;
|
|
176
|
+
};
|
|
177
|
+
warehouse_id__purchase_order_id__receipt_status: {
|
|
178
|
+
warehouse_id: number;
|
|
179
|
+
purchase_order_id: number;
|
|
180
|
+
receipt_status: number;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_PURCHASE_ORDER_RECEIPTS_COLLECTION_NAME = exports.PurchaseOrderReceiptsSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_PURCHASE_ORDER_RECEIPTS_COLLECTION_INDEXES = exports.WAREHOUSE_PURCHASE_ORDER_RECEIPTS_COLLECTION_NAME = exports.PurchaseOrderReceiptsSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouse_items_1 = require("./warehouse_items");
|
|
@@ -149,3 +149,18 @@ exports.PurchaseOrderReceiptsSchema = new mongoose_1.Schema({
|
|
|
149
149
|
minimize: false,
|
|
150
150
|
});
|
|
151
151
|
exports.WAREHOUSE_PURCHASE_ORDER_RECEIPTS_COLLECTION_NAME = 'purchase_order_receipts';
|
|
152
|
+
/**
|
|
153
|
+
* Describes the indexes for `purchase_order_receipts`. Values are Mongo key
|
|
154
|
+
* patterns that can be passed straight to `.hint()`.
|
|
155
|
+
* - `_id`: unique primary key.
|
|
156
|
+
* - `warehouse_id__purchase_order_id__receipt_status`: receipt lookups by
|
|
157
|
+
* purchase order, scoped by receipt status.
|
|
158
|
+
*/
|
|
159
|
+
exports.WAREHOUSE_PURCHASE_ORDER_RECEIPTS_COLLECTION_INDEXES = {
|
|
160
|
+
_id: { _id: 1 }, // Unique Index
|
|
161
|
+
warehouse_id__purchase_order_id__receipt_status: {
|
|
162
|
+
warehouse_id: 1,
|
|
163
|
+
purchase_order_id: 1,
|
|
164
|
+
receipt_status: 1,
|
|
165
|
+
}, // receipt lookups by purchase order, scoped by receipt status
|
|
166
|
+
};
|
|
@@ -1957,3 +1957,18 @@ export declare const PurchaseOrderRFQSchema: Schema<any, import("mongoose").Mode
|
|
|
1957
1957
|
__v: number;
|
|
1958
1958
|
}>;
|
|
1959
1959
|
export declare const WAREHOUSE_PURCHASE_ORDER_RFQ_COLLECTION_NAME = "purchase_order_rfqs";
|
|
1960
|
+
/**
|
|
1961
|
+
* Describes the indexes for `purchase_order_rfqs`. Values are Mongo key
|
|
1962
|
+
* patterns that can be passed straight to `.hint()`.
|
|
1963
|
+
* - `_id`: unique primary key.
|
|
1964
|
+
* - `warehouse_id__createdAt`: per-warehouse RFQ lookups newest first.
|
|
1965
|
+
*/
|
|
1966
|
+
export declare const WAREHOUSE_PURCHASE_ORDER_RFQ_COLLECTION_INDEXES: {
|
|
1967
|
+
_id: {
|
|
1968
|
+
_id: number;
|
|
1969
|
+
};
|
|
1970
|
+
warehouse_id__createdAt: {
|
|
1971
|
+
warehouse_id: number;
|
|
1972
|
+
createdAt: number;
|
|
1973
|
+
};
|
|
1974
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_PURCHASE_ORDER_RFQ_COLLECTION_NAME = exports.PurchaseOrderRFQSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_PURCHASE_ORDER_RFQ_COLLECTION_INDEXES = exports.WAREHOUSE_PURCHASE_ORDER_RFQ_COLLECTION_NAME = exports.PurchaseOrderRFQSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouse_categories_1 = require("./warehouse_categories");
|
|
@@ -327,3 +327,16 @@ exports.PurchaseOrderRFQSchema = new mongoose_1.Schema({
|
|
|
327
327
|
minimize: false,
|
|
328
328
|
});
|
|
329
329
|
exports.WAREHOUSE_PURCHASE_ORDER_RFQ_COLLECTION_NAME = 'purchase_order_rfqs';
|
|
330
|
+
/**
|
|
331
|
+
* Describes the indexes for `purchase_order_rfqs`. Values are Mongo key
|
|
332
|
+
* patterns that can be passed straight to `.hint()`.
|
|
333
|
+
* - `_id`: unique primary key.
|
|
334
|
+
* - `warehouse_id__createdAt`: per-warehouse RFQ lookups newest first.
|
|
335
|
+
*/
|
|
336
|
+
exports.WAREHOUSE_PURCHASE_ORDER_RFQ_COLLECTION_INDEXES = {
|
|
337
|
+
_id: { _id: 1 }, // Unique Index
|
|
338
|
+
warehouse_id__createdAt: {
|
|
339
|
+
warehouse_id: 1,
|
|
340
|
+
createdAt: -1,
|
|
341
|
+
}, // per-warehouse RFQ lookups newest first
|
|
342
|
+
};
|
|
@@ -232,3 +232,19 @@ export declare const PurchaseOrderVendorReturnsSchema: Schema<any, import("mongo
|
|
|
232
232
|
__v: number;
|
|
233
233
|
}>;
|
|
234
234
|
export declare const WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_NAME = "purchase_order_vendor_returns";
|
|
235
|
+
/**
|
|
236
|
+
* Describes the indexes for `purchase_order_vendor_returns`. Values are Mongo
|
|
237
|
+
* key patterns that can be passed straight to `.hint()`.
|
|
238
|
+
* - `_id`: unique primary key.
|
|
239
|
+
* - `warehouse_id__purchase_order_id`: vendor-return lookups by purchase order,
|
|
240
|
+
* scoped by warehouse.
|
|
241
|
+
*/
|
|
242
|
+
export declare const WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_INDEXES: {
|
|
243
|
+
_id: {
|
|
244
|
+
_id: number;
|
|
245
|
+
};
|
|
246
|
+
warehouse_id__purchase_order_id: {
|
|
247
|
+
warehouse_id: number;
|
|
248
|
+
purchase_order_id: number;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_NAME = exports.PurchaseOrderVendorReturnsSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_INDEXES = exports.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_NAME = exports.PurchaseOrderVendorReturnsSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouse_items_1 = require("./warehouse_items");
|
|
@@ -186,3 +186,17 @@ exports.PurchaseOrderVendorReturnsSchema = new mongoose_1.Schema({
|
|
|
186
186
|
minimize: false,
|
|
187
187
|
});
|
|
188
188
|
exports.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_NAME = 'purchase_order_vendor_returns';
|
|
189
|
+
/**
|
|
190
|
+
* Describes the indexes for `purchase_order_vendor_returns`. Values are Mongo
|
|
191
|
+
* key patterns that can be passed straight to `.hint()`.
|
|
192
|
+
* - `_id`: unique primary key.
|
|
193
|
+
* - `warehouse_id__purchase_order_id`: vendor-return lookups by purchase order,
|
|
194
|
+
* scoped by warehouse.
|
|
195
|
+
*/
|
|
196
|
+
exports.WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_INDEXES = {
|
|
197
|
+
_id: { _id: 1 }, // Unique Index
|
|
198
|
+
warehouse_id__purchase_order_id: {
|
|
199
|
+
warehouse_id: 1,
|
|
200
|
+
purchase_order_id: 1,
|
|
201
|
+
}, // vendor-return lookups by purchase order, scoped by warehouse
|
|
202
|
+
};
|
|
@@ -225,3 +225,28 @@ export declare const WarehouseSaleOrderInvoiceSchema: Schema<any, import("mongoo
|
|
|
225
225
|
}> & {
|
|
226
226
|
__v: number;
|
|
227
227
|
}>;
|
|
228
|
+
/**
|
|
229
|
+
* Describes the indexes for `warehouse_sale_invoices`. Values are Mongo key
|
|
230
|
+
* patterns that can be passed straight to `.hint()`.
|
|
231
|
+
* - `_id`: unique primary key.
|
|
232
|
+
* - `warehouse_id__sale_order_id__doc_kind__status`: invoice lookups by sale
|
|
233
|
+
* order, scoped by doc kind and status.
|
|
234
|
+
* - `warehouse_id__doc_kind__doc_number`: invoice lookups by doc kind and doc
|
|
235
|
+
* number.
|
|
236
|
+
*/
|
|
237
|
+
export declare const WAREHOUSE_SALE_INVOICE_COLLECTION_INDEXES: {
|
|
238
|
+
_id: {
|
|
239
|
+
_id: number;
|
|
240
|
+
};
|
|
241
|
+
warehouse_id__sale_order_id__doc_kind__status: {
|
|
242
|
+
warehouse_id: number;
|
|
243
|
+
sale_order_id: number;
|
|
244
|
+
doc_kind: number;
|
|
245
|
+
status: number;
|
|
246
|
+
};
|
|
247
|
+
warehouse_id__doc_kind__doc_number: {
|
|
248
|
+
warehouse_id: number;
|
|
249
|
+
doc_kind: number;
|
|
250
|
+
doc_number: number;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WarehouseSaleOrderInvoiceSchema = exports.WAREHOUSE_SALE_INVOICE_COLLECTION_NAME = void 0;
|
|
3
|
+
exports.WAREHOUSE_SALE_INVOICE_COLLECTION_INDEXES = exports.WarehouseSaleOrderInvoiceSchema = exports.WAREHOUSE_SALE_INVOICE_COLLECTION_NAME = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouse_items_1 = require("./warehouse_items");
|
|
@@ -207,3 +207,26 @@ exports.WarehouseSaleOrderInvoiceSchema = new mongoose_1.Schema({
|
|
|
207
207
|
versionKey: false,
|
|
208
208
|
minimize: false,
|
|
209
209
|
});
|
|
210
|
+
/**
|
|
211
|
+
* Describes the indexes for `warehouse_sale_invoices`. Values are Mongo key
|
|
212
|
+
* patterns that can be passed straight to `.hint()`.
|
|
213
|
+
* - `_id`: unique primary key.
|
|
214
|
+
* - `warehouse_id__sale_order_id__doc_kind__status`: invoice lookups by sale
|
|
215
|
+
* order, scoped by doc kind and status.
|
|
216
|
+
* - `warehouse_id__doc_kind__doc_number`: invoice lookups by doc kind and doc
|
|
217
|
+
* number.
|
|
218
|
+
*/
|
|
219
|
+
exports.WAREHOUSE_SALE_INVOICE_COLLECTION_INDEXES = {
|
|
220
|
+
_id: { _id: 1 }, // Unique Index
|
|
221
|
+
warehouse_id__sale_order_id__doc_kind__status: {
|
|
222
|
+
warehouse_id: 1,
|
|
223
|
+
sale_order_id: 1,
|
|
224
|
+
doc_kind: 1,
|
|
225
|
+
status: 1,
|
|
226
|
+
}, // invoice lookups by sale order, scoped by doc kind and status
|
|
227
|
+
warehouse_id__doc_kind__doc_number: {
|
|
228
|
+
warehouse_id: 1,
|
|
229
|
+
doc_kind: 1,
|
|
230
|
+
doc_number: 1,
|
|
231
|
+
}, // invoice lookups by doc kind and doc number
|
|
232
|
+
};
|
|
@@ -1957,3 +1957,18 @@ export declare const SaleOrderRFQSchema: Schema<any, import("mongoose").Model<an
|
|
|
1957
1957
|
__v: number;
|
|
1958
1958
|
}>;
|
|
1959
1959
|
export declare const WAREHOUSE_SALE_ORDER_RFQ_COLLECTION_NAME = "warehouse_sale_order_rfqs";
|
|
1960
|
+
/**
|
|
1961
|
+
* Describes the indexes for `warehouse_sale_order_rfqs`. Values are Mongo key
|
|
1962
|
+
* patterns that can be passed straight to `.hint()`.
|
|
1963
|
+
* - `_id`: unique primary key.
|
|
1964
|
+
* - `warehouse_id__createdAt`: per-warehouse RFQ lookups newest first.
|
|
1965
|
+
*/
|
|
1966
|
+
export declare const WAREHOUSE_SALE_ORDER_RFQ_COLLECTION_INDEXES: {
|
|
1967
|
+
_id: {
|
|
1968
|
+
_id: number;
|
|
1969
|
+
};
|
|
1970
|
+
warehouse_id__createdAt: {
|
|
1971
|
+
warehouse_id: number;
|
|
1972
|
+
createdAt: number;
|
|
1973
|
+
};
|
|
1974
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_SALE_ORDER_RFQ_COLLECTION_NAME = exports.SaleOrderRFQSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_SALE_ORDER_RFQ_COLLECTION_INDEXES = exports.WAREHOUSE_SALE_ORDER_RFQ_COLLECTION_NAME = exports.SaleOrderRFQSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const warehouse_categories_1 = require("./warehouse_categories");
|
|
@@ -328,3 +328,16 @@ exports.SaleOrderRFQSchema = new mongoose_1.Schema({
|
|
|
328
328
|
minimize: false,
|
|
329
329
|
});
|
|
330
330
|
exports.WAREHOUSE_SALE_ORDER_RFQ_COLLECTION_NAME = 'warehouse_sale_order_rfqs';
|
|
331
|
+
/**
|
|
332
|
+
* Describes the indexes for `warehouse_sale_order_rfqs`. Values are Mongo key
|
|
333
|
+
* patterns that can be passed straight to `.hint()`.
|
|
334
|
+
* - `_id`: unique primary key.
|
|
335
|
+
* - `warehouse_id__createdAt`: per-warehouse RFQ lookups newest first.
|
|
336
|
+
*/
|
|
337
|
+
exports.WAREHOUSE_SALE_ORDER_RFQ_COLLECTION_INDEXES = {
|
|
338
|
+
_id: { _id: 1 }, // Unique Index
|
|
339
|
+
warehouse_id__createdAt: {
|
|
340
|
+
warehouse_id: 1,
|
|
341
|
+
createdAt: -1,
|
|
342
|
+
}, // per-warehouse RFQ lookups newest first
|
|
343
|
+
};
|
|
@@ -63,3 +63,34 @@ export declare const WarehouseStaffSchema: Schema<any, import("mongoose").Model<
|
|
|
63
63
|
__v: number;
|
|
64
64
|
}>;
|
|
65
65
|
export declare const WAREHOUSE_STAFF_COLLECTION_NAME = "warehouse_staffs";
|
|
66
|
+
/**
|
|
67
|
+
* Describes the indexes for `warehouse_staffs`. Values are Mongo key patterns
|
|
68
|
+
* that can be passed straight to `.hint()`.
|
|
69
|
+
* - `_id`: unique primary key.
|
|
70
|
+
* - `warehouse_id__uid`: per-warehouse staff lookups by uid.
|
|
71
|
+
* - `warehouse_id__staff_auth_code`: per-warehouse staff lookups by auth code.
|
|
72
|
+
* - `phone_number__is_disabled`: staff lookups by phone number and disabled
|
|
73
|
+
* state.
|
|
74
|
+
* - `uid__role`: staff lookups by uid and role.
|
|
75
|
+
*/
|
|
76
|
+
export declare const WAREHOUSE_STAFF_COLLECTION_INDEXES: {
|
|
77
|
+
_id: {
|
|
78
|
+
_id: number;
|
|
79
|
+
};
|
|
80
|
+
warehouse_id__uid: {
|
|
81
|
+
warehouse_id: number;
|
|
82
|
+
uid: number;
|
|
83
|
+
};
|
|
84
|
+
warehouse_id__staff_auth_code: {
|
|
85
|
+
warehouse_id: number;
|
|
86
|
+
staff_auth_code: number;
|
|
87
|
+
};
|
|
88
|
+
phone_number__is_disabled: {
|
|
89
|
+
phone_number: number;
|
|
90
|
+
is_disabled: number;
|
|
91
|
+
};
|
|
92
|
+
uid__role: {
|
|
93
|
+
uid: number;
|
|
94
|
+
role: number;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_STAFF_COLLECTION_NAME = exports.WarehouseStaffSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_STAFF_COLLECTION_INDEXES = exports.WAREHOUSE_STAFF_COLLECTION_NAME = exports.WarehouseStaffSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
exports.WarehouseStaffSchema = new mongoose_1.Schema({
|
|
@@ -76,3 +76,32 @@ exports.WarehouseStaffSchema = new mongoose_1.Schema({
|
|
|
76
76
|
minimize: false,
|
|
77
77
|
});
|
|
78
78
|
exports.WAREHOUSE_STAFF_COLLECTION_NAME = 'warehouse_staffs';
|
|
79
|
+
/**
|
|
80
|
+
* Describes the indexes for `warehouse_staffs`. Values are Mongo key patterns
|
|
81
|
+
* that can be passed straight to `.hint()`.
|
|
82
|
+
* - `_id`: unique primary key.
|
|
83
|
+
* - `warehouse_id__uid`: per-warehouse staff lookups by uid.
|
|
84
|
+
* - `warehouse_id__staff_auth_code`: per-warehouse staff lookups by auth code.
|
|
85
|
+
* - `phone_number__is_disabled`: staff lookups by phone number and disabled
|
|
86
|
+
* state.
|
|
87
|
+
* - `uid__role`: staff lookups by uid and role.
|
|
88
|
+
*/
|
|
89
|
+
exports.WAREHOUSE_STAFF_COLLECTION_INDEXES = {
|
|
90
|
+
_id: { _id: 1 }, // Unique Index
|
|
91
|
+
warehouse_id__uid: {
|
|
92
|
+
warehouse_id: 1,
|
|
93
|
+
uid: 1,
|
|
94
|
+
}, // per-warehouse staff lookups by uid
|
|
95
|
+
warehouse_id__staff_auth_code: {
|
|
96
|
+
warehouse_id: 1,
|
|
97
|
+
staff_auth_code: 1,
|
|
98
|
+
}, // per-warehouse staff lookups by auth code
|
|
99
|
+
phone_number__is_disabled: {
|
|
100
|
+
phone_number: 1,
|
|
101
|
+
is_disabled: 1,
|
|
102
|
+
}, // staff lookups by phone number and disabled state
|
|
103
|
+
uid__role: {
|
|
104
|
+
uid: 1,
|
|
105
|
+
role: 1,
|
|
106
|
+
}, // staff lookups by uid and role
|
|
107
|
+
};
|
|
@@ -172,3 +172,22 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
172
172
|
__v: number;
|
|
173
173
|
}>;
|
|
174
174
|
export declare const WAREHOUSE_SETTINGS_COLLECTION_NAME = "warehouses";
|
|
175
|
+
/**
|
|
176
|
+
* Describes the indexes for `warehouses`. Values are Mongo key patterns that
|
|
177
|
+
* can be passed straight to `.hint()`.
|
|
178
|
+
* - `_id`: unique primary key.
|
|
179
|
+
* - `brand_id__active`: per-brand warehouse lookups by active state.
|
|
180
|
+
* - `createdAt`: warehouse lookups newest first.
|
|
181
|
+
*/
|
|
182
|
+
export declare const WAREHOUSE_SETTINGS_COLLECTION_INDEXES: {
|
|
183
|
+
_id: {
|
|
184
|
+
_id: number;
|
|
185
|
+
};
|
|
186
|
+
brand_id__active: {
|
|
187
|
+
brand_id: number;
|
|
188
|
+
active: number;
|
|
189
|
+
};
|
|
190
|
+
createdAt: {
|
|
191
|
+
createdAt: number;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAREHOUSE_SETTINGS_COLLECTION_NAME = exports.WarehouseSchema = void 0;
|
|
3
|
+
exports.WAREHOUSE_SETTINGS_COLLECTION_INDEXES = exports.WAREHOUSE_SETTINGS_COLLECTION_NAME = exports.WarehouseSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
exports.WarehouseSchema = new mongoose_1.Schema({
|
|
@@ -237,3 +237,20 @@ exports.WarehouseSchema = new mongoose_1.Schema({
|
|
|
237
237
|
minimize: false,
|
|
238
238
|
});
|
|
239
239
|
exports.WAREHOUSE_SETTINGS_COLLECTION_NAME = 'warehouses';
|
|
240
|
+
/**
|
|
241
|
+
* Describes the indexes for `warehouses`. Values are Mongo key patterns that
|
|
242
|
+
* can be passed straight to `.hint()`.
|
|
243
|
+
* - `_id`: unique primary key.
|
|
244
|
+
* - `brand_id__active`: per-brand warehouse lookups by active state.
|
|
245
|
+
* - `createdAt`: warehouse lookups newest first.
|
|
246
|
+
*/
|
|
247
|
+
exports.WAREHOUSE_SETTINGS_COLLECTION_INDEXES = {
|
|
248
|
+
_id: { _id: 1 }, // Unique Index
|
|
249
|
+
brand_id__active: {
|
|
250
|
+
brand_id: 1,
|
|
251
|
+
active: 1,
|
|
252
|
+
}, // per-brand warehouse lookups by active state
|
|
253
|
+
createdAt: {
|
|
254
|
+
createdAt: -1,
|
|
255
|
+
}, // warehouse lookups newest first
|
|
256
|
+
};
|