@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,84 @@
|
|
|
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
|
+
/**
|
|
40
|
+
* @oas [delete] /price-lists/{id}
|
|
41
|
+
* operationId: "DeletePriceListsPriceList"
|
|
42
|
+
* summary: "Delete a Price List"
|
|
43
|
+
* description: "Deletes a Price List"
|
|
44
|
+
* x-authenticated: true
|
|
45
|
+
* parameters:
|
|
46
|
+
* - (path) id=* {string} The id of the Price List to delete.
|
|
47
|
+
* tags:
|
|
48
|
+
* - Price List
|
|
49
|
+
* responses:
|
|
50
|
+
* 200:
|
|
51
|
+
* description: OK
|
|
52
|
+
* content:
|
|
53
|
+
* application/json:
|
|
54
|
+
* schema:
|
|
55
|
+
* properties:
|
|
56
|
+
* id:
|
|
57
|
+
* type: string
|
|
58
|
+
* description: The id of the deleted Price List.
|
|
59
|
+
* object:
|
|
60
|
+
* type: string
|
|
61
|
+
* description: The type of the object that was deleted.
|
|
62
|
+
* deleted:
|
|
63
|
+
* type: boolean
|
|
64
|
+
*/
|
|
65
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var id, priceListService;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
id = req.params.id;
|
|
71
|
+
priceListService = req.scope.resolve("priceListService");
|
|
72
|
+
return [4 /*yield*/, priceListService.delete(id)];
|
|
73
|
+
case 1:
|
|
74
|
+
_a.sent();
|
|
75
|
+
res.json({
|
|
76
|
+
id: id,
|
|
77
|
+
object: "price-list",
|
|
78
|
+
deleted: true,
|
|
79
|
+
});
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}); });
|
|
84
|
+
//# sourceMappingURL=delete-price-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-price-list.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/price-lists/delete-price-list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBAEnB,gBAAgB,GACpB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;gBACvC,qBAAM,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAA;;gBAAjC,SAAiC,CAAA;gBAEjC,GAAG,CAAC,IAAI,CAAC;oBACP,EAAE,IAAA;oBACF,MAAM,EAAE,YAAY;oBACpB,OAAO,EAAE,IAAI;iBACd,CAAC,CAAA;;;;KACH,EAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
|
+
/**
|
|
3
|
+
* @oas [delete] /price-lists/{id}/prices/batch
|
|
4
|
+
* operationId: "DeletePriceListsPriceListPricesBatch"
|
|
5
|
+
* summary: "Batch delete prices that belongs to a Price List"
|
|
6
|
+
* description: "Batch delete prices that belongs to a Price List"
|
|
7
|
+
* x-authenticated: true
|
|
8
|
+
* parameters:
|
|
9
|
+
* - (path) id=* {string} The id of the Price List that the Money Amounts that will be deleted belongs to.
|
|
10
|
+
* requestBody:
|
|
11
|
+
* content:
|
|
12
|
+
* application/json:
|
|
13
|
+
* schema:
|
|
14
|
+
* properties:
|
|
15
|
+
* price_ids:
|
|
16
|
+
* description: The price id's of the Money Amounts to delete.
|
|
17
|
+
* type: array
|
|
18
|
+
* items:
|
|
19
|
+
* type: string
|
|
20
|
+
* tags:
|
|
21
|
+
* - Price List
|
|
22
|
+
* responses:
|
|
23
|
+
* 200:
|
|
24
|
+
* description: OK
|
|
25
|
+
* content:
|
|
26
|
+
* application/json:
|
|
27
|
+
* schema:
|
|
28
|
+
* properties:
|
|
29
|
+
* ids:
|
|
30
|
+
* type: array
|
|
31
|
+
* items:
|
|
32
|
+
* type: string
|
|
33
|
+
* description: The id of the deleted Money Amount.
|
|
34
|
+
* object:
|
|
35
|
+
* type: string
|
|
36
|
+
* description: The type of the object that was deleted.
|
|
37
|
+
* deleted:
|
|
38
|
+
* type: boolean
|
|
39
|
+
*/
|
|
40
|
+
export default _default;
|
|
41
|
+
export declare class AdminDeletePriceListPricesPricesReq {
|
|
42
|
+
price_ids: string[];
|
|
43
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
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.AdminDeletePriceListPricesPricesReq = void 0;
|
|
49
|
+
var class_validator_1 = require("class-validator");
|
|
50
|
+
var validator_1 = require("../../../../utils/validator");
|
|
51
|
+
/**
|
|
52
|
+
* @oas [delete] /price-lists/{id}/prices/batch
|
|
53
|
+
* operationId: "DeletePriceListsPriceListPricesBatch"
|
|
54
|
+
* summary: "Batch delete prices that belongs to a Price List"
|
|
55
|
+
* description: "Batch delete prices that belongs to a Price List"
|
|
56
|
+
* x-authenticated: true
|
|
57
|
+
* parameters:
|
|
58
|
+
* - (path) id=* {string} The id of the Price List that the Money Amounts that will be deleted belongs to.
|
|
59
|
+
* requestBody:
|
|
60
|
+
* content:
|
|
61
|
+
* application/json:
|
|
62
|
+
* schema:
|
|
63
|
+
* properties:
|
|
64
|
+
* price_ids:
|
|
65
|
+
* description: The price id's of the Money Amounts to delete.
|
|
66
|
+
* type: array
|
|
67
|
+
* items:
|
|
68
|
+
* type: string
|
|
69
|
+
* tags:
|
|
70
|
+
* - Price List
|
|
71
|
+
* responses:
|
|
72
|
+
* 200:
|
|
73
|
+
* description: OK
|
|
74
|
+
* content:
|
|
75
|
+
* application/json:
|
|
76
|
+
* schema:
|
|
77
|
+
* properties:
|
|
78
|
+
* ids:
|
|
79
|
+
* type: array
|
|
80
|
+
* items:
|
|
81
|
+
* type: string
|
|
82
|
+
* description: The id of the deleted Money Amount.
|
|
83
|
+
* object:
|
|
84
|
+
* type: string
|
|
85
|
+
* description: The type of the object that was deleted.
|
|
86
|
+
* deleted:
|
|
87
|
+
* type: boolean
|
|
88
|
+
*/
|
|
89
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
|
+
var id, validated, priceListService;
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
switch (_a.label) {
|
|
93
|
+
case 0:
|
|
94
|
+
id = req.params.id;
|
|
95
|
+
return [4 /*yield*/, (0, validator_1.validator)(AdminDeletePriceListPricesPricesReq, req.body)];
|
|
96
|
+
case 1:
|
|
97
|
+
validated = _a.sent();
|
|
98
|
+
priceListService = req.scope.resolve("priceListService");
|
|
99
|
+
return [4 /*yield*/, priceListService.deletePrices(id, validated.price_ids)];
|
|
100
|
+
case 2:
|
|
101
|
+
_a.sent();
|
|
102
|
+
res.json({ ids: validated.price_ids, object: "money-amount", deleted: true });
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}); });
|
|
107
|
+
var AdminDeletePriceListPricesPricesReq = /** @class */ (function () {
|
|
108
|
+
function AdminDeletePriceListPricesPricesReq() {
|
|
109
|
+
}
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
112
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
113
|
+
__metadata("design:type", Array)
|
|
114
|
+
], AdminDeletePriceListPricesPricesReq.prototype, "price_ids", void 0);
|
|
115
|
+
return AdminDeletePriceListPricesPricesReq;
|
|
116
|
+
}());
|
|
117
|
+
exports.AdminDeletePriceListPricesPricesReq = AdminDeletePriceListPricesPricesReq;
|
|
118
|
+
//# sourceMappingURL=delete-prices-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-prices-batch.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/price-lists/delete-prices-batch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAyD;AAEzD,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBAEP,qBAAM,IAAA,qBAAS,EAC/B,mCAAmC,EACnC,GAAG,CAAC,IAAI,CACT,EAAA;;gBAHK,SAAS,GAAG,SAGjB;gBAEK,gBAAgB,GACpB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;gBAEvC,qBAAM,gBAAgB,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC,SAAS,CAAC,EAAA;;gBAA5D,SAA4D,CAAA;gBAE5D,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;;;;KAC9E,EAAA;AAED;IAAA;IAIA,CAAC;IADC;QAFC,IAAA,+BAAa,GAAE;QACf,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;0EACN;IACrB,0CAAC;CAAA,AAJD,IAIC;AAJY,kFAAmC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
|
+
/**
|
|
3
|
+
* @oas [get] /price-lists/{id}
|
|
4
|
+
* operationId: "GetPriceListsPriceList"
|
|
5
|
+
* summary: "Retrieve a Price List"
|
|
6
|
+
* description: "Retrieves a Price List."
|
|
7
|
+
* x-authenticated: true
|
|
8
|
+
* parameters:
|
|
9
|
+
* - (path) id=* {string} The id of the Price List.
|
|
10
|
+
* tags:
|
|
11
|
+
* - Price List
|
|
12
|
+
* responses:
|
|
13
|
+
* 200:
|
|
14
|
+
* description: OK
|
|
15
|
+
* content:
|
|
16
|
+
* application/json:
|
|
17
|
+
* schema:
|
|
18
|
+
* properties:
|
|
19
|
+
* price_list:
|
|
20
|
+
* $ref: "#/components/schemas/price_list"
|
|
21
|
+
*/
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
var _1 = require(".");
|
|
40
|
+
/**
|
|
41
|
+
* @oas [get] /price-lists/{id}
|
|
42
|
+
* operationId: "GetPriceListsPriceList"
|
|
43
|
+
* summary: "Retrieve a Price List"
|
|
44
|
+
* description: "Retrieves a Price List."
|
|
45
|
+
* x-authenticated: true
|
|
46
|
+
* parameters:
|
|
47
|
+
* - (path) id=* {string} The id of the Price List.
|
|
48
|
+
* tags:
|
|
49
|
+
* - Price List
|
|
50
|
+
* responses:
|
|
51
|
+
* 200:
|
|
52
|
+
* description: OK
|
|
53
|
+
* content:
|
|
54
|
+
* application/json:
|
|
55
|
+
* schema:
|
|
56
|
+
* properties:
|
|
57
|
+
* price_list:
|
|
58
|
+
* $ref: "#/components/schemas/price_list"
|
|
59
|
+
*/
|
|
60
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
|
+
var id, priceListService, priceList;
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
switch (_a.label) {
|
|
64
|
+
case 0:
|
|
65
|
+
id = req.params.id;
|
|
66
|
+
priceListService = req.scope.resolve("priceListService");
|
|
67
|
+
return [4 /*yield*/, priceListService.retrieve(id, {
|
|
68
|
+
select: _1.defaultAdminPriceListFields,
|
|
69
|
+
relations: _1.defaultAdminPriceListRelations,
|
|
70
|
+
})];
|
|
71
|
+
case 1:
|
|
72
|
+
priceList = _a.sent();
|
|
73
|
+
res.status(200).json({ price_list: priceList });
|
|
74
|
+
return [2 /*return*/];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); });
|
|
78
|
+
//# sourceMappingURL=get-price-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-price-list.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/price-lists/get-price-list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sBAA+E;AAI/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBAEnB,gBAAgB,GACpB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;gBAErB,qBAAM,gBAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE;wBACpD,MAAM,EAAE,8BAAkD;wBAC1D,SAAS,EAAE,iCAA8B;qBAC1C,CAAC,EAAA;;gBAHI,SAAS,GAAG,SAGhB;gBAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAA;;;;KAChD,EAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { PriceList } from "../../../..";
|
|
3
|
+
import { DeleteResponse, PaginatedResponse } from "../../../../types/common";
|
|
4
|
+
declare const _default: (app: any) => any;
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const defaultAdminPriceListFields: string[];
|
|
7
|
+
export declare const defaultAdminPriceListRelations: string[];
|
|
8
|
+
export declare const allowedAdminPriceListFields: string[];
|
|
9
|
+
export declare type AdminPriceListRes = {
|
|
10
|
+
price_list: PriceList;
|
|
11
|
+
};
|
|
12
|
+
export declare type AdminPriceListDeleteRes = DeleteResponse;
|
|
13
|
+
export declare type AdminPriceListsListRes = PaginatedResponse & {
|
|
14
|
+
price_lists: PriceList[];
|
|
15
|
+
};
|
|
16
|
+
export * from "./add-prices-batch";
|
|
17
|
+
export * from "./create-price-list";
|
|
18
|
+
export * from "./delete-price-list";
|
|
19
|
+
export * from "./get-price-list";
|
|
20
|
+
export * from "./list-price-lists";
|
|
21
|
+
export * from "./update-price-list";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.allowedAdminPriceListFields = exports.defaultAdminPriceListRelations = exports.defaultAdminPriceListFields = void 0;
|
|
17
|
+
var express_1 = require("express");
|
|
18
|
+
require("reflect-metadata");
|
|
19
|
+
var middlewares_1 = __importDefault(require("../../../middlewares"));
|
|
20
|
+
var route = (0, express_1.Router)();
|
|
21
|
+
exports.default = (function (app) {
|
|
22
|
+
app.use("/price-lists", route);
|
|
23
|
+
route.get("/:id", middlewares_1.default.wrap(require("./get-price-list").default));
|
|
24
|
+
route.get("/", middlewares_1.default.wrap(require("./list-price-lists").default));
|
|
25
|
+
route.post("/", middlewares_1.default.wrap(require("./create-price-list").default));
|
|
26
|
+
route.post("/:id", middlewares_1.default.wrap(require("./update-price-list").default));
|
|
27
|
+
route.delete("/:id", middlewares_1.default.wrap(require("./delete-price-list").default));
|
|
28
|
+
route.delete("/:id/prices/batch", middlewares_1.default.wrap(require("./delete-prices-batch").default));
|
|
29
|
+
route.post("/:id/prices/batch", middlewares_1.default.wrap(require("./add-prices-batch").default));
|
|
30
|
+
return app;
|
|
31
|
+
});
|
|
32
|
+
exports.defaultAdminPriceListFields = [
|
|
33
|
+
"id",
|
|
34
|
+
"name",
|
|
35
|
+
"description",
|
|
36
|
+
"type",
|
|
37
|
+
"status",
|
|
38
|
+
"starts_at",
|
|
39
|
+
"ends_at",
|
|
40
|
+
"created_at",
|
|
41
|
+
"updated_at",
|
|
42
|
+
"deleted_at",
|
|
43
|
+
];
|
|
44
|
+
exports.defaultAdminPriceListRelations = ["prices", "customer_groups"];
|
|
45
|
+
exports.allowedAdminPriceListFields = ["prices", "customer_groups"];
|
|
46
|
+
__exportStar(require("./add-prices-batch"), exports);
|
|
47
|
+
__exportStar(require("./create-price-list"), exports);
|
|
48
|
+
__exportStar(require("./delete-price-list"), exports);
|
|
49
|
+
__exportStar(require("./get-price-list"), exports);
|
|
50
|
+
__exportStar(require("./list-price-lists"), exports);
|
|
51
|
+
__exportStar(require("./update-price-list"), exports);
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/price-lists/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAAgC;AAChC,4BAAyB;AAGzB,qEAA8C;AAE9C,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG;IACjB,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IAE9B,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAExE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAEvE,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAEzE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAE5E,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAE9E,KAAK,CAAC,MAAM,CACV,mBAAmB,EACnB,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAC3D,CAAA;IAED,KAAK,CAAC,IAAI,CACR,mBAAmB,EACnB,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CACxD,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,EAAA;AAEY,QAAA,2BAA2B,GAAG;IACzC,IAAI;IACJ,MAAM;IACN,aAAa;IACb,MAAM;IACN,QAAQ;IACR,WAAW;IACX,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,YAAY;CACb,CAAA;AAEY,QAAA,8BAA8B,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAE9D,QAAA,2BAA2B,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAYxE,qDAAkC;AAClC,sDAAmC;AACnC,sDAAmC;AACnC,mDAAgC;AAChC,qDAAkC;AAClC,sDAAmC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FilterablePriceListProps } from "../../../../types/price-list";
|
|
2
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* @oas [get] /price-lists
|
|
5
|
+
* operationId: "GetPriceLists"
|
|
6
|
+
* summary: "List Price Lists"
|
|
7
|
+
* description: "Retrieves a list of Price Lists."
|
|
8
|
+
* x-authenticated: true
|
|
9
|
+
* tags:
|
|
10
|
+
* - Price List
|
|
11
|
+
* responses:
|
|
12
|
+
* 200:
|
|
13
|
+
* description: OK
|
|
14
|
+
* content:
|
|
15
|
+
* application/json:
|
|
16
|
+
* schema:
|
|
17
|
+
* properties:
|
|
18
|
+
* price_lists:
|
|
19
|
+
* type: array
|
|
20
|
+
* items:
|
|
21
|
+
* $ref: "#/components/schemas/price_list"
|
|
22
|
+
* count:
|
|
23
|
+
* description: The number of Price Lists.
|
|
24
|
+
* type: integer
|
|
25
|
+
* offset:
|
|
26
|
+
* description: The offset of the Price List query.
|
|
27
|
+
* type: integer
|
|
28
|
+
* limit:
|
|
29
|
+
* description: The limit of the Price List query.
|
|
30
|
+
* type: integer
|
|
31
|
+
*/
|
|
32
|
+
export default _default;
|
|
33
|
+
export declare class AdminGetPriceListPaginationParams extends FilterablePriceListProps {
|
|
34
|
+
offset?: number;
|
|
35
|
+
limit?: number;
|
|
36
|
+
expand?: string;
|
|
37
|
+
order?: string;
|
|
38
|
+
}
|