@medusajs/medusa 1.3.9 → 1.4.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/routes/admin/batch/create-batch-job.js +10 -7
- package/dist/api/routes/admin/batch/create-batch-job.js.map +1 -1
- package/dist/api/routes/admin/index.js +6 -4
- package/dist/api/routes/admin/index.js.map +1 -1
- package/dist/api/routes/admin/price-lists/create-price-list.d.ts +4 -0
- package/dist/api/routes/admin/price-lists/create-price-list.js +16 -1
- package/dist/api/routes/admin/price-lists/create-price-list.js.map +1 -1
- package/dist/api/routes/admin/price-lists/index.d.ts +2 -1
- package/dist/api/routes/admin/price-lists/index.js +8 -1
- package/dist/api/routes/admin/price-lists/index.js.map +1 -1
- package/dist/api/routes/admin/price-lists/update-price-list.d.ts +4 -0
- package/dist/api/routes/admin/price-lists/update-price-list.js +16 -1
- package/dist/api/routes/admin/price-lists/update-price-list.js.map +1 -1
- package/dist/api/routes/admin/products/update-variant.js +1 -0
- package/dist/api/routes/admin/products/update-variant.js.map +1 -1
- package/dist/api/routes/admin/regions/create-region.d.ts +4 -0
- package/dist/api/routes/admin/regions/create-region.js +16 -1
- package/dist/api/routes/admin/regions/create-region.js.map +1 -1
- package/dist/api/routes/admin/regions/index.d.ts +2 -1
- package/dist/api/routes/admin/regions/index.js +5 -1
- package/dist/api/routes/admin/regions/index.js.map +1 -1
- package/dist/api/routes/admin/regions/update-region.d.ts +4 -0
- package/dist/api/routes/admin/regions/update-region.js +16 -1
- package/dist/api/routes/admin/regions/update-region.js.map +1 -1
- package/dist/api/routes/admin/shipping-options/create-shipping-option.d.ts +4 -0
- package/dist/api/routes/admin/shipping-options/create-shipping-option.js +15 -0
- package/dist/api/routes/admin/shipping-options/create-shipping-option.js.map +1 -1
- package/dist/api/routes/admin/shipping-options/index.d.ts +2 -1
- package/dist/api/routes/admin/shipping-options/index.js +5 -1
- package/dist/api/routes/admin/shipping-options/index.js.map +1 -1
- package/dist/api/routes/admin/shipping-options/update-shipping-option.d.ts +4 -0
- package/dist/api/routes/admin/shipping-options/update-shipping-option.js +15 -0
- package/dist/api/routes/admin/shipping-options/update-shipping-option.js.map +1 -1
- package/dist/helpers/test-request.js +27 -4
- package/dist/helpers/test-request.js.map +1 -1
- package/dist/interfaces/price-selection-strategy.d.ts +4 -0
- package/dist/interfaces/price-selection-strategy.js.map +1 -1
- package/dist/loaders/feature-flags/index.d.ts +1 -0
- package/dist/loaders/feature-flags/index.js +18 -3
- package/dist/loaders/feature-flags/index.js.map +1 -1
- package/dist/loaders/feature-flags/order-editing.d.ts +3 -0
- package/dist/loaders/feature-flags/order-editing.js +10 -0
- package/dist/loaders/feature-flags/order-editing.js.map +1 -0
- package/dist/migrations/1663059812399-order_editing.d.ts +7 -0
- package/dist/migrations/1663059812399-order_editing.js +112 -0
- package/dist/migrations/1663059812399-order_editing.js.map +1 -0
- package/dist/models/currency.d.ts +4 -0
- package/dist/models/currency.js +12 -0
- package/dist/models/currency.js.map +1 -1
- package/dist/models/custom-shipping-option.d.ts +3 -0
- package/dist/models/custom-shipping-option.js +3 -0
- package/dist/models/custom-shipping-option.js.map +1 -1
- package/dist/models/line-item.d.ts +4 -0
- package/dist/models/line-item.js +12 -0
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/money-amount.d.ts +2 -2
- package/dist/models/money-amount.js.map +1 -1
- package/dist/models/order-edit.d.ts +111 -0
- package/dist/models/order-edit.js +204 -0
- package/dist/models/order-edit.js.map +1 -0
- package/dist/models/order-item-change.d.ts +60 -0
- package/dist/models/order-item-change.js +143 -0
- package/dist/models/order-item-change.js.map +1 -0
- package/dist/models/order.d.ts +7 -0
- package/dist/models/order.js +16 -0
- package/dist/models/order.js.map +1 -1
- package/dist/models/price-list.d.ts +5 -0
- package/dist/models/price-list.js +13 -0
- package/dist/models/price-list.js.map +1 -1
- package/dist/models/region.d.ts +4 -0
- package/dist/models/region.js +12 -0
- package/dist/models/region.js.map +1 -1
- package/dist/models/shipping-method.d.ts +4 -0
- package/dist/models/shipping-method.js +12 -0
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/shipping-option.d.ts +4 -0
- package/dist/models/shipping-option.js +12 -0
- package/dist/models/shipping-option.js.map +1 -1
- package/dist/repositories/currency.d.ts +1 -1
- package/dist/repositories/currency.js +2 -2
- package/dist/repositories/currency.js.map +1 -1
- package/dist/repositories/money-amount.d.ts +1 -1
- package/dist/repositories/money-amount.js +8 -4
- package/dist/repositories/money-amount.js.map +1 -1
- package/dist/repositories/order-edit.d.ts +4 -0
- package/dist/repositories/order-edit.js +38 -0
- package/dist/repositories/order-edit.js.map +1 -0
- package/dist/repositories/order-item-change.d.ts +4 -0
- package/dist/repositories/order-item-change.js +38 -0
- package/dist/repositories/order-item-change.js.map +1 -0
- package/dist/services/batch-job.js +4 -2
- package/dist/services/batch-job.js.map +1 -1
- package/dist/services/cart.js +83 -74
- package/dist/services/cart.js.map +1 -1
- package/dist/services/claim.js +45 -43
- package/dist/services/claim.js.map +1 -1
- package/dist/services/discount.d.ts +4 -1
- package/dist/services/discount.js +39 -20
- package/dist/services/discount.js.map +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +3 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/line-item-adjustment.d.ts +1 -4
- package/dist/services/line-item-adjustment.js +2 -1
- package/dist/services/line-item-adjustment.js.map +1 -1
- package/dist/services/line-item.d.ts +12 -7
- package/dist/services/line-item.js +22 -10
- package/dist/services/line-item.js.map +1 -1
- package/dist/services/notification.js +3 -2
- package/dist/services/notification.js.map +1 -1
- package/dist/services/order.js +214 -115
- package/dist/services/order.js.map +1 -1
- package/dist/services/price-list.d.ts +7 -4
- package/dist/services/price-list.js +25 -11
- package/dist/services/price-list.js.map +1 -1
- package/dist/services/pricing.d.ts +7 -4
- package/dist/services/pricing.js +39 -12
- package/dist/services/pricing.js.map +1 -1
- package/dist/services/product-variant.js +1 -1
- package/dist/services/product-variant.js.map +1 -1
- package/dist/services/region.d.ts +10 -7
- package/dist/services/region.js +22 -6
- package/dist/services/region.js.map +1 -1
- package/dist/services/return.js +23 -19
- package/dist/services/return.js.map +1 -1
- package/dist/services/shipping-option.d.ts +12 -8
- package/dist/services/shipping-option.js +23 -2
- package/dist/services/shipping-option.js.map +1 -1
- package/dist/services/store.d.ts +1 -2
- package/dist/services/store.js.map +1 -1
- package/dist/services/totals.d.ts +18 -20
- package/dist/services/totals.js +614 -358
- package/dist/services/totals.js.map +1 -1
- package/dist/strategies/__fixtures__/product-export-data.js +6 -2
- package/dist/strategies/__fixtures__/product-export-data.js.map +1 -1
- package/dist/strategies/batch-jobs/product/export.d.ts +6 -0
- package/dist/strategies/batch-jobs/product/export.js +11 -2
- package/dist/strategies/batch-jobs/product/export.js.map +1 -1
- package/dist/strategies/batch-jobs/product/import.d.ts +6 -5
- package/dist/strategies/batch-jobs/product/import.js +293 -197
- package/dist/strategies/batch-jobs/product/import.js.map +1 -1
- package/dist/strategies/batch-jobs/product/index.js +2 -2
- package/dist/strategies/batch-jobs/product/types.d.ts +8 -0
- package/dist/strategies/batch-jobs/product/types.js.map +1 -1
- package/dist/strategies/batch-jobs/product/utils.d.ts +1 -1
- package/dist/strategies/batch-jobs/product/utils.js +10 -1
- package/dist/strategies/batch-jobs/product/utils.js.map +1 -1
- package/dist/strategies/price-selection.d.ts +6 -2
- package/dist/strategies/price-selection.js +124 -10
- package/dist/strategies/price-selection.js.map +1 -1
- package/dist/strategies/tax-calculation.d.ts +7 -5
- package/dist/strategies/tax-calculation.js +47 -17
- package/dist/strategies/tax-calculation.js.map +1 -1
- package/dist/subscribers/batch-job.d.ts +4 -1
- package/dist/subscribers/batch-job.js +71 -44
- package/dist/subscribers/batch-job.js.map +1 -1
- package/dist/types/price-list.d.ts +2 -1
- package/dist/types/pricing.d.ts +5 -2
- package/dist/types/region.d.ts +2 -0
- package/dist/types/shipping-options.d.ts +2 -0
- package/dist/utils/feature-flag-decorators.js +4 -16
- package/dist/utils/feature-flag-decorators.js.map +1 -1
- package/dist/utils/flag-router.d.ts +1 -1
- package/dist/utils/flag-router.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -3
package/dist/models/line-item.js
CHANGED
|
@@ -23,6 +23,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
23
23
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
24
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
25
|
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
26
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
30
|
exports.LineItem = void 0;
|
|
28
31
|
var typeorm_1 = require("typeorm");
|
|
@@ -36,6 +39,8 @@ var order_1 = require("./order");
|
|
|
36
39
|
var product_variant_1 = require("./product-variant");
|
|
37
40
|
var swap_1 = require("./swap");
|
|
38
41
|
var generate_entity_id_1 = require("../utils/generate-entity-id");
|
|
42
|
+
var feature_flag_decorators_1 = require("../utils/feature-flag-decorators");
|
|
43
|
+
var tax_inclusive_pricing_1 = __importDefault(require("../loaders/feature-flags/tax-inclusive-pricing"));
|
|
39
44
|
var LineItem = /** @class */ (function (_super) {
|
|
40
45
|
__extends(LineItem, _super);
|
|
41
46
|
function LineItem() {
|
|
@@ -160,6 +165,10 @@ var LineItem = /** @class */ (function (_super) {
|
|
|
160
165
|
(0, db_aware_column_1.DbAwareColumn)({ type: "jsonb", nullable: true }),
|
|
161
166
|
__metadata("design:type", Object)
|
|
162
167
|
], LineItem.prototype, "metadata", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, feature_flag_decorators_1.FeatureFlagColumn)(tax_inclusive_pricing_1.default.key, { default: false }),
|
|
170
|
+
__metadata("design:type", Boolean)
|
|
171
|
+
], LineItem.prototype, "includes_tax", void 0);
|
|
163
172
|
__decorate([
|
|
164
173
|
(0, typeorm_1.BeforeInsert)(),
|
|
165
174
|
__metadata("design:type", Function),
|
|
@@ -320,6 +329,9 @@ exports.LineItem = LineItem;
|
|
|
320
329
|
* type: integer
|
|
321
330
|
* description: The total of the gift card of the line item
|
|
322
331
|
* example: 0
|
|
332
|
+
* includes_tax:
|
|
333
|
+
* description: "[EXPERIMENTAL] Indicates if the line item unit_price include tax"
|
|
334
|
+
* type: boolean
|
|
323
335
|
* created_at:
|
|
324
336
|
* type: string
|
|
325
337
|
* description: "The date with timezone at which the resource was created."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-item.js","sourceRoot":"","sources":["../../src/models/line-item.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"line-item.js","sourceRoot":"","sources":["../../src/models/line-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCASgB;AAEhB,gEAA6D;AAC7D,+BAA6B;AAC7B,6CAA0C;AAC1C,4DAAwD;AACxD,+DAA2D;AAC3D,2DAAsD;AACtD,iCAA+B;AAC/B,qDAAkD;AAClD,+BAA6B;AAC7B,kEAA8D;AAC9D,4EAAoE;AACpE,yGAA2F;AAO3F;IAA8B,4BAAU;IAAxC;;IA2GA,CAAC;IAHS,+BAAY,GAApB;QACE,IAAI,CAAC,EAAE,GAAG,IAAA,qCAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC7C,CAAC;IAvGD;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACZ;IAIf;QAFC,IAAA,mBAAS,EAAC,cAAM,OAAA,WAAI,EAAJ,CA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C,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;8CACR;IAGhB;QADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;wDACd;IAG1B;QADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;uDACf;IAGzB;QADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;sDAChB;IAGxB;QADC,IAAA,+BAAa,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAChB;IAGjC;QADC,IAAA,2CAAiB,EAAC,+BAA8B,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;kDACrD;IAYrB;QADC,IAAA,sBAAY,GAAE;;;;gDAGd;IA1GU,QAAQ;QALpB,IAAA,eAAK,EAAC,wCAAoC,CAAC;QAC3C,IAAA,eAAK,EAAC,gDAA4C,CAAC;QACnD,IAAA,eAAK,EAAC,uCAAmC,CAAC;QAC1C,IAAA,eAAK,EAAC,kBAAgB,CAAC;QACvB,IAAA,gBAAM,GAAE;OACI,QAAQ,CA2GpB;IAAD,eAAC;CAAA,AA3GD,CAA8B,wBAAU,GA2GvC;AA3GY,4BAAQ;AA6GrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+JG"}
|
|
@@ -5,7 +5,7 @@ import { Region } from "./region";
|
|
|
5
5
|
import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity";
|
|
6
6
|
export declare class MoneyAmount extends SoftDeletableEntity {
|
|
7
7
|
currency_code: string;
|
|
8
|
-
currency
|
|
8
|
+
currency?: Currency;
|
|
9
9
|
amount: number;
|
|
10
10
|
min_quantity: number | null;
|
|
11
11
|
max_quantity: number | null;
|
|
@@ -14,7 +14,7 @@ export declare class MoneyAmount extends SoftDeletableEntity {
|
|
|
14
14
|
variant_id: string;
|
|
15
15
|
variant: ProductVariant;
|
|
16
16
|
region_id: string;
|
|
17
|
-
region
|
|
17
|
+
region?: Region;
|
|
18
18
|
private beforeInsert;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money-amount.js","sourceRoot":"","sources":["../../src/models/money-amount.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOgB;AAEhB,uCAAqC;AACrC,2CAAwC;AACxC,qDAAkD;AAClD,mCAAiC;AACjC,oFAAgF;AAChF,kEAA8D;AAG9D;IAAiC,+BAAmB;IAApD;;IAiDA,CAAC;IAHS,kCAAY,GAApB;QACE,IAAI,CAAC,EAAE,GAAG,IAAA,qCAAgB,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAC3C,CAAC;IA9CD;QADC,IAAA,gBAAM,GAAE;;sDACY;IAIrB;QAFC,IAAA,mBAAS,EAAC,cAAM,OAAA,mBAAQ,EAAR,CAAQ,CAAC;QACzB,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"money-amount.js","sourceRoot":"","sources":["../../src/models/money-amount.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOgB;AAEhB,uCAAqC;AACrC,2CAAwC;AACxC,qDAAkD;AAClD,mCAAiC;AACjC,oFAAgF;AAChF,kEAA8D;AAG9D;IAAiC,+BAAmB;IAApD;;IAiDA,CAAC;IAHS,kCAAY,GAApB;QACE,IAAI,CAAC,EAAE,GAAG,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C;kCAC1B,gCAAc;gDAAA;IAIvB;QAFC,IAAA,eAAK,GAAE;QACP,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACV;IAIjB;QAFC,IAAA,mBAAS,EAAC,cAAM,OAAA,eAAM,EAAN,CAAM,CAAC;QACvB,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;kCACzB,eAAM;+CAAA;IAGf;QADC,IAAA,sBAAY,GAAE;;;;mDAGd;IAhDU,WAAW;QADvB,IAAA,gBAAM,GAAE;OACI,WAAW,CAiDvB;IAAD,kBAAC;CAAA,AAjDD,CAAiC,2CAAmB,GAiDnD;AAjDY,kCAAW;AAmDxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { OrderItemChange } from "./order-item-change";
|
|
2
|
+
import { SoftDeletableEntity } from "../interfaces";
|
|
3
|
+
import { LineItem } from "./line-item";
|
|
4
|
+
import { Order } from "./order";
|
|
5
|
+
export declare class OrderEdit extends SoftDeletableEntity {
|
|
6
|
+
order_id: string;
|
|
7
|
+
order: Order;
|
|
8
|
+
changes: OrderItemChange[];
|
|
9
|
+
internal_note?: string;
|
|
10
|
+
created_by: string;
|
|
11
|
+
requested_by?: string;
|
|
12
|
+
requested_at?: Date;
|
|
13
|
+
confirmed_by?: string;
|
|
14
|
+
confirmed_at?: Date;
|
|
15
|
+
declined_by?: string;
|
|
16
|
+
declined_reason?: string;
|
|
17
|
+
declined_at?: Date;
|
|
18
|
+
canceled_by?: string;
|
|
19
|
+
canceled_at?: Date;
|
|
20
|
+
subtotal: number;
|
|
21
|
+
discount_total?: number;
|
|
22
|
+
tax_total: number;
|
|
23
|
+
total: number;
|
|
24
|
+
difference_due: number;
|
|
25
|
+
items: LineItem[];
|
|
26
|
+
private beforeInsert;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @schema order_edit
|
|
30
|
+
* title: "Order Edit"
|
|
31
|
+
* description: "Order edit keeps track of order items changes."
|
|
32
|
+
* x-resourceId: order_edit
|
|
33
|
+
* required:
|
|
34
|
+
* - order_id
|
|
35
|
+
* - order
|
|
36
|
+
* - changes
|
|
37
|
+
* - created_by
|
|
38
|
+
* properties:
|
|
39
|
+
* id:
|
|
40
|
+
* type: string
|
|
41
|
+
* description: The order edit's ID
|
|
42
|
+
* example: oe_01G8TJSYT9M6AVS5N4EMNFS1EK
|
|
43
|
+
* order_id:
|
|
44
|
+
* type: string
|
|
45
|
+
* description: The ID of the order that is edited
|
|
46
|
+
* example: order_01G2SG30J8C85S4A5CHM2S1NS2
|
|
47
|
+
* order:
|
|
48
|
+
* description: Order object
|
|
49
|
+
* $ref: "#/components/schemas/order"
|
|
50
|
+
* changes:
|
|
51
|
+
* type: array
|
|
52
|
+
* description: Line item changes array.
|
|
53
|
+
* items:
|
|
54
|
+
* $ref: "#/components/schemas/order_item_changes"
|
|
55
|
+
* internal_note:
|
|
56
|
+
* description: "An optional note with additional details about the order edit."
|
|
57
|
+
* type: string
|
|
58
|
+
* example: Included two more items B to the order.
|
|
59
|
+
* created_by:
|
|
60
|
+
* type: string
|
|
61
|
+
* description: "The unique identifier of the user or customer who created the order edit."
|
|
62
|
+
* requested_by:
|
|
63
|
+
* type: string
|
|
64
|
+
* description: "The unique identifier of the user or customer who requested the order edit."
|
|
65
|
+
* requested_at:
|
|
66
|
+
* type: string
|
|
67
|
+
* description: "The date with timezone at which the edit was requested."
|
|
68
|
+
* format: date-time
|
|
69
|
+
* confirmed_by:
|
|
70
|
+
* type: string
|
|
71
|
+
* description: "The unique identifier of the user or customer who confirmed the order edit."
|
|
72
|
+
* confirmed_at:
|
|
73
|
+
* type: string
|
|
74
|
+
* description: "The date with timezone at which the edit was confirmed."
|
|
75
|
+
* format: date-time
|
|
76
|
+
* declined_by:
|
|
77
|
+
* type: string
|
|
78
|
+
* description: "The unique identifier of the user or customer who declined the order edit."
|
|
79
|
+
* declined_at:
|
|
80
|
+
* type: string
|
|
81
|
+
* description: "The date with timezone at which the edit was declined."
|
|
82
|
+
* format: date-time
|
|
83
|
+
* declined_reason:
|
|
84
|
+
* description: "An optional note why the order edit is declined."
|
|
85
|
+
* type: string
|
|
86
|
+
* subtotal:
|
|
87
|
+
* type: integer
|
|
88
|
+
* description: The subtotal for line items computed from changes.
|
|
89
|
+
* example: 8000
|
|
90
|
+
* discount_total:
|
|
91
|
+
* type: integer
|
|
92
|
+
* description: The total of discount
|
|
93
|
+
* example: 800
|
|
94
|
+
* tax_total:
|
|
95
|
+
* type: integer
|
|
96
|
+
* description: The total of tax
|
|
97
|
+
* example: 0
|
|
98
|
+
* total:
|
|
99
|
+
* type: integer
|
|
100
|
+
* description: The total amount of the edited order.
|
|
101
|
+
* example: 8200
|
|
102
|
+
* difference_due:
|
|
103
|
+
* type: integer
|
|
104
|
+
* description: The difference between the total amount of the order and total amount of edited order.
|
|
105
|
+
* example: 8200
|
|
106
|
+
* items:
|
|
107
|
+
* type: array
|
|
108
|
+
* description: Computed line items from the changes.
|
|
109
|
+
* items:
|
|
110
|
+
* $ref: "#/components/schemas/line_item"
|
|
111
|
+
*/
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.OrderEdit = void 0;
|
|
31
|
+
var typeorm_1 = require("typeorm");
|
|
32
|
+
var order_editing_1 = __importDefault(require("../loaders/feature-flags/order-editing"));
|
|
33
|
+
var feature_flag_decorators_1 = require("../utils/feature-flag-decorators");
|
|
34
|
+
var db_aware_column_1 = require("../utils/db-aware-column");
|
|
35
|
+
var order_item_change_1 = require("./order-item-change");
|
|
36
|
+
var interfaces_1 = require("../interfaces");
|
|
37
|
+
var utils_1 = require("../utils");
|
|
38
|
+
var order_1 = require("./order");
|
|
39
|
+
var OrderEdit = /** @class */ (function (_super) {
|
|
40
|
+
__extends(OrderEdit, _super);
|
|
41
|
+
function OrderEdit() {
|
|
42
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
43
|
+
}
|
|
44
|
+
OrderEdit.prototype.beforeInsert = function () {
|
|
45
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "oe");
|
|
46
|
+
};
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)(),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], OrderEdit.prototype, "order_id", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.ManyToOne)(function () { return order_1.Order; }, function (o) { return o.edits; }),
|
|
53
|
+
(0, typeorm_1.JoinColumn)({ name: "order_id" }),
|
|
54
|
+
__metadata("design:type", order_1.Order)
|
|
55
|
+
], OrderEdit.prototype, "order", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.OneToMany)(function () { return order_item_change_1.OrderItemChange; }, function (oic) { return oic.order_edit; }, {
|
|
58
|
+
cascade: true,
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:type", Array)
|
|
61
|
+
], OrderEdit.prototype, "changes", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], OrderEdit.prototype, "internal_note", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.Column)(),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], OrderEdit.prototype, "created_by", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], OrderEdit.prototype, "requested_by", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz"), nullable: true }),
|
|
76
|
+
__metadata("design:type", Date)
|
|
77
|
+
], OrderEdit.prototype, "requested_at", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], OrderEdit.prototype, "confirmed_by", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.Column)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz"), nullable: true }),
|
|
84
|
+
__metadata("design:type", Date)
|
|
85
|
+
], OrderEdit.prototype, "confirmed_at", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], OrderEdit.prototype, "declined_by", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], OrderEdit.prototype, "declined_reason", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typeorm_1.Column)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz"), nullable: true }),
|
|
96
|
+
__metadata("design:type", Date)
|
|
97
|
+
], OrderEdit.prototype, "declined_at", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], OrderEdit.prototype, "canceled_by", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.Column)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz"), nullable: true }),
|
|
104
|
+
__metadata("design:type", Date
|
|
105
|
+
// Computed
|
|
106
|
+
)
|
|
107
|
+
], OrderEdit.prototype, "canceled_at", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, typeorm_1.BeforeInsert)(),
|
|
110
|
+
__metadata("design:type", Function),
|
|
111
|
+
__metadata("design:paramtypes", []),
|
|
112
|
+
__metadata("design:returntype", void 0)
|
|
113
|
+
], OrderEdit.prototype, "beforeInsert", null);
|
|
114
|
+
OrderEdit = __decorate([
|
|
115
|
+
(0, feature_flag_decorators_1.FeatureFlagEntity)(order_editing_1.default.key)
|
|
116
|
+
], OrderEdit);
|
|
117
|
+
return OrderEdit;
|
|
118
|
+
}(interfaces_1.SoftDeletableEntity));
|
|
119
|
+
exports.OrderEdit = OrderEdit;
|
|
120
|
+
/**
|
|
121
|
+
* @schema order_edit
|
|
122
|
+
* title: "Order Edit"
|
|
123
|
+
* description: "Order edit keeps track of order items changes."
|
|
124
|
+
* x-resourceId: order_edit
|
|
125
|
+
* required:
|
|
126
|
+
* - order_id
|
|
127
|
+
* - order
|
|
128
|
+
* - changes
|
|
129
|
+
* - created_by
|
|
130
|
+
* properties:
|
|
131
|
+
* id:
|
|
132
|
+
* type: string
|
|
133
|
+
* description: The order edit's ID
|
|
134
|
+
* example: oe_01G8TJSYT9M6AVS5N4EMNFS1EK
|
|
135
|
+
* order_id:
|
|
136
|
+
* type: string
|
|
137
|
+
* description: The ID of the order that is edited
|
|
138
|
+
* example: order_01G2SG30J8C85S4A5CHM2S1NS2
|
|
139
|
+
* order:
|
|
140
|
+
* description: Order object
|
|
141
|
+
* $ref: "#/components/schemas/order"
|
|
142
|
+
* changes:
|
|
143
|
+
* type: array
|
|
144
|
+
* description: Line item changes array.
|
|
145
|
+
* items:
|
|
146
|
+
* $ref: "#/components/schemas/order_item_changes"
|
|
147
|
+
* internal_note:
|
|
148
|
+
* description: "An optional note with additional details about the order edit."
|
|
149
|
+
* type: string
|
|
150
|
+
* example: Included two more items B to the order.
|
|
151
|
+
* created_by:
|
|
152
|
+
* type: string
|
|
153
|
+
* description: "The unique identifier of the user or customer who created the order edit."
|
|
154
|
+
* requested_by:
|
|
155
|
+
* type: string
|
|
156
|
+
* description: "The unique identifier of the user or customer who requested the order edit."
|
|
157
|
+
* requested_at:
|
|
158
|
+
* type: string
|
|
159
|
+
* description: "The date with timezone at which the edit was requested."
|
|
160
|
+
* format: date-time
|
|
161
|
+
* confirmed_by:
|
|
162
|
+
* type: string
|
|
163
|
+
* description: "The unique identifier of the user or customer who confirmed the order edit."
|
|
164
|
+
* confirmed_at:
|
|
165
|
+
* type: string
|
|
166
|
+
* description: "The date with timezone at which the edit was confirmed."
|
|
167
|
+
* format: date-time
|
|
168
|
+
* declined_by:
|
|
169
|
+
* type: string
|
|
170
|
+
* description: "The unique identifier of the user or customer who declined the order edit."
|
|
171
|
+
* declined_at:
|
|
172
|
+
* type: string
|
|
173
|
+
* description: "The date with timezone at which the edit was declined."
|
|
174
|
+
* format: date-time
|
|
175
|
+
* declined_reason:
|
|
176
|
+
* description: "An optional note why the order edit is declined."
|
|
177
|
+
* type: string
|
|
178
|
+
* subtotal:
|
|
179
|
+
* type: integer
|
|
180
|
+
* description: The subtotal for line items computed from changes.
|
|
181
|
+
* example: 8000
|
|
182
|
+
* discount_total:
|
|
183
|
+
* type: integer
|
|
184
|
+
* description: The total of discount
|
|
185
|
+
* example: 800
|
|
186
|
+
* tax_total:
|
|
187
|
+
* type: integer
|
|
188
|
+
* description: The total of tax
|
|
189
|
+
* example: 0
|
|
190
|
+
* total:
|
|
191
|
+
* type: integer
|
|
192
|
+
* description: The total amount of the edited order.
|
|
193
|
+
* example: 8200
|
|
194
|
+
* difference_due:
|
|
195
|
+
* type: integer
|
|
196
|
+
* description: The difference between the total amount of the order and total amount of edited order.
|
|
197
|
+
* example: 8200
|
|
198
|
+
* items:
|
|
199
|
+
* type: array
|
|
200
|
+
* description: Computed line items from the changes.
|
|
201
|
+
* items:
|
|
202
|
+
* $ref: "#/components/schemas/line_item"
|
|
203
|
+
*/
|
|
204
|
+
//# sourceMappingURL=order-edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-edit.js","sourceRoot":"","sources":["../../src/models/order-edit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAgF;AAEhF,yFAA4E;AAC5E,4EAAoE;AACpE,4DAAwD;AACxD,yDAAqD;AACrD,4CAAmD;AACnD,kCAA2C;AAE3C,iCAA+B;AAG/B;IAA+B,6BAAmB;IAAlD;;IA2DA,CAAC;IAHS,gCAAY,GAApB;QACE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AAA,gBAAM,EAAC,EAAE,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kCACjD,IAAI;kDAAA;IAGlB;QADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACP;IAGpB;QADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kCACjD,IAAI;QAElB,WAAW;;kDAFO;IAYlB;QADC,IAAA,sBAAY,GAAE;;;;iDAGd;IA1DU,SAAS;QADrB,IAAA,2CAAiB,EAAC,uBAAuB,CAAC,GAAG,CAAC;OAClC,SAAS,CA2DrB;IAAD,gBAAC;CAAA,AA3DD,CAA+B,gCAAmB,GA2DjD;AA3DY,8BAAS;AA6DtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { SoftDeletableEntity } from "../interfaces";
|
|
2
|
+
import { OrderEdit } from "./order-edit";
|
|
3
|
+
import { LineItem } from "./line-item";
|
|
4
|
+
export declare enum OrderEditItemChangeType {
|
|
5
|
+
ITEM_ADD = "item_add",
|
|
6
|
+
ITEM_REMOVE = "item_remove",
|
|
7
|
+
ITEM_UPDATE = "item_update"
|
|
8
|
+
}
|
|
9
|
+
export declare class OrderItemChange extends SoftDeletableEntity {
|
|
10
|
+
type: OrderEditItemChangeType;
|
|
11
|
+
order_edit_id: string;
|
|
12
|
+
order_edit: OrderEdit;
|
|
13
|
+
original_line_item_id?: string;
|
|
14
|
+
original_line_item?: LineItem;
|
|
15
|
+
line_item_id?: string;
|
|
16
|
+
line_item?: LineItem;
|
|
17
|
+
private beforeInsert;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @schema order_item_change
|
|
21
|
+
* title: "Order Item Change"
|
|
22
|
+
* description: "Represents an order edit item change"
|
|
23
|
+
* x-resourceId: order_item_change
|
|
24
|
+
* required:
|
|
25
|
+
* - type
|
|
26
|
+
* - order_edit_id
|
|
27
|
+
* properties:
|
|
28
|
+
* id:
|
|
29
|
+
* type: string
|
|
30
|
+
* description: The order item change's ID
|
|
31
|
+
* example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK
|
|
32
|
+
* type:
|
|
33
|
+
* type: string
|
|
34
|
+
* description: The order's status
|
|
35
|
+
* enum:
|
|
36
|
+
* - item_add
|
|
37
|
+
* - item_remove
|
|
38
|
+
* - item_update
|
|
39
|
+
* order_edit_id:
|
|
40
|
+
* type: string
|
|
41
|
+
* description: The ID of the order edit
|
|
42
|
+
* example: oe_01G2SG30J8C85S4A5CHM2S1NS2
|
|
43
|
+
* order_edit:
|
|
44
|
+
* description: Order edit object
|
|
45
|
+
* $ref: "#/components/schemas/order_edit"
|
|
46
|
+
* original_line_item_id:
|
|
47
|
+
* type: string
|
|
48
|
+
* description: The ID of the original line item in the order
|
|
49
|
+
* example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
|
|
50
|
+
* original_line_item:
|
|
51
|
+
* description: Original line item object.
|
|
52
|
+
* $ref: "#/components/schemas/line_item"
|
|
53
|
+
* line_item_id:
|
|
54
|
+
* type: string
|
|
55
|
+
* description: The ID of the cloned line item.
|
|
56
|
+
* example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
|
|
57
|
+
* line_item:
|
|
58
|
+
* description: Line item object.
|
|
59
|
+
* $ref: "#/components/schemas/line_item"
|
|
60
|
+
*/
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.OrderItemChange = exports.OrderEditItemChangeType = void 0;
|
|
31
|
+
var typeorm_1 = require("typeorm");
|
|
32
|
+
var interfaces_1 = require("../interfaces");
|
|
33
|
+
var order_editing_1 = __importDefault(require("../loaders/feature-flags/order-editing"));
|
|
34
|
+
var feature_flag_decorators_1 = require("../utils/feature-flag-decorators");
|
|
35
|
+
var utils_1 = require("../utils");
|
|
36
|
+
var db_aware_column_1 = require("../utils/db-aware-column");
|
|
37
|
+
var order_edit_1 = require("./order-edit");
|
|
38
|
+
var line_item_1 = require("./line-item");
|
|
39
|
+
var OrderEditItemChangeType;
|
|
40
|
+
(function (OrderEditItemChangeType) {
|
|
41
|
+
OrderEditItemChangeType["ITEM_ADD"] = "item_add";
|
|
42
|
+
OrderEditItemChangeType["ITEM_REMOVE"] = "item_remove";
|
|
43
|
+
OrderEditItemChangeType["ITEM_UPDATE"] = "item_update";
|
|
44
|
+
})(OrderEditItemChangeType = exports.OrderEditItemChangeType || (exports.OrderEditItemChangeType = {}));
|
|
45
|
+
var OrderItemChange = /** @class */ (function (_super) {
|
|
46
|
+
__extends(OrderItemChange, _super);
|
|
47
|
+
function OrderItemChange() {
|
|
48
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
49
|
+
}
|
|
50
|
+
OrderItemChange.prototype.beforeInsert = function () {
|
|
51
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "oic");
|
|
52
|
+
};
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, db_aware_column_1.DbAwareColumn)({
|
|
55
|
+
type: "enum",
|
|
56
|
+
enum: OrderEditItemChangeType,
|
|
57
|
+
}),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], OrderItemChange.prototype, "type", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)(),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], OrderItemChange.prototype, "order_edit_id", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.ManyToOne)(function () { return order_edit_1.OrderEdit; }, function (oe) { return oe.changes; }),
|
|
66
|
+
(0, typeorm_1.JoinColumn)({ name: "order_edit_id" }),
|
|
67
|
+
__metadata("design:type", order_edit_1.OrderEdit)
|
|
68
|
+
], OrderItemChange.prototype, "order_edit", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], OrderItemChange.prototype, "original_line_item_id", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, typeorm_1.ManyToOne)(function () { return line_item_1.LineItem; }, { nullable: true }),
|
|
75
|
+
(0, typeorm_1.JoinColumn)({ name: "original_line_item_id" }),
|
|
76
|
+
__metadata("design:type", line_item_1.LineItem)
|
|
77
|
+
], OrderItemChange.prototype, "original_line_item", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], OrderItemChange.prototype, "line_item_id", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.OneToOne)(function () { return line_item_1.LineItem; }, { nullable: true }),
|
|
84
|
+
(0, typeorm_1.JoinColumn)({ name: "line_item_id" }),
|
|
85
|
+
__metadata("design:type", line_item_1.LineItem)
|
|
86
|
+
], OrderItemChange.prototype, "line_item", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typeorm_1.BeforeInsert)(),
|
|
89
|
+
__metadata("design:type", Function),
|
|
90
|
+
__metadata("design:paramtypes", []),
|
|
91
|
+
__metadata("design:returntype", void 0)
|
|
92
|
+
], OrderItemChange.prototype, "beforeInsert", null);
|
|
93
|
+
OrderItemChange = __decorate([
|
|
94
|
+
(0, feature_flag_decorators_1.FeatureFlagEntity)(order_editing_1.default.key),
|
|
95
|
+
(0, typeorm_1.Unique)(["order_edit_id", "original_line_item_id"]),
|
|
96
|
+
(0, typeorm_1.Unique)(["order_edit_id", "line_item_id"])
|
|
97
|
+
], OrderItemChange);
|
|
98
|
+
return OrderItemChange;
|
|
99
|
+
}(interfaces_1.SoftDeletableEntity));
|
|
100
|
+
exports.OrderItemChange = OrderItemChange;
|
|
101
|
+
/**
|
|
102
|
+
* @schema order_item_change
|
|
103
|
+
* title: "Order Item Change"
|
|
104
|
+
* description: "Represents an order edit item change"
|
|
105
|
+
* x-resourceId: order_item_change
|
|
106
|
+
* required:
|
|
107
|
+
* - type
|
|
108
|
+
* - order_edit_id
|
|
109
|
+
* properties:
|
|
110
|
+
* id:
|
|
111
|
+
* type: string
|
|
112
|
+
* description: The order item change's ID
|
|
113
|
+
* example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK
|
|
114
|
+
* type:
|
|
115
|
+
* type: string
|
|
116
|
+
* description: The order's status
|
|
117
|
+
* enum:
|
|
118
|
+
* - item_add
|
|
119
|
+
* - item_remove
|
|
120
|
+
* - item_update
|
|
121
|
+
* order_edit_id:
|
|
122
|
+
* type: string
|
|
123
|
+
* description: The ID of the order edit
|
|
124
|
+
* example: oe_01G2SG30J8C85S4A5CHM2S1NS2
|
|
125
|
+
* order_edit:
|
|
126
|
+
* description: Order edit object
|
|
127
|
+
* $ref: "#/components/schemas/order_edit"
|
|
128
|
+
* original_line_item_id:
|
|
129
|
+
* type: string
|
|
130
|
+
* description: The ID of the original line item in the order
|
|
131
|
+
* example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
|
|
132
|
+
* original_line_item:
|
|
133
|
+
* description: Original line item object.
|
|
134
|
+
* $ref: "#/components/schemas/line_item"
|
|
135
|
+
* line_item_id:
|
|
136
|
+
* type: string
|
|
137
|
+
* description: The ID of the cloned line item.
|
|
138
|
+
* example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
|
|
139
|
+
* line_item:
|
|
140
|
+
* description: Line item object.
|
|
141
|
+
* $ref: "#/components/schemas/line_item"
|
|
142
|
+
*/
|
|
143
|
+
//# sourceMappingURL=order-item-change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-item-change.js","sourceRoot":"","sources":["../../src/models/order-item-change.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOgB;AAEhB,4CAAmD;AACnD,yFAA4E;AAC5E,4EAAoE;AACpE,kCAA2C;AAC3C,4DAAwD;AACxD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AE,CAAC;kCACzB,oBAAQ;sDAAA;IAGpB;QADC,IAAA,sBAAY,GAAE;;;;uDAGd;IA/BU,eAAe;QAH3B,IAAA,2CAAiB,EAAC,uBAAuB,CAAC,GAAG,CAAC;QAC9C,IAAA,gBAAM,EAAC,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC;QAClD,IAAA,gBAAM,EAAC,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;OAC7B,eAAe,CAgC3B;IAAD,sBAAC;CAAA,AAhCD,CAAqC,gCAAmB,GAgCvD;AAhCY,0CAAe;AAkC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG"}
|
package/dist/models/order.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { Return } from "./return";
|
|
|
17
17
|
import { SalesChannel } from "./sales-channel";
|
|
18
18
|
import { ShippingMethod } from "./shipping-method";
|
|
19
19
|
import { Swap } from "./swap";
|
|
20
|
+
import { OrderEdit } from "./order-edit";
|
|
20
21
|
export declare enum OrderStatus {
|
|
21
22
|
PENDING = "pending",
|
|
22
23
|
COMPLETED = "completed",
|
|
@@ -75,6 +76,7 @@ export declare class Order extends BaseEntity {
|
|
|
75
76
|
swaps: Swap[];
|
|
76
77
|
draft_order_id: string;
|
|
77
78
|
draft_order: DraftOrder;
|
|
79
|
+
edits: OrderEdit[];
|
|
78
80
|
items: LineItem[];
|
|
79
81
|
gift_card_transactions: GiftCardTransaction[];
|
|
80
82
|
canceled_at: Date;
|
|
@@ -267,6 +269,11 @@ export declare class Order extends BaseEntity {
|
|
|
267
269
|
* description: The line items that belong to the order. Available if the relation `items` is expanded.
|
|
268
270
|
* items:
|
|
269
271
|
* $ref: "#/components/schemas/line_item"
|
|
272
|
+
* edits:
|
|
273
|
+
* type: array
|
|
274
|
+
* description: [EXPERIMENTAL] Order edits done on the order. Available if the relation `edits` is expanded.
|
|
275
|
+
* items:
|
|
276
|
+
* $ref: "#/components/schemas/order_edit"
|
|
270
277
|
* gift_card_transactions:
|
|
271
278
|
* type: array
|
|
272
279
|
* description: The gift card transactions used in the order. Available if the relation `gift_card_transactions` is expanded.
|