@unchainedshop/core-orders 5.0.0-alpha.3 → 5.0.0-alpha.4

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.
@@ -14,7 +14,7 @@ export const configureOrderDiscountsModule = ({ OrderDiscounts, }) => {
14
14
  return OrderDiscounts.findOne(buildFindOrderDiscountByIdSelector(discountId), options);
15
15
  },
16
16
  findOrderDiscounts: async ({ orderId }) => {
17
- const discounts = OrderDiscounts.find({ orderId }, { sort: { created: 1 } });
17
+ const discounts = OrderDiscounts.find({ orderId }, { sort: { created: 1, _id: 1 } });
18
18
  return discounts.toArray();
19
19
  },
20
20
  create: async (doc) => {
@@ -1,7 +1,7 @@
1
1
  import { emit, registerEvents } from '@unchainedshop/events';
2
2
  import { generateDbFilterById, generateDbObjectId, mongodb } from '@unchainedshop/mongodb';
3
3
  import { OrderPaymentStatus } from "../db/OrderPaymentsCollection.js";
4
- const ORDER_PAYMENT_EVENTS = ['ORDER_UPDATE_PAYMENT', 'ORDER_SIGN_PAYMENT', 'ORDER_PAY'];
4
+ const ORDER_PAYMENT_EVENTS = ['ORDER_UPDATE_PAYMENT', 'ORDER_PAY'];
5
5
  export const buildFindOrderPaymentByIdSelector = (orderPaymentId) => generateDbFilterById(orderPaymentId);
6
6
  export const configureOrderPaymentsModule = ({ OrderPayments, }) => {
7
7
  registerEvents(ORDER_PAYMENT_EVENTS);
@@ -14,7 +14,7 @@ export const configureOrderPositionsModule = ({ OrderPositions, }) => {
14
14
  return OrderPositions.findOne(buildFindOrderPositionByIdSelector(itemId), options);
15
15
  },
16
16
  findOrderPositions: async ({ orderId }) => {
17
- const positions = OrderPositions.find({ orderId, quantity: { $gt: 0 } }, { sort: { created: 1 } });
17
+ const positions = OrderPositions.find({ orderId, quantity: { $gt: 0 } }, { sort: { created: 1, _id: 1 } });
18
18
  return positions.toArray();
19
19
  },
20
20
  delete: async (orderPositionId) => {
@@ -29,12 +29,13 @@ export const configureOrdersModuleQueries = ({ Orders }) => {
29
29
  const options = {
30
30
  sort: {
31
31
  updated: -1,
32
+ _id: -1,
32
33
  },
33
34
  };
34
35
  return Orders.findOne(selector, options);
35
36
  },
36
37
  findCarts: async ({ userIds }, options) => {
37
- return Orders.find({ status: { $eq: null }, userId: { $in: userIds } }, { sort: { updated: -1 }, ...options }).toArray();
38
+ return Orders.find({ status: { $eq: null }, userId: { $in: userIds } }, { sort: { updated: -1, _id: -1 }, ...options }).toArray();
38
39
  },
39
40
  count: async (query) => {
40
41
  const orderCount = await Orders.countDocuments(buildFindSelector(query));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-orders",
3
3
  "description": "Order management module for the Unchained Engine",
4
- "version": "5.0.0-alpha.3",
4
+ "version": "5.0.0-alpha.4",
5
5
  "main": "lib/orders-index.js",
6
6
  "types": "lib/orders-index.d.ts",
7
7
  "type": "module",
@@ -41,6 +41,6 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^26.2.0",
44
- "typescript": "^5.8.3"
44
+ "typescript": "^6.0.3"
45
45
  }
46
46
  }