@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,197 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
|
+
function step(op) {
|
|
40
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
+
while (_) try {
|
|
42
|
+
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;
|
|
43
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
|
+
switch (op[0]) {
|
|
45
|
+
case 0: case 1: t = op; break;
|
|
46
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
47
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49
|
+
default:
|
|
50
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
51
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
52
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
53
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
54
|
+
if (t[2]) _.ops.pop();
|
|
55
|
+
_.trys.pop(); continue;
|
|
56
|
+
}
|
|
57
|
+
op = body.call(thisArg, _);
|
|
58
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
59
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
63
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
64
|
+
if (!m) return o;
|
|
65
|
+
var i = m.call(o), r, ar = [], e;
|
|
66
|
+
try {
|
|
67
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
68
|
+
}
|
|
69
|
+
catch (error) { e = { error: error }; }
|
|
70
|
+
finally {
|
|
71
|
+
try {
|
|
72
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
73
|
+
}
|
|
74
|
+
finally { if (e) throw e.error; }
|
|
75
|
+
}
|
|
76
|
+
return ar;
|
|
77
|
+
};
|
|
78
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
79
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
80
|
+
};
|
|
81
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
82
|
+
exports.AdminGetPriceListPaginationParams = void 0;
|
|
83
|
+
var class_transformer_1 = require("class-transformer");
|
|
84
|
+
var class_validator_1 = require("class-validator");
|
|
85
|
+
var omit_1 = __importDefault(require("lodash/omit"));
|
|
86
|
+
var price_list_1 = require("../../../../types/price-list");
|
|
87
|
+
var validator_1 = require("../../../../utils/validator");
|
|
88
|
+
/**
|
|
89
|
+
* @oas [get] /price-lists
|
|
90
|
+
* operationId: "GetPriceLists"
|
|
91
|
+
* summary: "List Price Lists"
|
|
92
|
+
* description: "Retrieves a list of Price Lists."
|
|
93
|
+
* x-authenticated: true
|
|
94
|
+
* tags:
|
|
95
|
+
* - Price List
|
|
96
|
+
* responses:
|
|
97
|
+
* 200:
|
|
98
|
+
* description: OK
|
|
99
|
+
* content:
|
|
100
|
+
* application/json:
|
|
101
|
+
* schema:
|
|
102
|
+
* properties:
|
|
103
|
+
* price_lists:
|
|
104
|
+
* type: array
|
|
105
|
+
* items:
|
|
106
|
+
* $ref: "#/components/schemas/price_list"
|
|
107
|
+
* count:
|
|
108
|
+
* description: The number of Price Lists.
|
|
109
|
+
* type: integer
|
|
110
|
+
* offset:
|
|
111
|
+
* description: The offset of the Price List query.
|
|
112
|
+
* type: integer
|
|
113
|
+
* limit:
|
|
114
|
+
* description: The limit of the Price List query.
|
|
115
|
+
* type: integer
|
|
116
|
+
*/
|
|
117
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
+
var validated, priceListService, expandFields, listConfig, _a, field, filterableFields, _b, price_lists, count;
|
|
119
|
+
var _c, _d;
|
|
120
|
+
return __generator(this, function (_e) {
|
|
121
|
+
switch (_e.label) {
|
|
122
|
+
case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminGetPriceListPaginationParams, req.query)];
|
|
123
|
+
case 1:
|
|
124
|
+
validated = _e.sent();
|
|
125
|
+
priceListService = req.scope.resolve("priceListService");
|
|
126
|
+
expandFields = [];
|
|
127
|
+
if (validated.expand) {
|
|
128
|
+
expandFields = validated.expand.split(",");
|
|
129
|
+
}
|
|
130
|
+
listConfig = {
|
|
131
|
+
relations: expandFields,
|
|
132
|
+
skip: validated.offset,
|
|
133
|
+
take: validated.limit,
|
|
134
|
+
order: { created_at: "DESC" },
|
|
135
|
+
};
|
|
136
|
+
if (typeof validated.order !== "undefined") {
|
|
137
|
+
if (validated.order.startsWith("-")) {
|
|
138
|
+
_a = __read(validated.order.split("-"), 2), field = _a[1];
|
|
139
|
+
listConfig.order = (_c = {}, _c[field] = "DESC", _c);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
listConfig.order = (_d = {}, _d[validated.order] = "ASC", _d);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
filterableFields = (0, omit_1.default)(validated, [
|
|
146
|
+
"limit",
|
|
147
|
+
"offset",
|
|
148
|
+
"expand",
|
|
149
|
+
"order",
|
|
150
|
+
]);
|
|
151
|
+
return [4 /*yield*/, priceListService.listAndCount(filterableFields, listConfig)];
|
|
152
|
+
case 2:
|
|
153
|
+
_b = __read.apply(void 0, [_e.sent(), 2]), price_lists = _b[0], count = _b[1];
|
|
154
|
+
res.json({
|
|
155
|
+
price_lists: price_lists,
|
|
156
|
+
count: count,
|
|
157
|
+
offset: validated.offset,
|
|
158
|
+
limit: validated.limit,
|
|
159
|
+
});
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}); });
|
|
164
|
+
var AdminGetPriceListPaginationParams = /** @class */ (function (_super) {
|
|
165
|
+
__extends(AdminGetPriceListPaginationParams, _super);
|
|
166
|
+
function AdminGetPriceListPaginationParams() {
|
|
167
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
168
|
+
_this.offset = 0;
|
|
169
|
+
_this.limit = 10;
|
|
170
|
+
return _this;
|
|
171
|
+
}
|
|
172
|
+
__decorate([
|
|
173
|
+
(0, class_validator_1.IsNumber)(),
|
|
174
|
+
(0, class_validator_1.IsOptional)(),
|
|
175
|
+
(0, class_transformer_1.Type)(function () { return Number; }),
|
|
176
|
+
__metadata("design:type", Number)
|
|
177
|
+
], AdminGetPriceListPaginationParams.prototype, "offset", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, class_validator_1.IsNumber)(),
|
|
180
|
+
(0, class_validator_1.IsOptional)(),
|
|
181
|
+
(0, class_transformer_1.Type)(function () { return Number; }),
|
|
182
|
+
__metadata("design:type", Number)
|
|
183
|
+
], AdminGetPriceListPaginationParams.prototype, "limit", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, class_validator_1.IsString)(),
|
|
186
|
+
(0, class_validator_1.IsOptional)(),
|
|
187
|
+
__metadata("design:type", String)
|
|
188
|
+
], AdminGetPriceListPaginationParams.prototype, "expand", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
(0, class_validator_1.IsString)(),
|
|
191
|
+
(0, class_validator_1.IsOptional)(),
|
|
192
|
+
__metadata("design:type", String)
|
|
193
|
+
], AdminGetPriceListPaginationParams.prototype, "order", void 0);
|
|
194
|
+
return AdminGetPriceListPaginationParams;
|
|
195
|
+
}(price_list_1.FilterablePriceListProps));
|
|
196
|
+
exports.AdminGetPriceListPaginationParams = AdminGetPriceListPaginationParams;
|
|
197
|
+
//# sourceMappingURL=list-price-lists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-price-lists.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/price-lists/list-price-lists.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,mDAAgE;AAChE,qDAA8B;AAI9B,2DAAuE;AACvE,yDAAuD;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,mBAAe,UAAO,GAAG,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AC;oBACP,WAAW,aAAA;oBACX,KAAK,OAAA;oBACL,MAAM,EAAE,SAAS,CAAC,MAAM;oBACxB,KAAK,EAAE,SAAS,CAAC,KAAK;iBACvB,CAAC,CAAA;;;;KACH,EAAA;AAED;IAAuD,qDAAwB;IAA/E;QAAA,qEAkBC;QAdC,YAAM,GAAY,CAAC,CAAA;QAKnB,WAAK,GAAY,EAAE,CAAA;;IASrB,CAAC;IAdC;QAHC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;QACZ,IAAA,wBAAI,EAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;;qEACA;IAKnB;QAHC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;QACZ,IAAA,wBAAI,EAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;;oEACA;IAInB;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;qEACE;IAIf;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;oEACC;IAChB,wCAAC;CAAA,AAlBD,CAAuD,qCAAwB,GAkB9E;AAlBY,8EAAiC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { AdminPriceListPricesUpdateReq, PriceListStatus, PriceListType } from "../../../../types/price-list";
|
|
2
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* @oas [post] /price_lists/{id}
|
|
5
|
+
* operationId: "PostPriceListsPriceListPriceList"
|
|
6
|
+
* summary: "Update a Price List"
|
|
7
|
+
* description: "Updates a Price List"
|
|
8
|
+
* x-authenticated: true
|
|
9
|
+
* parameters:
|
|
10
|
+
* - (path) id=* {string} The id of the Price List.
|
|
11
|
+
* requestBody:
|
|
12
|
+
* content:
|
|
13
|
+
* application/json:
|
|
14
|
+
* schema:
|
|
15
|
+
* properties:
|
|
16
|
+
* name:
|
|
17
|
+
* description: "The name of the Price List"
|
|
18
|
+
* type: string
|
|
19
|
+
* description:
|
|
20
|
+
* description: "A description of the Price List."
|
|
21
|
+
* type: string
|
|
22
|
+
* type:
|
|
23
|
+
* description: The type of the Price List.
|
|
24
|
+
* type: string
|
|
25
|
+
* enum:
|
|
26
|
+
* - sale
|
|
27
|
+
* - override
|
|
28
|
+
* status:
|
|
29
|
+
* description: The status of the Price List.
|
|
30
|
+
* type: string
|
|
31
|
+
* enum:
|
|
32
|
+
* - active
|
|
33
|
+
* - draft
|
|
34
|
+
* prices:
|
|
35
|
+
* description: The prices of the Price List.
|
|
36
|
+
* type: array
|
|
37
|
+
* items:
|
|
38
|
+
* properties:
|
|
39
|
+
* id:
|
|
40
|
+
* description: The id of the price.
|
|
41
|
+
* type: string
|
|
42
|
+
* region_id:
|
|
43
|
+
* description: The id of the Region for which the price is used.
|
|
44
|
+
* type: string
|
|
45
|
+
* currency_code:
|
|
46
|
+
* description: The 3 character ISO currency code for which the price will be used.
|
|
47
|
+
* type: string
|
|
48
|
+
* amount:
|
|
49
|
+
* description: The amount to charge for the Product Variant.
|
|
50
|
+
* type: integer
|
|
51
|
+
* min_quantity:
|
|
52
|
+
* description: The minimum quantity for which the price will be used.
|
|
53
|
+
* type: integer
|
|
54
|
+
* max_quantity:
|
|
55
|
+
* description: The maximum quantity for which the price will be used.
|
|
56
|
+
* type: integer
|
|
57
|
+
* customer_groups:
|
|
58
|
+
* type: array
|
|
59
|
+
* description: A list of customer groups that the Price List applies to.
|
|
60
|
+
* items:
|
|
61
|
+
* required:
|
|
62
|
+
* - id
|
|
63
|
+
* properties:
|
|
64
|
+
* id:
|
|
65
|
+
* description: The id of a customer group
|
|
66
|
+
* type: string
|
|
67
|
+
* tags:
|
|
68
|
+
* - Price List
|
|
69
|
+
* responses:
|
|
70
|
+
* 200:
|
|
71
|
+
* description: OK
|
|
72
|
+
* content:
|
|
73
|
+
* application/json:
|
|
74
|
+
* schema:
|
|
75
|
+
* properties:
|
|
76
|
+
* product:
|
|
77
|
+
* $ref: "#/components/schemas/price_list"
|
|
78
|
+
*/
|
|
79
|
+
export default _default;
|
|
80
|
+
declare class CustomerGroup {
|
|
81
|
+
id: string;
|
|
82
|
+
}
|
|
83
|
+
export declare class AdminPostPriceListsPriceListPriceListReq {
|
|
84
|
+
name?: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
starts_at?: Date;
|
|
87
|
+
ends_at?: Date;
|
|
88
|
+
status?: PriceListStatus;
|
|
89
|
+
type?: PriceListType;
|
|
90
|
+
prices: AdminPriceListPricesUpdateReq[];
|
|
91
|
+
customer_groups: CustomerGroup[];
|
|
92
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
21
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
22
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
23
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
24
|
+
function step(op) {
|
|
25
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
26
|
+
while (_) try {
|
|
27
|
+
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;
|
|
28
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
29
|
+
switch (op[0]) {
|
|
30
|
+
case 0: case 1: t = op; break;
|
|
31
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
32
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
33
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
34
|
+
default:
|
|
35
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
36
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
37
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
38
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
39
|
+
if (t[2]) _.ops.pop();
|
|
40
|
+
_.trys.pop(); continue;
|
|
41
|
+
}
|
|
42
|
+
op = body.call(thisArg, _);
|
|
43
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
44
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.AdminPostPriceListsPriceListPriceListReq = void 0;
|
|
49
|
+
var class_transformer_1 = require("class-transformer");
|
|
50
|
+
var class_validator_1 = require("class-validator");
|
|
51
|
+
var _1 = require(".");
|
|
52
|
+
var price_list_1 = require("../../../../types/price-list");
|
|
53
|
+
var validator_1 = require("../../../../utils/validator");
|
|
54
|
+
/**
|
|
55
|
+
* @oas [post] /price_lists/{id}
|
|
56
|
+
* operationId: "PostPriceListsPriceListPriceList"
|
|
57
|
+
* summary: "Update a Price List"
|
|
58
|
+
* description: "Updates a Price List"
|
|
59
|
+
* x-authenticated: true
|
|
60
|
+
* parameters:
|
|
61
|
+
* - (path) id=* {string} The id of the Price List.
|
|
62
|
+
* requestBody:
|
|
63
|
+
* content:
|
|
64
|
+
* application/json:
|
|
65
|
+
* schema:
|
|
66
|
+
* properties:
|
|
67
|
+
* name:
|
|
68
|
+
* description: "The name of the Price List"
|
|
69
|
+
* type: string
|
|
70
|
+
* description:
|
|
71
|
+
* description: "A description of the Price List."
|
|
72
|
+
* type: string
|
|
73
|
+
* type:
|
|
74
|
+
* description: The type of the Price List.
|
|
75
|
+
* type: string
|
|
76
|
+
* enum:
|
|
77
|
+
* - sale
|
|
78
|
+
* - override
|
|
79
|
+
* status:
|
|
80
|
+
* description: The status of the Price List.
|
|
81
|
+
* type: string
|
|
82
|
+
* enum:
|
|
83
|
+
* - active
|
|
84
|
+
* - draft
|
|
85
|
+
* prices:
|
|
86
|
+
* description: The prices of the Price List.
|
|
87
|
+
* type: array
|
|
88
|
+
* items:
|
|
89
|
+
* properties:
|
|
90
|
+
* id:
|
|
91
|
+
* description: The id of the price.
|
|
92
|
+
* type: string
|
|
93
|
+
* region_id:
|
|
94
|
+
* description: The id of the Region for which the price is used.
|
|
95
|
+
* type: string
|
|
96
|
+
* currency_code:
|
|
97
|
+
* description: The 3 character ISO currency code for which the price will be used.
|
|
98
|
+
* type: string
|
|
99
|
+
* amount:
|
|
100
|
+
* description: The amount to charge for the Product Variant.
|
|
101
|
+
* type: integer
|
|
102
|
+
* min_quantity:
|
|
103
|
+
* description: The minimum quantity for which the price will be used.
|
|
104
|
+
* type: integer
|
|
105
|
+
* max_quantity:
|
|
106
|
+
* description: The maximum quantity for which the price will be used.
|
|
107
|
+
* type: integer
|
|
108
|
+
* customer_groups:
|
|
109
|
+
* type: array
|
|
110
|
+
* description: A list of customer groups that the Price List applies to.
|
|
111
|
+
* items:
|
|
112
|
+
* required:
|
|
113
|
+
* - id
|
|
114
|
+
* properties:
|
|
115
|
+
* id:
|
|
116
|
+
* description: The id of a customer group
|
|
117
|
+
* type: string
|
|
118
|
+
* tags:
|
|
119
|
+
* - Price List
|
|
120
|
+
* responses:
|
|
121
|
+
* 200:
|
|
122
|
+
* description: OK
|
|
123
|
+
* content:
|
|
124
|
+
* application/json:
|
|
125
|
+
* schema:
|
|
126
|
+
* properties:
|
|
127
|
+
* product:
|
|
128
|
+
* $ref: "#/components/schemas/price_list"
|
|
129
|
+
*/
|
|
130
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
+
var id, validated, priceListService, priceList;
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
switch (_a.label) {
|
|
134
|
+
case 0:
|
|
135
|
+
id = req.params.id;
|
|
136
|
+
return [4 /*yield*/, (0, validator_1.validator)(AdminPostPriceListsPriceListPriceListReq, req.body)];
|
|
137
|
+
case 1:
|
|
138
|
+
validated = _a.sent();
|
|
139
|
+
priceListService = req.scope.resolve("priceListService");
|
|
140
|
+
return [4 /*yield*/, priceListService.update(id, validated)];
|
|
141
|
+
case 2:
|
|
142
|
+
_a.sent();
|
|
143
|
+
return [4 /*yield*/, priceListService.retrieve(id, {
|
|
144
|
+
select: _1.defaultAdminPriceListFields,
|
|
145
|
+
relations: _1.defaultAdminPriceListRelations,
|
|
146
|
+
})];
|
|
147
|
+
case 3:
|
|
148
|
+
priceList = _a.sent();
|
|
149
|
+
res.json({ price_list: priceList });
|
|
150
|
+
return [2 /*return*/];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}); });
|
|
154
|
+
var CustomerGroup = /** @class */ (function () {
|
|
155
|
+
function CustomerGroup() {
|
|
156
|
+
}
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, class_validator_1.IsString)(),
|
|
159
|
+
__metadata("design:type", String)
|
|
160
|
+
], CustomerGroup.prototype, "id", void 0);
|
|
161
|
+
return CustomerGroup;
|
|
162
|
+
}());
|
|
163
|
+
var AdminPostPriceListsPriceListPriceListReq = /** @class */ (function () {
|
|
164
|
+
function AdminPostPriceListsPriceListPriceListReq() {
|
|
165
|
+
}
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, class_validator_1.IsString)(),
|
|
168
|
+
(0, class_validator_1.IsOptional)(),
|
|
169
|
+
__metadata("design:type", String)
|
|
170
|
+
], AdminPostPriceListsPriceListPriceListReq.prototype, "name", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, class_validator_1.IsString)(),
|
|
173
|
+
(0, class_validator_1.IsOptional)(),
|
|
174
|
+
__metadata("design:type", String)
|
|
175
|
+
], AdminPostPriceListsPriceListPriceListReq.prototype, "description", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
(0, class_validator_1.IsOptional)(),
|
|
178
|
+
__metadata("design:type", Date)
|
|
179
|
+
], AdminPostPriceListsPriceListPriceListReq.prototype, "starts_at", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, class_validator_1.IsOptional)(),
|
|
182
|
+
__metadata("design:type", Date)
|
|
183
|
+
], AdminPostPriceListsPriceListPriceListReq.prototype, "ends_at", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, class_validator_1.IsOptional)(),
|
|
186
|
+
(0, class_validator_1.IsEnum)(price_list_1.PriceListStatus),
|
|
187
|
+
__metadata("design:type", String)
|
|
188
|
+
], AdminPostPriceListsPriceListPriceListReq.prototype, "status", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
(0, class_validator_1.IsOptional)(),
|
|
191
|
+
(0, class_validator_1.IsEnum)(price_list_1.PriceListType),
|
|
192
|
+
__metadata("design:type", String)
|
|
193
|
+
], AdminPostPriceListsPriceListPriceListReq.prototype, "type", void 0);
|
|
194
|
+
__decorate([
|
|
195
|
+
(0, class_validator_1.IsOptional)(),
|
|
196
|
+
(0, class_validator_1.IsArray)(),
|
|
197
|
+
(0, class_transformer_1.Type)(function () { return price_list_1.AdminPriceListPricesUpdateReq; }),
|
|
198
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
199
|
+
__metadata("design:type", Array)
|
|
200
|
+
], AdminPostPriceListsPriceListPriceListReq.prototype, "prices", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
(0, class_validator_1.IsOptional)(),
|
|
203
|
+
(0, class_validator_1.IsArray)(),
|
|
204
|
+
(0, class_transformer_1.Type)(function () { return CustomerGroup; }),
|
|
205
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
206
|
+
__metadata("design:type", Array)
|
|
207
|
+
], AdminPostPriceListsPriceListPriceListReq.prototype, "customer_groups", void 0);
|
|
208
|
+
return AdminPostPriceListsPriceListPriceListReq;
|
|
209
|
+
}());
|
|
210
|
+
exports.AdminPostPriceListsPriceListPriceListReq = AdminPostPriceListsPriceListPriceListReq;
|
|
211
|
+
//# sourceMappingURL=update-price-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-price-list.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/price-lists/update-price-list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,mDAMwB;AACxB,sBAA+E;AAG/E,2DAIqC;AACrC,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;;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yBAAO,GAAE;QACT,IAAA,wBAAI,EAAC,cAAM,OAAA,0CAA6B,EAA7B,CAA6B,CAAC;QACzC,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;4EACQ;IAMvC;QAJC,IAAA,4BAAU,GAAE;QACZ,IAAA,yBAAO,GAAE;QACT,IAAA,wBAAI,EAAC,cAAM,OAAA,aAAa,EAAb,CAAa,CAAC;QACzB,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;qFACC;IAClC,+CAAC;CAAA,AAlCD,IAkCC;AAlCY,4FAAwC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProductStatus } from "../../../../types/product";
|
|
2
|
+
import { ProductVariantPricesCreateReq } from "../../../../types/product-variant";
|
|
2
3
|
declare const _default: (req: any, res: any) => Promise<void>;
|
|
3
4
|
/**
|
|
4
5
|
* @oas [post] /products
|
|
@@ -202,12 +203,6 @@ declare class ProductVariantOptionReq {
|
|
|
202
203
|
declare class ProductOptionReq {
|
|
203
204
|
title: string;
|
|
204
205
|
}
|
|
205
|
-
declare class ProductVariantPricesReq {
|
|
206
|
-
region_id?: string;
|
|
207
|
-
currency_code?: string;
|
|
208
|
-
amount: number;
|
|
209
|
-
sale_amount?: number;
|
|
210
|
-
}
|
|
211
206
|
declare class ProductVariantReq {
|
|
212
207
|
title: string;
|
|
213
208
|
sku?: string;
|
|
@@ -226,7 +221,7 @@ declare class ProductVariantReq {
|
|
|
226
221
|
mid_code?: string;
|
|
227
222
|
material?: string;
|
|
228
223
|
metadata?: object;
|
|
229
|
-
prices:
|
|
224
|
+
prices: ProductVariantPricesCreateReq[];
|
|
230
225
|
options?: ProductVariantOptionReq[];
|
|
231
226
|
}
|
|
232
227
|
export declare class AdminPostProductsReq {
|
|
@@ -88,7 +88,7 @@ var class_transformer_1 = require("class-transformer");
|
|
|
88
88
|
var class_validator_1 = require("class-validator");
|
|
89
89
|
var _1 = require(".");
|
|
90
90
|
var product_1 = require("../../../../types/product");
|
|
91
|
-
var
|
|
91
|
+
var product_variant_1 = require("../../../../types/product-variant");
|
|
92
92
|
var validator_1 = require("../../../../utils/validator");
|
|
93
93
|
/**
|
|
94
94
|
* @oas [post] /products
|
|
@@ -411,28 +411,6 @@ var ProductOptionReq = /** @class */ (function () {
|
|
|
411
411
|
], ProductOptionReq.prototype, "title", void 0);
|
|
412
412
|
return ProductOptionReq;
|
|
413
413
|
}());
|
|
414
|
-
var ProductVariantPricesReq = /** @class */ (function () {
|
|
415
|
-
function ProductVariantPricesReq() {
|
|
416
|
-
}
|
|
417
|
-
__decorate([
|
|
418
|
-
(0, class_validator_1.Validate)(xor_1.XorConstraint, ["currency_code"]),
|
|
419
|
-
__metadata("design:type", String)
|
|
420
|
-
], ProductVariantPricesReq.prototype, "region_id", void 0);
|
|
421
|
-
__decorate([
|
|
422
|
-
(0, class_validator_1.Validate)(xor_1.XorConstraint, ["region_id"]),
|
|
423
|
-
__metadata("design:type", String)
|
|
424
|
-
], ProductVariantPricesReq.prototype, "currency_code", void 0);
|
|
425
|
-
__decorate([
|
|
426
|
-
(0, class_validator_1.IsInt)(),
|
|
427
|
-
__metadata("design:type", Number)
|
|
428
|
-
], ProductVariantPricesReq.prototype, "amount", void 0);
|
|
429
|
-
__decorate([
|
|
430
|
-
(0, class_validator_1.IsOptional)(),
|
|
431
|
-
(0, class_validator_1.IsInt)(),
|
|
432
|
-
__metadata("design:type", Number)
|
|
433
|
-
], ProductVariantPricesReq.prototype, "sale_amount", void 0);
|
|
434
|
-
return ProductVariantPricesReq;
|
|
435
|
-
}());
|
|
436
414
|
var ProductVariantReq = /** @class */ (function () {
|
|
437
415
|
function ProductVariantReq() {
|
|
438
416
|
this.inventory_quantity = 0;
|
|
@@ -525,7 +503,7 @@ var ProductVariantReq = /** @class */ (function () {
|
|
|
525
503
|
__decorate([
|
|
526
504
|
(0, class_validator_1.IsArray)(),
|
|
527
505
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
528
|
-
(0, class_transformer_1.Type)(function () { return
|
|
506
|
+
(0, class_transformer_1.Type)(function () { return product_variant_1.ProductVariantPricesCreateReq; }),
|
|
529
507
|
__metadata("design:type", Array)
|
|
530
508
|
], ProductVariantReq.prototype, "prices", void 0);
|
|
531
509
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-product.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/products/create-product.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"create-product.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/products/create-product.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,mDASwB;AAExB,sBAA2E;AAM3E,qDAAyD;AACzD,qEAAiF;AACjF,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0LG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACV,qBAAM,IAAA,qBAAS,EAAC,oBAAoB,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAA3D,SAAS,GAAG,SAA+C;gBAE3D,cAAc,GAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;gBACpE,qBAAqB,GAA0B,GAAG,CAAC,KAAK,CAAC,OAAO,CACpE,uBA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QACV,IAAA,4BAAU,GAAE;;0DACI;IAIjB;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;0DACI;IACnB,2BAAC;CAAA,AAhGD,IAgGC;AAhGY,oDAAoB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ProductVariantPricesCreateReq } from "../../../../types/product-variant";
|
|
1
2
|
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
3
|
/**
|
|
3
4
|
* @oas [post] /products/{id}/variants
|
|
@@ -80,8 +81,11 @@ declare const _default: (req: any, res: any) => Promise<void>;
|
|
|
80
81
|
* amount:
|
|
81
82
|
* description: The amount to charge for the Product Variant.
|
|
82
83
|
* type: integer
|
|
83
|
-
*
|
|
84
|
-
* description: The
|
|
84
|
+
* min_quantity:
|
|
85
|
+
* description: The minimum quantity for which the price will be used.
|
|
86
|
+
* type: integer
|
|
87
|
+
* max_quantity:
|
|
88
|
+
* description: The maximum quantity for which the price will be used.
|
|
85
89
|
* type: integer
|
|
86
90
|
* options:
|
|
87
91
|
* type: array
|
|
@@ -110,12 +114,6 @@ declare class ProductVariantOptionReq {
|
|
|
110
114
|
value: string;
|
|
111
115
|
option_id: string;
|
|
112
116
|
}
|
|
113
|
-
declare class ProductVariantPricesReq {
|
|
114
|
-
region_id?: string;
|
|
115
|
-
currency_code?: string;
|
|
116
|
-
amount: number;
|
|
117
|
-
sale_amount?: number;
|
|
118
|
-
}
|
|
119
117
|
export declare class AdminPostProductsProductVariantsReq {
|
|
120
118
|
title: string;
|
|
121
119
|
sku?: string;
|
|
@@ -134,6 +132,6 @@ export declare class AdminPostProductsProductVariantsReq {
|
|
|
134
132
|
mid_code?: string;
|
|
135
133
|
material?: string;
|
|
136
134
|
metadata?: object;
|
|
137
|
-
prices:
|
|
135
|
+
prices: ProductVariantPricesCreateReq[];
|
|
138
136
|
options: ProductVariantOptionReq[];
|
|
139
137
|
}
|