@medusajs/medusa 1.2.2-dev.53 → 1.2.2-dev.56
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/dist/api/routes/admin/index.js +21 -19
- package/dist/api/routes/admin/index.js.map +1 -1
- package/dist/api/routes/admin/price-lists/add-prices-batch.d.ts +70 -0
- package/dist/api/routes/admin/price-lists/add-prices-batch.js +158 -0
- package/dist/api/routes/admin/price-lists/add-prices-batch.js.map +1 -0
- package/dist/api/routes/admin/price-lists/create-price-list.d.ts +87 -0
- package/dist/api/routes/admin/price-lists/create-price-list.js +193 -0
- package/dist/api/routes/admin/price-lists/create-price-list.js.map +1 -0
- package/dist/api/routes/admin/price-lists/delete-price-list.d.ts +28 -0
- package/dist/api/routes/admin/price-lists/delete-price-list.js +84 -0
- package/dist/api/routes/admin/price-lists/delete-price-list.js.map +1 -0
- package/dist/api/routes/admin/price-lists/delete-prices-batch.d.ts +43 -0
- package/dist/api/routes/admin/price-lists/delete-prices-batch.js +118 -0
- package/dist/api/routes/admin/price-lists/delete-prices-batch.js.map +1 -0
- package/dist/api/routes/admin/price-lists/get-price-list.d.ts +22 -0
- package/dist/api/routes/admin/price-lists/get-price-list.js +78 -0
- package/dist/api/routes/admin/price-lists/get-price-list.js.map +1 -0
- package/dist/api/routes/admin/price-lists/index.d.ts +21 -0
- package/dist/api/routes/admin/price-lists/index.js +52 -0
- package/dist/api/routes/admin/price-lists/index.js.map +1 -0
- package/dist/api/routes/admin/price-lists/list-price-lists.d.ts +38 -0
- package/dist/api/routes/admin/price-lists/list-price-lists.js +197 -0
- package/dist/api/routes/admin/price-lists/list-price-lists.js.map +1 -0
- package/dist/api/routes/admin/price-lists/update-price-list.d.ts +92 -0
- package/dist/api/routes/admin/price-lists/update-price-list.js +211 -0
- package/dist/api/routes/admin/price-lists/update-price-list.js.map +1 -0
- package/dist/api/routes/admin/products/create-product.d.ts +2 -7
- package/dist/api/routes/admin/products/create-product.js +2 -24
- package/dist/api/routes/admin/products/create-product.js.map +1 -1
- package/dist/api/routes/admin/products/create-variant.d.ts +7 -9
- package/dist/api/routes/admin/products/create-variant.js +7 -26
- package/dist/api/routes/admin/products/create-variant.js.map +1 -1
- package/dist/api/routes/admin/products/index.d.ts +1 -1
- package/dist/api/routes/admin/products/index.js +1 -1
- package/dist/api/routes/admin/products/index.js.map +1 -1
- package/dist/api/routes/admin/products/update-product.d.ts +2 -7
- package/dist/api/routes/admin/products/update-product.js +2 -24
- package/dist/api/routes/admin/products/update-product.js.map +1 -1
- package/dist/api/routes/admin/products/update-variant.d.ts +10 -9
- package/dist/api/routes/admin/products/update-variant.js +10 -26
- package/dist/api/routes/admin/products/update-variant.js.map +1 -1
- package/dist/api/routes/store/collections/list-collections.d.ts +3 -0
- package/dist/api/routes/store/collections/list-collections.js +33 -16
- package/dist/api/routes/store/collections/list-collections.js.map +1 -1
- package/dist/api/routes/store/products/list-products.d.ts +0 -1
- package/dist/api/routes/store/products/list-products.js +0 -6
- package/dist/api/routes/store/products/list-products.js.map +1 -1
- package/dist/api/routes/store/regions/list-regions.d.ts +3 -0
- package/dist/api/routes/store/regions/list-regions.js +22 -7
- package/dist/api/routes/store/regions/list-regions.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/migrations/1646915480108-update_money_amount_add_price_list.d.ts +6 -0
- package/dist/migrations/1646915480108-update_money_amount_add_price_list.js +143 -0
- package/dist/migrations/1646915480108-update_money_amount_add_price_list.js.map +1 -0
- package/dist/models/customer-group.d.ts +3 -1
- package/dist/models/customer-group.js +7 -13
- package/dist/models/customer-group.js.map +1 -1
- package/dist/models/money-amount.d.ts +10 -3
- package/dist/models/money-amount.js +22 -5
- package/dist/models/money-amount.js.map +1 -1
- package/dist/models/price-list.d.ts +57 -0
- package/dist/models/price-list.js +142 -0
- package/dist/models/price-list.js.map +1 -0
- package/dist/repositories/money-amount.d.ts +6 -2
- package/dist/repositories/money-amount.js +102 -2
- package/dist/repositories/money-amount.js.map +1 -1
- package/dist/repositories/price-list.d.ts +4 -0
- package/dist/repositories/price-list.js +38 -0
- package/dist/repositories/price-list.js.map +1 -0
- package/dist/services/discount.js +2 -2
- package/dist/services/discount.js.map +1 -1
- package/dist/services/price-list.d.ts +86 -0
- package/dist/services/price-list.js +469 -0
- package/dist/services/price-list.js.map +1 -0
- package/dist/services/product-variant.d.ts +16 -9
- package/dist/services/product-variant.js +37 -33
- package/dist/services/product-variant.js.map +1 -1
- package/dist/types/price-list.d.ts +70 -0
- package/dist/types/price-list.js +152 -0
- package/dist/types/price-list.js.map +1 -0
- package/dist/types/product-variant.d.ts +18 -1
- package/dist/types/product-variant.js +65 -1
- package/dist/types/product-variant.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.updateMoneyAmountAddPriceList1646915480108 = void 0;
|
|
40
|
+
var updateMoneyAmountAddPriceList1646915480108 = /** @class */ (function () {
|
|
41
|
+
function updateMoneyAmountAddPriceList1646915480108() {
|
|
42
|
+
this.name = 'updateMoneyAmountAddPriceList1646915480108';
|
|
43
|
+
}
|
|
44
|
+
updateMoneyAmountAddPriceList1646915480108.prototype.up = function (queryRunner) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0: return [4 /*yield*/, queryRunner.query("CREATE TYPE \"price_list_type_enum\" AS ENUM('sale', 'override')")];
|
|
49
|
+
case 1:
|
|
50
|
+
_a.sent();
|
|
51
|
+
return [4 /*yield*/, queryRunner.query("CREATE TYPE \"price_list_status_enum\" AS ENUM('active', 'draft')")];
|
|
52
|
+
case 2:
|
|
53
|
+
_a.sent();
|
|
54
|
+
return [4 /*yield*/, queryRunner.query("CREATE TABLE \"price_list\" (\"id\" character varying NOT NULL, \"name\" character varying NOT NULL, \"description\" character varying NOT NULL, \"type\" \"price_list_type_enum\" NOT NULL DEFAULT 'sale', \"status\" \"price_list_status_enum\" NOT NULL DEFAULT 'draft', \"starts_at\" TIMESTAMP WITH TIME ZONE, \"ends_at\" TIMESTAMP WITH TIME ZONE, \"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, CONSTRAINT \"PK_52ea7826468b1c889cb2c28df03\" PRIMARY KEY (\"id\"))")];
|
|
55
|
+
case 3:
|
|
56
|
+
_a.sent();
|
|
57
|
+
return [4 /*yield*/, queryRunner.query("CREATE TABLE \"price_list_customer_groups\" (\"price_list_id\" character varying NOT NULL, \"customer_group_id\" character varying NOT NULL, CONSTRAINT \"PK_1afcbe15cc8782dc80c05707df9\" PRIMARY KEY (\"price_list_id\", \"customer_group_id\"))")];
|
|
58
|
+
case 4:
|
|
59
|
+
_a.sent();
|
|
60
|
+
return [4 /*yield*/, queryRunner.query("CREATE INDEX \"IDX_52875734e9dd69064f0041f4d9\" ON \"price_list_customer_groups\" (\"price_list_id\") ")];
|
|
61
|
+
case 5:
|
|
62
|
+
_a.sent();
|
|
63
|
+
return [4 /*yield*/, queryRunner.query("CREATE INDEX \"IDX_c5516f550433c9b1c2630d787a\" ON \"price_list_customer_groups\" (\"customer_group_id\") ")];
|
|
64
|
+
case 6:
|
|
65
|
+
_a.sent();
|
|
66
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" DROP COLUMN \"sale_amount\"")];
|
|
67
|
+
case 7:
|
|
68
|
+
_a.sent();
|
|
69
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" ADD \"min_quantity\" integer")];
|
|
70
|
+
case 8:
|
|
71
|
+
_a.sent();
|
|
72
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" ADD \"max_quantity\" integer")];
|
|
73
|
+
case 9:
|
|
74
|
+
_a.sent();
|
|
75
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" ADD \"price_list_id\" character varying")];
|
|
76
|
+
case 10:
|
|
77
|
+
_a.sent();
|
|
78
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" ADD CONSTRAINT \"FK_f249976b079375499662eb80c40\" FOREIGN KEY (\"price_list_id\") REFERENCES \"price_list\"(\"id\") ON DELETE CASCADE ON UPDATE NO ACTION")];
|
|
79
|
+
case 11:
|
|
80
|
+
_a.sent();
|
|
81
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"price_list_customer_groups\" ADD CONSTRAINT \"FK_52875734e9dd69064f0041f4d92\" FOREIGN KEY (\"price_list_id\") REFERENCES \"price_list\"(\"id\") ON DELETE CASCADE ON UPDATE CASCADE")];
|
|
82
|
+
case 12:
|
|
83
|
+
_a.sent();
|
|
84
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"price_list_customer_groups\" ADD CONSTRAINT \"FK_c5516f550433c9b1c2630d787a7\" FOREIGN KEY (\"customer_group_id\") REFERENCES \"customer_group\"(\"id\") ON DELETE CASCADE ON UPDATE NO ACTION")];
|
|
85
|
+
case 13:
|
|
86
|
+
_a.sent();
|
|
87
|
+
return [2 /*return*/];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
updateMoneyAmountAddPriceList1646915480108.prototype.down = function (queryRunner) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (_a.label) {
|
|
96
|
+
case 0: return [4 /*yield*/, queryRunner.query("ALTER TABLE \"price_list_customer_groups\" DROP CONSTRAINT \"FK_c5516f550433c9b1c2630d787a7\"")];
|
|
97
|
+
case 1:
|
|
98
|
+
_a.sent();
|
|
99
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"price_list_customer_groups\" DROP CONSTRAINT \"FK_52875734e9dd69064f0041f4d92\"")];
|
|
100
|
+
case 2:
|
|
101
|
+
_a.sent();
|
|
102
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" DROP CONSTRAINT \"FK_f249976b079375499662eb80c40\"")];
|
|
103
|
+
case 3:
|
|
104
|
+
_a.sent();
|
|
105
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" DROP COLUMN \"price_list_id\"")];
|
|
106
|
+
case 4:
|
|
107
|
+
_a.sent();
|
|
108
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" DROP COLUMN \"max_quantity\"")];
|
|
109
|
+
case 5:
|
|
110
|
+
_a.sent();
|
|
111
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" DROP COLUMN \"min_quantity\"")];
|
|
112
|
+
case 6:
|
|
113
|
+
_a.sent();
|
|
114
|
+
return [4 /*yield*/, queryRunner.query("ALTER TABLE \"money_amount\" ADD \"sale_amount\" integer")];
|
|
115
|
+
case 7:
|
|
116
|
+
_a.sent();
|
|
117
|
+
return [4 /*yield*/, queryRunner.query("DROP INDEX \"IDX_c5516f550433c9b1c2630d787a\"")];
|
|
118
|
+
case 8:
|
|
119
|
+
_a.sent();
|
|
120
|
+
return [4 /*yield*/, queryRunner.query("DROP INDEX \"IDX_52875734e9dd69064f0041f4d9\"")];
|
|
121
|
+
case 9:
|
|
122
|
+
_a.sent();
|
|
123
|
+
return [4 /*yield*/, queryRunner.query("DROP TABLE \"price_list_customer_groups\"")];
|
|
124
|
+
case 10:
|
|
125
|
+
_a.sent();
|
|
126
|
+
return [4 /*yield*/, queryRunner.query("DROP TABLE \"price_list\"")];
|
|
127
|
+
case 11:
|
|
128
|
+
_a.sent();
|
|
129
|
+
return [4 /*yield*/, queryRunner.query("DROP TYPE \"price_list_status_enum\"")];
|
|
130
|
+
case 12:
|
|
131
|
+
_a.sent();
|
|
132
|
+
return [4 /*yield*/, queryRunner.query("DROP TYPE \"price_list_type_enum\"")];
|
|
133
|
+
case 13:
|
|
134
|
+
_a.sent();
|
|
135
|
+
return [2 /*return*/];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
return updateMoneyAmountAddPriceList1646915480108;
|
|
141
|
+
}());
|
|
142
|
+
exports.updateMoneyAmountAddPriceList1646915480108 = updateMoneyAmountAddPriceList1646915480108;
|
|
143
|
+
//# sourceMappingURL=1646915480108-update_money_amount_add_price_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1646915480108-update_money_amount_add_price_list.js","sourceRoot":"","sources":["../../src/migrations/1646915480108-update_money_amount_add_price_list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;IAAA;QACI,SAAI,GAAG,4CAA4C,CAAA;IAkCvD,CAAC;IAhCgB,uDAAE,GAAf,UAAgB,WAAwB;;;;4BACpC,qBAAM,WAAW,CAAC,KAAK,CAAC,kEAAgE,CAAC,EAAA;;wBAAzF,SAAyF,CAAC;wBAC1F,qBAAM,WAAW,CAAC,KAAK,CAAC,mEAAiE,CAAC,EAAA;;wBAA1F,SAA0F,CAAC;wBAC3F,qBAAM,WAAW,CAAC,KAAK,CAAC,w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,SAAiF,CAAC;wBAClF,qBAAM,WAAW,CAAC,KAAK,CAAC,2DAAuD,CAAC,EAAA;;wBAAhF,SAAgF,CAAC;wBACjF,qBAAM,WAAW,CAAC,KAAK,CAAC,2DAAuD,CAAC,EAAA;;wBAAhF,SAAgF,CAAC;wBACjF,qBAAM,WAAW,CAAC,KAAK,CAAC,0DAAsD,CAAC,EAAA;;wBAA/E,SAA+E,CAAC;wBAChF,qBAAM,WAAW,CAAC,KAAK,CAAC,+CAA6C,CAAC,EAAA;;wBAAtE,SAAsE,CAAC;wBACvE,qBAAM,WAAW,CAAC,KAAK,CAAC,+CAA6C,CAAC,EAAA;;wBAAtE,SAAsE,CAAC;wBACvE,qBAAM,WAAW,CAAC,KAAK,CAAC,2CAAyC,CAAC,EAAA;;wBAAlE,SAAkE,CAAC;wBACnE,qBAAM,WAAW,CAAC,KAAK,CAAC,2BAAyB,CAAC,EAAA;;wBAAlD,SAAkD,CAAC;wBACnD,qBAAM,WAAW,CAAC,KAAK,CAAC,sCAAoC,CAAC,EAAA;;wBAA7D,SAA6D,CAAC;wBAC9D,qBAAM,WAAW,CAAC,KAAK,CAAC,oCAAkC,CAAC,EAAA;;wBAA3D,SAA2D,CAAC;;;;;KAC/D;IAEL,iDAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCY,gGAA0C"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Customer } from "
|
|
1
|
+
import { Customer } from "./customer";
|
|
2
|
+
import { PriceList } from "./price-list";
|
|
2
3
|
export declare class CustomerGroup {
|
|
3
4
|
id: string;
|
|
4
5
|
name: string;
|
|
5
6
|
customers: Customer[];
|
|
7
|
+
price_lists: PriceList[];
|
|
6
8
|
created_at: Date;
|
|
7
9
|
updated_at: Date;
|
|
8
10
|
deleted_at: Date;
|
|
@@ -12,8 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CustomerGroup = void 0;
|
|
13
13
|
var typeorm_1 = require("typeorm");
|
|
14
14
|
var ulid_1 = require("ulid");
|
|
15
|
-
var __1 = require("..");
|
|
16
15
|
var db_aware_column_1 = require("../utils/db-aware-column");
|
|
16
|
+
var customer_1 = require("./customer");
|
|
17
|
+
var price_list_1 = require("./price-list");
|
|
17
18
|
var CustomerGroup = /** @class */ (function () {
|
|
18
19
|
function CustomerGroup() {
|
|
19
20
|
}
|
|
@@ -34,22 +35,15 @@ var CustomerGroup = /** @class */ (function () {
|
|
|
34
35
|
__metadata("design:type", String)
|
|
35
36
|
], CustomerGroup.prototype, "name", void 0);
|
|
36
37
|
__decorate([
|
|
37
|
-
(0, typeorm_1.ManyToMany)(function () { return
|
|
38
|
+
(0, typeorm_1.ManyToMany)(function () { return customer_1.Customer; }, function (customer) { return customer.groups; }, {
|
|
38
39
|
onDelete: "CASCADE",
|
|
39
40
|
}),
|
|
40
|
-
(0, typeorm_1.JoinTable)({
|
|
41
|
-
name: "customer_group_customers",
|
|
42
|
-
joinColumn: {
|
|
43
|
-
name: "customer_group_id",
|
|
44
|
-
referencedColumnName: "id",
|
|
45
|
-
},
|
|
46
|
-
inverseJoinColumn: {
|
|
47
|
-
name: "customer_id",
|
|
48
|
-
referencedColumnName: "id",
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
51
41
|
__metadata("design:type", Array)
|
|
52
42
|
], CustomerGroup.prototype, "customers", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.ManyToMany)(function () { return price_list_1.PriceList; }, function (priceList) { return priceList.customer_groups; }, { onDelete: "CASCADE" }),
|
|
45
|
+
__metadata("design:type", Array)
|
|
46
|
+
], CustomerGroup.prototype, "price_lists", void 0);
|
|
53
47
|
__decorate([
|
|
54
48
|
(0, typeorm_1.CreateDateColumn)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz") }),
|
|
55
49
|
__metadata("design:type", Date)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer-group.js","sourceRoot":"","sources":["../../src/models/customer-group.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"customer-group.js","sourceRoot":"","sources":["../../src/models/customer-group.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAUgB;AAChB,6BAA2B;AAC3B,4DAAuE;AACvE,uCAAqC;AACrC,2CAAwC;AAGxC;IAAA;IA4CA,CAAC;IAPS,oCAAY,GAApB;QACE,IAAI,IAAI,CAAC,EAAE,EAAE;YACX,OAAM;SACP;QACD,IAAM,EAAE,GAAG,IAAA,WAAI,GAAE,CAAA;QACjB,IAAI,CAAC,EAAE,GAAG,eAAQ,EAAE,CAAE,CAAA;IACxB,CAAC;IAzCD;QADC,IAAA,uBAAa,GAAE;;6CACN;IAIV;QAFC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;QACpD,IAAA,gBAAM,GAAE;;+CACG;IASZ;QAPC,IAAA,oBAAU,EACT,cAAM,OAAA,mBAAQ,EAAR,CAAQ,EACd,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,MAAM,EAAf,CAAe,EAC7B;YACE,QAAQ,EAAE,SAAS;SACpB,CACF;;oDACoB;IAOrB;QALC,IAAA,oBAAU,EACT,cAAM,OAAA,sBAAS,EAAT,CAAS,EACf,UAAC,SAAS,IAAK,OAAA,SAAS,CAAC,eAAe,EAAzB,CAAyB,EACxC,EAAE,QAAQ,EAAE,SAAS,EAAE,CACxB;;sDACuB;IAGxB;QADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC,EAAE,CAAC;kCAC7C,IAAI;qDAAA;IAGhB;QADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC,EAAE,CAAC;kCAC7C,IAAI;qDAAA;IAGhB;QADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC,EAAE,CAAC;kCAC7C,IAAI;qDAAA;IAGhB;QADC,IAAA,+BAAa,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACpC;IAGb;QADC,IAAA,sBAAY,GAAE;;;;qDAOd;IA3CU,aAAa;QADzB,IAAA,gBAAM,GAAE;OACI,aAAa,CA4CzB;IAAD,oBAAC;CAAA,AA5CD,IA4CC;AA5CY,sCAAa"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Currency } from "./currency";
|
|
2
|
+
import { PriceList } from "./price-list";
|
|
2
3
|
import { ProductVariant } from "./product-variant";
|
|
3
4
|
import { Region } from "./region";
|
|
4
5
|
export declare class MoneyAmount {
|
|
@@ -6,7 +7,10 @@ export declare class MoneyAmount {
|
|
|
6
7
|
currency_code: string;
|
|
7
8
|
currency: Currency;
|
|
8
9
|
amount: number;
|
|
9
|
-
|
|
10
|
+
min_quantity: number | null;
|
|
11
|
+
max_quantity: number | null;
|
|
12
|
+
price_list_id: string | null;
|
|
13
|
+
price_list: PriceList | null;
|
|
10
14
|
variant_id: string;
|
|
11
15
|
variant: ProductVariant;
|
|
12
16
|
region_id: string;
|
|
@@ -31,8 +35,11 @@ export declare class MoneyAmount {
|
|
|
31
35
|
* amount:
|
|
32
36
|
* description: "The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost."
|
|
33
37
|
* type: integer
|
|
34
|
-
*
|
|
35
|
-
* description: "
|
|
38
|
+
* min_quantity:
|
|
39
|
+
* description: "The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities."
|
|
40
|
+
* type: integer
|
|
41
|
+
* max_quantity:
|
|
42
|
+
* description: "The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities."
|
|
36
43
|
* type: integer
|
|
37
44
|
* variant_id:
|
|
38
45
|
* description: "The id of the Product Variant that the Money Amount belongs to."
|
|
@@ -14,6 +14,7 @@ var typeorm_1 = require("typeorm");
|
|
|
14
14
|
var ulid_1 = require("ulid");
|
|
15
15
|
var db_aware_column_1 = require("../utils/db-aware-column");
|
|
16
16
|
var currency_1 = require("./currency");
|
|
17
|
+
var price_list_1 = require("./price-list");
|
|
17
18
|
var product_variant_1 = require("./product-variant");
|
|
18
19
|
var region_1 = require("./region");
|
|
19
20
|
var MoneyAmount = /** @class */ (function () {
|
|
@@ -44,9 +45,22 @@ var MoneyAmount = /** @class */ (function () {
|
|
|
44
45
|
__metadata("design:type", Number)
|
|
45
46
|
], MoneyAmount.prototype, "amount", void 0);
|
|
46
47
|
__decorate([
|
|
47
|
-
(0, typeorm_1.Column)({ type: "int", nullable: true
|
|
48
|
-
__metadata("design:type",
|
|
49
|
-
], MoneyAmount.prototype, "
|
|
48
|
+
(0, typeorm_1.Column)({ type: "int", nullable: true }),
|
|
49
|
+
__metadata("design:type", Object)
|
|
50
|
+
], MoneyAmount.prototype, "min_quantity", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ type: "int", nullable: true }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], MoneyAmount.prototype, "max_quantity", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], MoneyAmount.prototype, "price_list_id", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.ManyToOne)(function () { return price_list_1.PriceList; }, function (priceList) { return priceList.prices; }, { cascade: true, onDelete: "CASCADE" }),
|
|
61
|
+
(0, typeorm_1.JoinColumn)({ name: "price_list_id" }),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], MoneyAmount.prototype, "price_list", void 0);
|
|
50
64
|
__decorate([
|
|
51
65
|
(0, typeorm_1.Index)(),
|
|
52
66
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
@@ -108,8 +122,11 @@ exports.MoneyAmount = MoneyAmount;
|
|
|
108
122
|
* amount:
|
|
109
123
|
* description: "The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost."
|
|
110
124
|
* type: integer
|
|
111
|
-
*
|
|
112
|
-
* description: "
|
|
125
|
+
* min_quantity:
|
|
126
|
+
* description: "The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities."
|
|
127
|
+
* type: integer
|
|
128
|
+
* max_quantity:
|
|
129
|
+
* description: "The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities."
|
|
113
130
|
* type: integer
|
|
114
131
|
* variant_id:
|
|
115
132
|
* description: "The id of the Product Variant that the Money Amount belongs to."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money-amount.js","sourceRoot":"","sources":["../../src/models/money-amount.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAWgB;AAChB,6BAA2B;AAC3B,4DAAwD;AACxD,uCAAqC;AACrC,qDAAkD;AAClD,mCAAiC;AAGjC;IAAA;
|
|
1
|
+
{"version":3,"file":"money-amount.js","sourceRoot":"","sources":["../../src/models/money-amount.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAWgB;AAChB,6BAA2B;AAC3B,4DAAwD;AACxD,uCAAqC;AACrC,2CAAwC;AACxC,qDAAkD;AAClD,mCAAiC;AAGjC;IAAA;IAsEA,CAAC;IAPS,kCAAY,GAApB;QACE,IAAI,IAAI,CAAC,EAAE,EAAE;YACX,OAAM;SACP;QACD,IAAM,EAAE,GAAG,IAAA,WAAI,GAAE,CAAA;QACjB,IAAI,CAAC,EAAE,GAAG,aAAM,EAAE,CAAE,CAAA;IACtB,CAAC;IAnED;QADC,IAAA,uBAAa,GAAE;;2CACN;IAGV;QADC,IAAA,gBAAM,GAAE;;sDACY;IAIrB;QAFC,IAAA,mBAAS,EAAC,cAAM,OAAA,mBAAQ,EAAR,CAAQ,CAAC;QACzB,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,eA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,WAAW,EAAE,CAAC;kCAC1B,eAAM;+CAAA;IAGd;QADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC,EAAE,CAAC;kCAC7C,IAAI;mDAAA;IAGhB;QADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC,EAAE,CAAC;kCAC7C,IAAI;mDAAA;IAGhB;QADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC,EAAE,CAAC;kCAC7C,IAAI;mDAAA;IAGhB;QADC,IAAA,sBAAY,GAAE;;;;mDAOd;IArEU,WAAW;QADvB,IAAA,gBAAM,GAAE;OACI,WAAW,CAsEvB;IAAD,kBAAC;CAAA,AAtED,IAsEC;AAtEY,kCAAW;AAwExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { PriceListStatus, PriceListType } from "../types/price-list";
|
|
2
|
+
import { CustomerGroup } from "./customer-group";
|
|
3
|
+
import { MoneyAmount } from "./money-amount";
|
|
4
|
+
export declare class PriceList {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
type: PriceListType;
|
|
9
|
+
status: PriceListStatus;
|
|
10
|
+
starts_at: Date;
|
|
11
|
+
ends_at: Date;
|
|
12
|
+
customer_groups: CustomerGroup[];
|
|
13
|
+
prices: MoneyAmount[];
|
|
14
|
+
created_at: Date;
|
|
15
|
+
updated_at: Date;
|
|
16
|
+
deleted_at: Date;
|
|
17
|
+
private beforeInsert;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @schema price_list
|
|
21
|
+
* title: "Price List"
|
|
22
|
+
* description: "Price Lists represents a set of prices that overrides the default price for one or more product variants."
|
|
23
|
+
* x-resourceId: price_list
|
|
24
|
+
* properties:
|
|
25
|
+
* id:
|
|
26
|
+
* description: "The id of the Price List. This value will be prefixed by `pl_`."
|
|
27
|
+
* type: string
|
|
28
|
+
* type:
|
|
29
|
+
* description: "The type of Price List. This can be one of either `sale` or `override`."
|
|
30
|
+
* type: string
|
|
31
|
+
* enum:
|
|
32
|
+
* - sale
|
|
33
|
+
* - override
|
|
34
|
+
* starts_at:
|
|
35
|
+
* description: "The date with timezone that the Price List starts being valid."
|
|
36
|
+
* type: date-time
|
|
37
|
+
* ends_at:
|
|
38
|
+
* description: "The date with timezone that the Price List stops being valid."
|
|
39
|
+
* type: date-time
|
|
40
|
+
* customer_groups:
|
|
41
|
+
* description: "The Customer Groups that the Price List applies to."
|
|
42
|
+
* type: array
|
|
43
|
+
* items:
|
|
44
|
+
* $ref: "#/components/schemas/customer_group"
|
|
45
|
+
* created_at:
|
|
46
|
+
* description: "The date with timezone at which the resource was created."
|
|
47
|
+
* type: string
|
|
48
|
+
* format: date-time
|
|
49
|
+
* updated_at:
|
|
50
|
+
* description: "The date with timezone at which the resource was last updated."
|
|
51
|
+
* type: string
|
|
52
|
+
* format: date-time
|
|
53
|
+
* deleted_at:
|
|
54
|
+
* description: "The date with timezone at which the resource was deleted."
|
|
55
|
+
* type: string
|
|
56
|
+
* format: date-time
|
|
57
|
+
*/
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PriceList = void 0;
|
|
13
|
+
var typeorm_1 = require("typeorm");
|
|
14
|
+
var ulid_1 = require("ulid");
|
|
15
|
+
var price_list_1 = require("../types/price-list");
|
|
16
|
+
var db_aware_column_1 = require("../utils/db-aware-column");
|
|
17
|
+
var customer_group_1 = require("./customer-group");
|
|
18
|
+
var money_amount_1 = require("./money-amount");
|
|
19
|
+
var PriceList = /** @class */ (function () {
|
|
20
|
+
function PriceList() {
|
|
21
|
+
}
|
|
22
|
+
PriceList.prototype.beforeInsert = function () {
|
|
23
|
+
if (this.id) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var id = (0, ulid_1.ulid)();
|
|
27
|
+
this.id = "pl_".concat(id);
|
|
28
|
+
};
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.PrimaryColumn)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], PriceList.prototype, "id", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], PriceList.prototype, "name", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], PriceList.prototype, "description", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, db_aware_column_1.DbAwareColumn)({ type: "enum", enum: price_list_1.PriceListType, default: "sale" }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], PriceList.prototype, "type", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, db_aware_column_1.DbAwareColumn)({ type: "enum", enum: price_list_1.PriceListStatus, default: "draft" }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], PriceList.prototype, "status", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({
|
|
51
|
+
type: (0, db_aware_column_1.resolveDbType)("timestamptz"),
|
|
52
|
+
nullable: true,
|
|
53
|
+
}),
|
|
54
|
+
__metadata("design:type", Date)
|
|
55
|
+
], PriceList.prototype, "starts_at", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz"), nullable: true }),
|
|
58
|
+
__metadata("design:type", Date)
|
|
59
|
+
], PriceList.prototype, "ends_at", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.JoinTable)({
|
|
62
|
+
name: "price_list_customer_groups",
|
|
63
|
+
joinColumn: {
|
|
64
|
+
name: "price_list_id",
|
|
65
|
+
referencedColumnName: "id",
|
|
66
|
+
},
|
|
67
|
+
inverseJoinColumn: {
|
|
68
|
+
name: "customer_group_id",
|
|
69
|
+
referencedColumnName: "id",
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
(0, typeorm_1.ManyToMany)(function () { return customer_group_1.CustomerGroup; }, function (cg) { return cg.price_lists; }, { onDelete: "CASCADE" }),
|
|
73
|
+
__metadata("design:type", Array)
|
|
74
|
+
], PriceList.prototype, "customer_groups", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typeorm_1.OneToMany)(function () { return money_amount_1.MoneyAmount; }, function (moneyAmount) { return moneyAmount.price_list; }, { onDelete: "CASCADE" }),
|
|
77
|
+
__metadata("design:type", Array)
|
|
78
|
+
], PriceList.prototype, "prices", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typeorm_1.CreateDateColumn)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz") }),
|
|
81
|
+
__metadata("design:type", Date)
|
|
82
|
+
], PriceList.prototype, "created_at", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typeorm_1.UpdateDateColumn)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz") }),
|
|
85
|
+
__metadata("design:type", Date)
|
|
86
|
+
], PriceList.prototype, "updated_at", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typeorm_1.DeleteDateColumn)({ type: (0, db_aware_column_1.resolveDbType)("timestamptz") }),
|
|
89
|
+
__metadata("design:type", Date)
|
|
90
|
+
], PriceList.prototype, "deleted_at", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, typeorm_1.BeforeInsert)(),
|
|
93
|
+
__metadata("design:type", Function),
|
|
94
|
+
__metadata("design:paramtypes", []),
|
|
95
|
+
__metadata("design:returntype", Object)
|
|
96
|
+
], PriceList.prototype, "beforeInsert", null);
|
|
97
|
+
PriceList = __decorate([
|
|
98
|
+
(0, typeorm_1.Entity)()
|
|
99
|
+
], PriceList);
|
|
100
|
+
return PriceList;
|
|
101
|
+
}());
|
|
102
|
+
exports.PriceList = PriceList;
|
|
103
|
+
/**
|
|
104
|
+
* @schema price_list
|
|
105
|
+
* title: "Price List"
|
|
106
|
+
* description: "Price Lists represents a set of prices that overrides the default price for one or more product variants."
|
|
107
|
+
* x-resourceId: price_list
|
|
108
|
+
* properties:
|
|
109
|
+
* id:
|
|
110
|
+
* description: "The id of the Price List. This value will be prefixed by `pl_`."
|
|
111
|
+
* type: string
|
|
112
|
+
* type:
|
|
113
|
+
* description: "The type of Price List. This can be one of either `sale` or `override`."
|
|
114
|
+
* type: string
|
|
115
|
+
* enum:
|
|
116
|
+
* - sale
|
|
117
|
+
* - override
|
|
118
|
+
* starts_at:
|
|
119
|
+
* description: "The date with timezone that the Price List starts being valid."
|
|
120
|
+
* type: date-time
|
|
121
|
+
* ends_at:
|
|
122
|
+
* description: "The date with timezone that the Price List stops being valid."
|
|
123
|
+
* type: date-time
|
|
124
|
+
* customer_groups:
|
|
125
|
+
* description: "The Customer Groups that the Price List applies to."
|
|
126
|
+
* type: array
|
|
127
|
+
* items:
|
|
128
|
+
* $ref: "#/components/schemas/customer_group"
|
|
129
|
+
* created_at:
|
|
130
|
+
* description: "The date with timezone at which the resource was created."
|
|
131
|
+
* type: string
|
|
132
|
+
* format: date-time
|
|
133
|
+
* updated_at:
|
|
134
|
+
* description: "The date with timezone at which the resource was last updated."
|
|
135
|
+
* type: string
|
|
136
|
+
* format: date-time
|
|
137
|
+
* deleted_at:
|
|
138
|
+
* description: "The date with timezone at which the resource was deleted."
|
|
139
|
+
* type: string
|
|
140
|
+
* format: date-time
|
|
141
|
+
*/
|
|
142
|
+
//# sourceMappingURL=price-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-list.js","sourceRoot":"","sources":["../../src/models/price-list.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAWgB;AAChB,6BAA2B;AAC3B,kDAAoE;AACpE,4DAAuE;AACvE,mDAAgD;AAChD,+CAA4C;AAG5C;IAAA;IAmEA,CAAC;IAPS,gCAAY,GAApB;QACE,IAAI,IAAI,CAAC,EAAE,EAAE;YACX,OAAM;SACP;QACD,IAAM,EAAE,GAAG,IAAA,WAAI,GAAE,CAAA;QACjB,IAAI,CAAC,EAAE,GAAG,aAAM,EAAE,CAAE,CAAA;IACtB,CAAC;IAhED;QADC,IAAA,uBAAa,GAAE;;yCACN;IAGV;QADC,IAAA,gBAAM,GAAE;;2CACG;IAGZ;QADC,IAAA,gBAAM,GAAE;;kDACU;IAGnB;QADC,IAAA,+BAAa,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,0BAAa,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;;2CACnD;IAGnB;QADC,IAAA,+BAAa,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,4BAAe,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;;6CAClD;IAMvB;QAJC,IAAA,gBAAM,EAAC;YACN,IAAI,EAAE,IAAA,+BAAa,EAAC,aAAa,CAAC;YAClC,QAAQ,EAAE,I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AS;AAqEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Repository } from "typeorm";
|
|
2
2
|
import { MoneyAmount } from "../models/money-amount";
|
|
3
|
-
|
|
3
|
+
import { PriceListPriceCreateInput, PriceListPriceUpdateInput } from "../types/price-list";
|
|
4
|
+
declare type Price = Partial<Omit<MoneyAmount, "created_at" | "updated_at" | "deleted_at">> & {
|
|
4
5
|
amount: number;
|
|
5
6
|
};
|
|
6
7
|
export declare class MoneyAmountRepository extends Repository<MoneyAmount> {
|
|
7
8
|
findVariantPricesNotIn(variantId: string, prices: Price[]): Promise<MoneyAmount[]>;
|
|
8
|
-
|
|
9
|
+
upsertVariantCurrencyPrice(variantId: string, price: Price): Promise<MoneyAmount>;
|
|
10
|
+
addPriceListPrices(priceListId: string, prices: PriceListPriceCreateInput[], overrideExisting?: boolean): Promise<MoneyAmount[]>;
|
|
11
|
+
deletePriceListPrices(priceListId: string, moneyAmountIds: string[]): Promise<void>;
|
|
12
|
+
updatePriceListPrices(priceListId: string, updates: PriceListPriceUpdateInput[]): Promise<MoneyAmount[]>;
|
|
9
13
|
}
|
|
10
14
|
export {};
|