@unchainedshop/core-orders 5.0.0-alpha.10 → 5.0.0-alpha.11
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.d.ts +2 -0
- package/lib/db/OrderPositionsCollection.d.ts +2 -0
- package/lib/db/OrderPositionsCollection.js +1 -0
- package/lib/module/configureOrderPositionsModule.d.ts +2 -0
- package/lib/module/configureOrderPositionsModule.js +5 -2
- package/lib/module/configureOrdersModule.d.ts +2 -0
- package/package.json +4 -4
|
@@ -19,5 +19,7 @@ export type OrderDeliveryDiscount = Omit<Price, '_id'> & {
|
|
|
19
19
|
_id: string;
|
|
20
20
|
discountId: string;
|
|
21
21
|
item: OrderDelivery;
|
|
22
|
+
isTaxable?: boolean;
|
|
23
|
+
isNetPrice?: boolean;
|
|
22
24
|
};
|
|
23
25
|
export declare const OrderDeliveriesCollection: (db: mongodb.Db) => Promise<mongodb.Collection<OrderDelivery>>;
|
|
@@ -18,5 +18,7 @@ export type OrderPosition = {
|
|
|
18
18
|
export type OrderPositionDiscount = Omit<Price, '_id'> & {
|
|
19
19
|
discountId: string;
|
|
20
20
|
item: OrderPosition;
|
|
21
|
+
isTaxable?: boolean;
|
|
22
|
+
isNetPrice?: boolean;
|
|
21
23
|
};
|
|
22
24
|
export declare const OrderPositionsCollection: (db: mongodb.Db) => Promise<mongodb.Collection<OrderPosition>>;
|
|
@@ -27,6 +27,8 @@ export declare const configureOrderPositionsModule: ({ OrderPositions, }: {
|
|
|
27
27
|
orderId: string;
|
|
28
28
|
} | {
|
|
29
29
|
orderIds: string[];
|
|
30
|
+
} | {
|
|
31
|
+
quotationId: string;
|
|
30
32
|
}) => Promise<OrderPosition[]>;
|
|
31
33
|
delete: (orderPositionId: string) => Promise<mongodb.WithId<OrderPosition> | null>;
|
|
32
34
|
removePositions: ({ orderId }: {
|
|
@@ -16,8 +16,10 @@ export const configureOrderPositionsModule = ({ OrderPositions, }) => {
|
|
|
16
16
|
findOrderPositions: async (query) => {
|
|
17
17
|
if ('orderIds' in query && !query.orderIds.length)
|
|
18
18
|
return [];
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const selector = 'quotationId' in query
|
|
20
|
+
? { quotationId: query.quotationId }
|
|
21
|
+
: { orderId: 'orderIds' in query ? { $in: query.orderIds } : query.orderId };
|
|
22
|
+
const positions = OrderPositions.find({ ...selector, quantity: { $gt: 0 } }, { sort: { created: 1, _id: 1 } });
|
|
21
23
|
return positions.toArray();
|
|
22
24
|
},
|
|
23
25
|
delete: async (orderPositionId) => {
|
|
@@ -110,6 +112,7 @@ export const configureOrderPositionsModule = ({ OrderPositions, }) => {
|
|
|
110
112
|
originalProductId,
|
|
111
113
|
configuration: configuration ?? null,
|
|
112
114
|
...scope,
|
|
115
|
+
quotationId: scope.quotationId ?? { $not: { $type: 'string' } },
|
|
113
116
|
};
|
|
114
117
|
const upsertedOrderPosition = (await OrderPositions.findOneAndUpdate(selector, {
|
|
115
118
|
$set: {
|
|
@@ -53,6 +53,8 @@ export declare const configureOrdersModule: ({ db, migrationRepository, options:
|
|
|
53
53
|
orderId: string;
|
|
54
54
|
} | {
|
|
55
55
|
orderIds: string[];
|
|
56
|
+
} | {
|
|
57
|
+
quotationId: string;
|
|
56
58
|
}) => Promise<import("../db/OrderPositionsCollection.ts").OrderPosition[]>;
|
|
57
59
|
delete: (orderPositionId: string) => Promise<mongodb.WithId<import("../db/OrderPositionsCollection.ts").OrderPosition> | null>;
|
|
58
60
|
removePositions: ({ orderId }: {
|
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.
|
|
4
|
+
"version": "5.0.0-alpha.11",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib"
|
|
7
7
|
],
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@unchainedshop/events": "^5.0.0-alpha.
|
|
42
|
-
"@unchainedshop/mongodb": "^5.0.0-alpha.
|
|
43
|
-
"@unchainedshop/utils": "^5.0.0-alpha.
|
|
41
|
+
"@unchainedshop/events": "^5.0.0-alpha.11",
|
|
42
|
+
"@unchainedshop/mongodb": "^5.0.0-alpha.11",
|
|
43
|
+
"@unchainedshop/utils": "^5.0.0-alpha.11"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^26.2.0",
|