@medusajs/medusa 1.3.9-alpha.0 → 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 +10 -8
- package/dist/api/routes/admin/currencies/index.d.ts +0 -0
- package/dist/api/routes/admin/currencies/index.js +0 -0
- package/dist/api/routes/admin/currencies/index.js.map +0 -0
- package/dist/api/routes/admin/currencies/list-currencies.d.ts +0 -0
- package/dist/api/routes/admin/currencies/list-currencies.js +0 -0
- package/dist/api/routes/admin/currencies/list-currencies.js.map +0 -0
- package/dist/api/routes/admin/currencies/update-currency.d.ts +0 -0
- package/dist/api/routes/admin/currencies/update-currency.js +0 -0
- package/dist/api/routes/admin/currencies/update-currency.js.map +0 -0
- package/dist/api/routes/admin/currency/index.d.ts +0 -0
- package/dist/api/routes/admin/currency/index.js +0 -0
- package/dist/api/routes/admin/currency/index.js.map +0 -0
- package/dist/api/routes/admin/currency/list-currencies.d.ts +0 -0
- package/dist/api/routes/admin/currency/list-currencies.js +0 -0
- package/dist/api/routes/admin/currency/list-currencies.js.map +0 -0
- package/dist/api/routes/admin/currency/update-currency.d.ts +0 -0
- package/dist/api/routes/admin/currency/update-currency.js +0 -0
- package/dist/api/routes/admin/currency/update-currency.js.map +0 -0
- package/dist/api/routes/store/carts/create-cart.js +60 -40
- package/dist/api/routes/store/carts/create-cart.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/loaders/feature-flags/tax-inclusive-pricing.d.ts +0 -0
- package/dist/loaders/feature-flags/tax-inclusive-pricing.js +0 -0
- package/dist/loaders/feature-flags/tax-inclusive-pricing.js.map +0 -0
- package/dist/migrations/1659501357661-tax_inclusive_pricing.d.ts +0 -0
- package/dist/migrations/1659501357661-tax_inclusive_pricing.js +0 -0
- package/dist/migrations/1659501357661-tax_inclusive_pricing.js.map +0 -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/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/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/currency.d.ts +0 -0
- package/dist/services/currency.js +0 -0
- package/dist/services/currency.js.map +0 -0
- package/dist/strategies/batch-jobs/product/import.js +67 -59
- package/dist/strategies/batch-jobs/product/import.js.map +1 -1
- package/dist/types/currency.d.ts +0 -0
- package/dist/types/currency.js +0 -0
- package/dist/types/currency.js.map +0 -0
- package/dist/utils/calculate-price-tax-amount.d.ts +0 -0
- package/dist/utils/calculate-price-tax-amount.js +0 -0
- package/dist/utils/calculate-price-tax-amount.js.map +0 -0
- package/dist/utils/csv-cell-content-formatter.d.ts +0 -0
- package/dist/utils/csv-cell-content-formatter.js +0 -0
- package/dist/utils/csv-cell-content-formatter.js.map +0 -0
- package/package.json +1 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[
|
|
1
|
+
[35m@medusajs/medusa:build[0m: cache hit, replaying output [2m50e82ef8d848d947[0m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.4.0
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2185](https://github.com/medusajs/medusa/pull/2185) [`64949dc72`](https://github.com/medusajs/medusa/commit/64949dc721a6c697e3eb7091db9f2d261111a766) Thanks [@kasperkristensen](https://github.com/kasperkristensen)! - Adds missing response types for currency endpoints and exports route. Adds currency endpoints to medusa-js and medusa-react.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
### Patch Changes
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- [#2150](https://github.com/medusajs/medusa/pull/2150) [`b6161d240`](https://github.com/medusajs/medusa/commit/b6161d24043b8b910320475b8616b7e29a96f6cd) Thanks [@adrien2p](https://github.com/adrien2p)! - Handle new line char in csv cell and fix import strategy
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
* [#2155](https://github.com/medusajs/medusa/pull/2155) [`af80e0fd2`](https://github.com/medusajs/medusa/commit/af80e0fd2ed75cd3c15282ddcbfb949060dfdd33) Thanks [@srindom](https://github.com/srindom)! - Make prices optional param when updating a variant
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
## 1.3.9
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
### Patch Changes
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
- [#2197](https://github.com/medusajs/medusa/pull/2197) [`eb3b02baf`](https://github.com/medusajs/medusa/commit/eb3b02baf422ec2038d5e229d7ac1e35ddc3c561) Thanks [@srindom](https://github.com/srindom)! - Create cart with country code in shipping address
|
|
18
20
|
|
|
19
21
|
## 1.3.8
|
|
20
22
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -60,14 +60,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
60
60
|
};
|
|
61
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
62
|
exports.StorePostCartReq = exports.Item = void 0;
|
|
63
|
+
var medusa_core_utils_1 = require("medusa-core-utils");
|
|
64
|
+
var request_ip_1 = __importDefault(require("request-ip"));
|
|
65
|
+
var class_transformer_1 = require("class-transformer");
|
|
63
66
|
var class_validator_1 = require("class-validator");
|
|
64
67
|
var _1 = require(".");
|
|
65
68
|
var feature_flag_decorators_1 = require("../../../../utils/feature-flag-decorators");
|
|
66
|
-
var medusa_core_utils_1 = require("medusa-core-utils");
|
|
67
69
|
var sales_channels_1 = __importDefault(require("../../../../loaders/feature-flags/sales-channels"));
|
|
68
|
-
var class_transformer_1 = require("class-transformer");
|
|
69
70
|
var decorate_line_items_with_totals_1 = require("./decorate-line-items-with-totals");
|
|
70
|
-
var request_ip_1 = __importDefault(require("request-ip"));
|
|
71
71
|
var utils_1 = require("../../../../utils");
|
|
72
72
|
/**
|
|
73
73
|
* @oas [post] /carts
|
|
@@ -151,7 +151,7 @@ var utils_1 = require("../../../../utils");
|
|
|
151
151
|
* $ref: "#/components/responses/500_error"
|
|
152
152
|
*/
|
|
153
153
|
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
-
var validated, reqContext, lineItemService, cartService, regionService, entityManager, featureFlagRouter, regionId, regions, cart, data;
|
|
154
|
+
var validated, reqContext, lineItemService, cartService, regionService, entityManager, featureFlagRouter, regionId, regions, toCreate, customerService, customer, cart, data;
|
|
155
155
|
return __generator(this, function (_a) {
|
|
156
156
|
switch (_a.label) {
|
|
157
157
|
case 0:
|
|
@@ -176,51 +176,71 @@ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0
|
|
|
176
176
|
}
|
|
177
177
|
regionId = regions[0].id;
|
|
178
178
|
_a.label = 3;
|
|
179
|
-
case 3:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
179
|
+
case 3:
|
|
180
|
+
toCreate = {
|
|
181
|
+
region_id: regionId,
|
|
182
|
+
sales_channel_id: validated.sales_channel_id,
|
|
183
|
+
context: __assign(__assign({}, reqContext), validated.context),
|
|
184
|
+
};
|
|
185
|
+
if (!(req.user && req.user.customer_id)) return [3 /*break*/, 5];
|
|
186
|
+
customerService = req.scope.resolve("customerService");
|
|
187
|
+
return [4 /*yield*/, customerService.retrieve(req.user.customer_id)];
|
|
188
|
+
case 4:
|
|
189
|
+
customer = _a.sent();
|
|
190
|
+
toCreate["customer_id"] = customer.id;
|
|
191
|
+
toCreate["email"] = customer.email;
|
|
192
|
+
_a.label = 5;
|
|
193
|
+
case 5:
|
|
194
|
+
if (validated.country_code) {
|
|
195
|
+
toCreate["shipping_address"] = {
|
|
196
|
+
country_code: validated.country_code.toLowerCase(),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return [4 /*yield*/, entityManager.transaction(function (manager) { return __awaiter(void 0, void 0, void 0, function () {
|
|
200
|
+
return __generator(this, function (_a) {
|
|
201
|
+
switch (_a.label) {
|
|
202
|
+
case 0: return [4 /*yield*/, cartService.withTransaction(manager).create(toCreate)];
|
|
203
|
+
case 1:
|
|
204
|
+
cart = _a.sent();
|
|
205
|
+
if (!validated.items) return [3 /*break*/, 3];
|
|
206
|
+
return [4 /*yield*/, Promise.all(validated.items.map(function (i) { return __awaiter(void 0, void 0, void 0, function () {
|
|
207
|
+
var lineItem;
|
|
208
|
+
var _a;
|
|
209
|
+
return __generator(this, function (_b) {
|
|
210
|
+
switch (_b.label) {
|
|
211
|
+
case 0: return [4 /*yield*/, lineItemService
|
|
199
212
|
.withTransaction(manager)
|
|
200
|
-
.
|
|
201
|
-
|
|
213
|
+
.generate(i.variant_id, regionId, i.quantity, {
|
|
214
|
+
customer_id: (_a = req.user) === null || _a === void 0 ? void 0 : _a.customer_id,
|
|
202
215
|
})];
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
216
|
+
case 1:
|
|
217
|
+
lineItem = _b.sent();
|
|
218
|
+
return [4 /*yield*/, cartService
|
|
219
|
+
.withTransaction(manager)
|
|
220
|
+
.addLineItem(cart.id, lineItem, {
|
|
221
|
+
validateSalesChannels: featureFlagRouter.isFeatureEnabled("sales_channels"),
|
|
222
|
+
})];
|
|
223
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}); }))];
|
|
227
|
+
case 2:
|
|
228
|
+
_a.sent();
|
|
229
|
+
_a.label = 3;
|
|
230
|
+
case 3: return [2 /*return*/];
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}); })];
|
|
234
|
+
case 6:
|
|
215
235
|
_a.sent();
|
|
216
236
|
return [4 /*yield*/, cartService.retrieve(cart.id, {
|
|
217
237
|
select: _1.defaultStoreCartFields,
|
|
218
238
|
relations: _1.defaultStoreCartRelations,
|
|
219
239
|
})];
|
|
220
|
-
case
|
|
240
|
+
case 7:
|
|
221
241
|
cart = _a.sent();
|
|
222
242
|
return [4 /*yield*/, (0, decorate_line_items_with_totals_1.decorateLineItemsWithTotals)(cart, req)];
|
|
223
|
-
case
|
|
243
|
+
case 8:
|
|
224
244
|
data = _a.sent();
|
|
225
245
|
res.status(200).json({ cart: data });
|
|
226
246
|
return [2 /*return*/];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-cart.js","sourceRoot":"","sources":["../../../../../src/api/routes/store/carts/create-cart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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A,CAAC;IApBC;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,0BAAQ,GAAE;;uDACO;IAIlB;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,0BAAQ,GAAE;;0DACU;IAMrB;QAJC,IAAA,4BAAU,GAAE;QACZ,IAAA,yBAAO,GAAE;QACT,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC9B,IAAA,wBAAI,EAAC,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;;mDACH;IAGd;QADC,IAAA,4BAAU,GAAE;;qDACG;IAMhB;QAJC,IAAA,+CAAqB,EAAC,wBAAuB,CAAC,GAAG,EAAE;YAClD,IAAA,0BAAQ,GAAE;YACV,IAAA,4BAAU,GAAE;SACb,CAAC;;8DACuB;IAC3B,uBAAC;CAAA,AAvBD,IAuBC;AAvBY,4CAAgB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var OrderEditingFeatureFlag = {
|
|
4
|
+
key: "order_editing",
|
|
5
|
+
default_val: false,
|
|
6
|
+
env_key: "MEDUSA_FF_ORDER_EDITING",
|
|
7
|
+
description: "[WIP] Enable the order editing feature",
|
|
8
|
+
};
|
|
9
|
+
exports.default = OrderEditingFeatureFlag;
|
|
10
|
+
//# sourceMappingURL=order-editing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-editing.js","sourceRoot":"","sources":["../../../src/loaders/feature-flags/order-editing.ts"],"names":[],"mappings":";;AAEA,IAAM,uBAAuB,GAAiB;IAC5C,GAAG,EAAE,eAAe;IACpB,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,yBAAyB;IAClC,WAAW,EAAE,wCAAwC;CACtD,CAAA;AAED,kBAAe,uBAAuB,CAAA"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
export declare const featureFlag: string;
|
|
3
|
+
export declare class orderEditing1663059812399 implements MigrationInterface {
|
|
4
|
+
name: string;
|
|
5
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.orderEditing1663059812399 = exports.featureFlag = void 0;
|
|
43
|
+
var order_editing_1 = __importDefault(require("../loaders/feature-flags/order-editing"));
|
|
44
|
+
exports.featureFlag = order_editing_1.default.key;
|
|
45
|
+
var orderEditing1663059812399 = /** @class */ (function () {
|
|
46
|
+
function orderEditing1663059812399() {
|
|
47
|
+
this.name = "orderEditing1663059812399";
|
|
48
|
+
}
|
|
49
|
+
orderEditing1663059812399.prototype.up = function (queryRunner) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, queryRunner.query("CREATE TYPE \"order_item_change_type_enum\" AS ENUM('item_add', 'item_remove', 'item_update')")];
|
|
54
|
+
case 1:
|
|
55
|
+
_a.sent();
|
|
56
|
+
return [4 /*yield*/, queryRunner.query("CREATE TABLE \"order_item_change\" (\"id\" character varying NOT NULL, \"created_at\" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), \"updated_at\" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), \"deleted_at\" TIMESTAMP WITH TIME ZONE, \"type\" \"order_item_change_type_enum\" NOT NULL, \"order_edit_id\" character varying NOT NULL, \"original_line_item_id\" character varying, \"line_item_id\" character varying, CONSTRAINT \"UQ_da93cee3ca0dd50a5246268c2e9\" UNIQUE (\"order_edit_id\", \"line_item_id\"), CONSTRAINT \"UQ_5b7a99181e4db2ea821be0b6196\" UNIQUE (\"order_edit_id\", \"original_line_item_id\"), CONSTRAINT \"REL_5f9688929761f7df108b630e64\" UNIQUE (\"line_item_id\"), CONSTRAINT \"PK_d6eb138f77ffdee83567b85af0c\" PRIMARY KEY (\"id\"))")];
|
|
57
|
+
case 2:
|
|
58
|
+
_a.sent();
|
|
59
|
+
return [4 /*yield*/, queryRunner.query("CREATE TABLE \"order_edit\" (\"id\" character varying NOT NULL, \"created_at\" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), \"updated_at\" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), \"deleted_at\" TIMESTAMP WITH TIME ZONE, \"order_id\" character varying NOT NULL, \"internal_note\" character varying, \"created_by\" character varying NOT NULL, \"requested_by\" character varying, \"requested_at\" TIMESTAMP WITH TIME ZONE, \"confirmed_by\" character varying, \"confirmed_at\" TIMESTAMP WITH TIME ZONE, \"declined_by\" character varying, \"declined_reason\" character varying, \"declined_at\" TIMESTAMP WITH TIME ZONE, \"canceled_by\" character varying, \"canceled_at\" TIMESTAMP WITH TIME ZONE, CONSTRAINT \"PK_58ab6acf2e84b4e827f5f846f7a\" PRIMARY KEY (\"id\"))")];
|
|
60
|
+
case 3:
|
|
61
|
+
_a.sent();
|
|
62
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"order_item_change\" ADD CONSTRAINT \"FK_44feeebb258bf4cfa4cc4202281\" FOREIGN KEY (\"order_edit_id\") REFERENCES \"order_edit\"(\"id\") ON DELETE NO ACTION ON UPDATE NO ACTION")];
|
|
63
|
+
case 4:
|
|
64
|
+
_a.sent();
|
|
65
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"order_item_change\" ADD CONSTRAINT \"FK_b4d53b8d03c9f5e7d4317e818d9\" FOREIGN KEY (\"original_line_item_id\") REFERENCES \"line_item\"(\"id\") ON DELETE NO ACTION ON UPDATE NO ACTION")];
|
|
66
|
+
case 5:
|
|
67
|
+
_a.sent();
|
|
68
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"order_item_change\" ADD CONSTRAINT \"FK_5f9688929761f7df108b630e64a\" FOREIGN KEY (\"line_item_id\") REFERENCES \"line_item\"(\"id\") ON DELETE NO ACTION ON UPDATE NO ACTION")];
|
|
69
|
+
case 6:
|
|
70
|
+
_a.sent();
|
|
71
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"order_edit\" ADD CONSTRAINT \"FK_1f3a251488a91510f57e1bf93cd\" FOREIGN KEY (\"order_id\") REFERENCES \"order\"(\"id\") ON DELETE NO ACTION ON UPDATE NO ACTION")];
|
|
72
|
+
case 7:
|
|
73
|
+
_a.sent();
|
|
74
|
+
return [2 /*return*/];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
orderEditing1663059812399.prototype.down = function (queryRunner) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0: return [4 /*yield*/, queryRunner.query("ALTER TABLE \"order_edit\" DROP CONSTRAINT \"FK_1f3a251488a91510f57e1bf93cd\"")];
|
|
84
|
+
case 1:
|
|
85
|
+
_a.sent();
|
|
86
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"order_item_change\" DROP CONSTRAINT \"FK_5f9688929761f7df108b630e64a\"")];
|
|
87
|
+
case 2:
|
|
88
|
+
_a.sent();
|
|
89
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"order_item_change\" DROP CONSTRAINT \"FK_b4d53b8d03c9f5e7d4317e818d9\"")];
|
|
90
|
+
case 3:
|
|
91
|
+
_a.sent();
|
|
92
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"order_item_change\" DROP CONSTRAINT \"FK_44feeebb258bf4cfa4cc4202281\"")];
|
|
93
|
+
case 4:
|
|
94
|
+
_a.sent();
|
|
95
|
+
return [4 /*yield*/, queryRunner.query("DROP TABLE \"order_edit\"")];
|
|
96
|
+
case 5:
|
|
97
|
+
_a.sent();
|
|
98
|
+
return [4 /*yield*/, queryRunner.query("DROP TABLE \"order_item_change\"")];
|
|
99
|
+
case 6:
|
|
100
|
+
_a.sent();
|
|
101
|
+
return [4 /*yield*/, queryRunner.query("DROP TYPE \"order_item_change_type_enum\"")];
|
|
102
|
+
case 7:
|
|
103
|
+
_a.sent();
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
return orderEditing1663059812399;
|
|
110
|
+
}());
|
|
111
|
+
exports.orderEditing1663059812399 = orderEditing1663059812399;
|
|
112
|
+
//# sourceMappingURL=1663059812399-order_editing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1663059812399-order_editing.js","sourceRoot":"","sources":["../../src/migrations/1663059812399-order_editing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yFAA4E;AAE/D,QAAA,WAAW,GAAG,uBAAuB,CAAC,GAAG,CAAA;AAEt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A;;wBAAlE,SAAkE,CAAA;;;;;KACnE;IACH,gCAAC;AAAD,CAAC,AA9CD,IA8CC;AA9CY,8DAAyB"}
|
|
@@ -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
|
+
*/
|