@unchainedshop/core-orders 5.0.0-alpha.1 → 5.0.0-alpha.2
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/db/OrderDeliveriesCollection.js +1 -1
- package/lib/db/OrderDiscountsCollection.js +1 -1
- package/lib/db/OrderPaymentsCollection.js +2 -3
- package/lib/db/OrderPositionsCollection.js +1 -1
- package/lib/db/OrdersCollection.js +25 -28
- package/lib/module/buildFindSelector.js +1 -2
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export const OrderDeliveriesCollection = async (db) => {
|
|
|
8
8
|
const OrderDeliveries = db.collection('order_deliveries');
|
|
9
9
|
await buildDbIndexes(OrderDeliveries, [
|
|
10
10
|
{ index: { orderId: 1 } },
|
|
11
|
-
{ index: {
|
|
11
|
+
{ index: { deliveryProviderId: 1 } },
|
|
12
12
|
]);
|
|
13
13
|
return OrderDeliveries;
|
|
14
14
|
};
|
|
@@ -3,7 +3,7 @@ export const OrderDiscountsCollection = async (db) => {
|
|
|
3
3
|
const OrderDiscounts = db.collection('order_discounts');
|
|
4
4
|
await buildDbIndexes(OrderDiscounts, [
|
|
5
5
|
{ index: { orderId: 1 } },
|
|
6
|
-
{ index: {
|
|
6
|
+
{ index: { code: 1 }, options: { sparse: true } },
|
|
7
7
|
]);
|
|
8
8
|
return OrderDiscounts;
|
|
9
9
|
};
|
|
@@ -8,9 +8,8 @@ export const OrderPaymentsCollection = async (db) => {
|
|
|
8
8
|
const OrderPayments = db.collection('order_payments');
|
|
9
9
|
await buildDbIndexes(OrderPayments, [
|
|
10
10
|
{ index: { orderId: 1 } },
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
},
|
|
11
|
+
{ index: { paymentProviderId: 1 } },
|
|
12
|
+
{ index: { transactionId: 1 }, options: { sparse: true } },
|
|
14
13
|
]);
|
|
15
14
|
return OrderPayments;
|
|
16
15
|
};
|
|
@@ -2,8 +2,8 @@ import { mongodb, buildDbIndexes } from '@unchainedshop/mongodb';
|
|
|
2
2
|
export const OrderPositionsCollection = async (db) => {
|
|
3
3
|
const OrderPositions = db.collection('order_positions');
|
|
4
4
|
await buildDbIndexes(OrderPositions, [
|
|
5
|
+
{ index: { orderId: 1, quantity: 1 } },
|
|
5
6
|
{ index: { productId: 1 } },
|
|
6
|
-
{ index: { orderId: 1 } },
|
|
7
7
|
]);
|
|
8
8
|
return OrderPositions;
|
|
9
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mongodb, buildDbIndexes,
|
|
1
|
+
import { mongodb, buildDbIndexes, } from '@unchainedshop/mongodb';
|
|
2
2
|
export const OrderStatus = {
|
|
3
3
|
PENDING: 'PENDING',
|
|
4
4
|
CONFIRMED: 'CONFIRMED',
|
|
@@ -7,36 +7,33 @@ export const OrderStatus = {
|
|
|
7
7
|
};
|
|
8
8
|
export const OrdersCollection = async (db) => {
|
|
9
9
|
const Orders = db.collection('orders');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
status: 1,
|
|
29
|
-
},
|
|
30
|
-
name: 'order_fulltext_search',
|
|
10
|
+
await buildDbIndexes(Orders, [
|
|
11
|
+
{
|
|
12
|
+
index: {
|
|
13
|
+
_id: 'text',
|
|
14
|
+
userId: 'text',
|
|
15
|
+
orderNumber: 'text',
|
|
16
|
+
status: 'text',
|
|
17
|
+
'contact.emailAddress': 'text',
|
|
18
|
+
'contact.telNumber': 'text',
|
|
19
|
+
},
|
|
20
|
+
options: {
|
|
21
|
+
weights: {
|
|
22
|
+
_id: 8,
|
|
23
|
+
userId: 3,
|
|
24
|
+
orderNumber: 6,
|
|
25
|
+
'contact.telNumber': 5,
|
|
26
|
+
'contact.emailAddress': 4,
|
|
27
|
+
status: 1,
|
|
31
28
|
},
|
|
29
|
+
name: 'order_fulltext_search',
|
|
32
30
|
},
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
},
|
|
32
|
+
]);
|
|
35
33
|
await buildDbIndexes(Orders, [
|
|
36
|
-
{ index: {
|
|
37
|
-
{ index: {
|
|
38
|
-
{ index: {
|
|
39
|
-
{ index: { orderNumber: 1 } },
|
|
34
|
+
{ index: { userId: 1, status: 1 } },
|
|
35
|
+
{ index: { status: 1, updated: 1 } },
|
|
36
|
+
{ index: { orderNumber: 1 }, options: { sparse: true } },
|
|
40
37
|
]);
|
|
41
38
|
return Orders;
|
|
42
39
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mongodb } from '@unchainedshop/mongodb';
|
|
2
2
|
export const buildFindSelector = ({ includeCarts, status, userId, queryString, paymentIds, deliveryIds, dateRange, orderIds, }) => {
|
|
3
3
|
const selector = {};
|
|
4
4
|
if (userId) {
|
|
@@ -30,7 +30,6 @@ export const buildFindSelector = ({ includeCarts, status, userId, queryString, p
|
|
|
30
30
|
selector.status = { $ne: null };
|
|
31
31
|
}
|
|
32
32
|
if (queryString) {
|
|
33
|
-
assertDocumentDBCompatMode();
|
|
34
33
|
selector.$text = { $search: queryString };
|
|
35
34
|
}
|
|
36
35
|
return selector;
|
package/package.json
CHANGED