@medusajs/medusa 1.2.1 → 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/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/middlewares/error-handler.js +6 -0
- package/dist/api/middlewares/error-handler.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/add-customers-batch.d.ts +27 -0
- package/dist/{db-subscribers/region.js → api/routes/admin/customer-groups/add-customers-batch.js} +60 -38
- package/dist/api/routes/admin/customer-groups/add-customers-batch.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group-customers.d.ts +20 -0
- package/dist/{subscribers/region.js → api/routes/admin/customer-groups/get-customer-group-customers.js} +38 -27
- package/dist/api/routes/admin/customer-groups/get-customer-group-customers.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.d.ts +1 -1
- package/dist/api/routes/admin/customer-groups/get-customer-group.js +1 -1
- package/dist/api/routes/admin/customer-groups/index.d.ts +5 -0
- package/dist/api/routes/admin/customer-groups/index.js +8 -0
- package/dist/api/routes/admin/customer-groups/index.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/list-customer-groups.d.ts +38 -0
- package/dist/api/routes/admin/customer-groups/list-customer-groups.js +200 -0
- package/dist/api/routes/admin/customer-groups/list-customer-groups.js.map +1 -0
- package/dist/api/routes/admin/customers/index.js +1 -1
- package/dist/api/routes/admin/customers/index.js.map +1 -1
- package/dist/api/routes/admin/customers/list-customers.js +12 -46
- package/dist/api/routes/admin/customers/list-customers.js.map +1 -1
- package/dist/api/routes/admin/discounts/update-discount.d.ts +2 -2
- package/dist/api/routes/admin/discounts/update-discount.js +3 -3
- package/dist/api/routes/admin/discounts/update-discount.js.map +1 -1
- 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/{orders/receive-swap.js → price-lists/add-prices-batch.js} +77 -78
- 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 +7 -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/auth/exists.js +4 -2
- package/dist/api/routes/store/auth/exists.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 +3 -2
- package/dist/api/routes/store/products/list-products.js +39 -10
- 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/api/routes/store/variants/list-variants.d.ts +4 -0
- package/dist/api/routes/store/variants/list-variants.js +33 -9
- package/dist/api/routes/store/variants/list-variants.js.map +1 -1
- package/dist/controllers/customers/index.d.ts +4 -0
- package/dist/controllers/customers/index.js +8 -0
- package/dist/controllers/customers/index.js.map +1 -0
- package/dist/controllers/customers/list-customers.d.ts +3 -0
- package/dist/controllers/customers/list-customers.js +96 -0
- package/dist/controllers/customers/list-customers.js.map +1 -0
- 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/customer.js +3 -1
- package/dist/models/customer.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/customer-group.d.ts +1 -0
- package/dist/repositories/customer-group.js +24 -0
- package/dist/repositories/customer-group.js.map +1 -1
- package/dist/repositories/customer.d.ts +1 -0
- package/dist/repositories/customer.js +65 -0
- package/dist/repositories/customer.js.map +1 -1
- 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/repositories/product.d.ts +1 -0
- package/dist/repositories/product.js +6 -2
- package/dist/repositories/product.js.map +1 -1
- package/dist/services/customer-group.d.ts +24 -1
- package/dist/services/customer-group.js +95 -2
- package/dist/services/customer-group.js.map +1 -1
- package/dist/services/customer.d.ts +1 -3
- package/dist/services/customer.js +40 -44
- package/dist/services/customer.js.map +1 -1
- package/dist/services/discount.js +19 -11
- 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-collection.js +29 -8
- package/dist/services/product-collection.js.map +1 -1
- 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/services/product.js +38 -26
- package/dist/services/product.js.map +1 -1
- package/dist/types/customer-groups.d.ts +5 -1
- package/dist/types/customer-groups.js +25 -0
- package/dist/types/customer-groups.js.map +1 -1
- package/dist/types/customers.d.ts +1 -0
- package/dist/types/customers.js +5 -0
- package/dist/types/customers.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 +20 -3
- package/dist/types/product-variant.js +69 -5
- package/dist/types/product-variant.js.map +1 -1
- package/dist/utils/exception-formatter.d.ts +5 -0
- package/dist/utils/exception-formatter.js +29 -0
- package/dist/utils/exception-formatter.js.map +1 -0
- package/package.json +7 -7
- package/yarn-error.log +79 -5
- package/dist/api/routes/admin/orders/receive-swap.d.ts +0 -46
- package/dist/api/routes/admin/orders/receive-swap.js.map +0 -1
- package/dist/db-subscribers/region.d.ts +0 -6
- package/dist/db-subscribers/region.js.map +0 -1
- package/dist/entity-subscribers/region.d.ts +0 -6
- package/dist/entity-subscribers/region.js +0 -27
- package/dist/entity-subscribers/region.js.map +0 -1
- package/dist/loaders/db-subscribers.d.ts +0 -6
- package/dist/loaders/db-subscribers.js +0 -53
- package/dist/loaders/db-subscribers.js.map +0 -1
- package/dist/subscribers/region.d.ts +0 -14
- package/dist/subscribers/region.js.map +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
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.AdminPostPriceListsPriceListReq = void 0;
|
|
49
|
+
var class_transformer_1 = require("class-transformer");
|
|
50
|
+
var class_validator_1 = require("class-validator");
|
|
51
|
+
var price_list_1 = require("../../../../types/price-list");
|
|
52
|
+
var validator_1 = require("../../../../utils/validator");
|
|
53
|
+
/**
|
|
54
|
+
* @oas [post] /price_lists
|
|
55
|
+
* operationId: "PostPriceListsPriceList"
|
|
56
|
+
* summary: "Creates a Price List"
|
|
57
|
+
* description: "Creates a Price List"
|
|
58
|
+
* x-authenticated: true
|
|
59
|
+
* requestBody:
|
|
60
|
+
* content:
|
|
61
|
+
* application/json:
|
|
62
|
+
* schema:
|
|
63
|
+
* properties:
|
|
64
|
+
* name:
|
|
65
|
+
* description: "The name of the Price List"
|
|
66
|
+
* type: string
|
|
67
|
+
* description:
|
|
68
|
+
* description: "A description of the Price List."
|
|
69
|
+
* type: string
|
|
70
|
+
* type:
|
|
71
|
+
* description: The type of the Price List.
|
|
72
|
+
* type: string
|
|
73
|
+
* enum:
|
|
74
|
+
* - sale
|
|
75
|
+
* - override
|
|
76
|
+
* status:
|
|
77
|
+
* description: The status of the Price List.
|
|
78
|
+
* type: string
|
|
79
|
+
* enum:
|
|
80
|
+
* - active
|
|
81
|
+
* - draft
|
|
82
|
+
* prices:
|
|
83
|
+
* description: The prices of the Price List.
|
|
84
|
+
* type: array
|
|
85
|
+
* items:
|
|
86
|
+
* properties:
|
|
87
|
+
* region_id:
|
|
88
|
+
* description: The id of the Region for which the price is used.
|
|
89
|
+
* type: string
|
|
90
|
+
* currency_code:
|
|
91
|
+
* description: The 3 character ISO currency code for which the price will be used.
|
|
92
|
+
* type: string
|
|
93
|
+
* amount:
|
|
94
|
+
* description: The amount to charge for the Product Variant.
|
|
95
|
+
* type: integer
|
|
96
|
+
* min_quantity:
|
|
97
|
+
* description: The minimum quantity for which the price will be used.
|
|
98
|
+
* type: integer
|
|
99
|
+
* max_quantity:
|
|
100
|
+
* description: The maximum quantity for which the price will be used.
|
|
101
|
+
* type: integer
|
|
102
|
+
* customer_groups:
|
|
103
|
+
* type: array
|
|
104
|
+
* description: A list of customer groups that the Price List applies to.
|
|
105
|
+
* items:
|
|
106
|
+
* required:
|
|
107
|
+
* - id
|
|
108
|
+
* properties:
|
|
109
|
+
* id:
|
|
110
|
+
* description: The id of a customer group
|
|
111
|
+
* type: string
|
|
112
|
+
* tags:
|
|
113
|
+
* - Price List
|
|
114
|
+
* responses:
|
|
115
|
+
* 200:
|
|
116
|
+
* description: OK
|
|
117
|
+
* content:
|
|
118
|
+
* application/json:
|
|
119
|
+
* schema:
|
|
120
|
+
* properties:
|
|
121
|
+
* product:
|
|
122
|
+
* $ref: "#/components/schemas/price_list"
|
|
123
|
+
*/
|
|
124
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
+
var validated, priceListService, priceList;
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminPostPriceListsPriceListReq, req.body)];
|
|
129
|
+
case 1:
|
|
130
|
+
validated = _a.sent();
|
|
131
|
+
priceListService = req.scope.resolve("priceListService");
|
|
132
|
+
return [4 /*yield*/, priceListService.create(validated)];
|
|
133
|
+
case 2:
|
|
134
|
+
priceList = _a.sent();
|
|
135
|
+
res.json({ price_list: priceList });
|
|
136
|
+
return [2 /*return*/];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}); });
|
|
140
|
+
var CustomerGroup = /** @class */ (function () {
|
|
141
|
+
function CustomerGroup() {
|
|
142
|
+
}
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, class_validator_1.IsString)(),
|
|
145
|
+
__metadata("design:type", String)
|
|
146
|
+
], CustomerGroup.prototype, "id", void 0);
|
|
147
|
+
return CustomerGroup;
|
|
148
|
+
}());
|
|
149
|
+
var AdminPostPriceListsPriceListReq = /** @class */ (function () {
|
|
150
|
+
function AdminPostPriceListsPriceListReq() {
|
|
151
|
+
}
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, class_validator_1.IsString)(),
|
|
154
|
+
__metadata("design:type", String)
|
|
155
|
+
], AdminPostPriceListsPriceListReq.prototype, "name", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, class_validator_1.IsString)(),
|
|
158
|
+
__metadata("design:type", String)
|
|
159
|
+
], AdminPostPriceListsPriceListReq.prototype, "description", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, class_validator_1.IsOptional)(),
|
|
162
|
+
__metadata("design:type", Date)
|
|
163
|
+
], AdminPostPriceListsPriceListReq.prototype, "starts_at", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, class_validator_1.IsOptional)(),
|
|
166
|
+
__metadata("design:type", Date)
|
|
167
|
+
], AdminPostPriceListsPriceListReq.prototype, "ends_at", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, class_validator_1.IsOptional)(),
|
|
170
|
+
(0, class_validator_1.IsEnum)(price_list_1.PriceListStatus),
|
|
171
|
+
__metadata("design:type", String)
|
|
172
|
+
], AdminPostPriceListsPriceListReq.prototype, "status", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
(0, class_validator_1.IsEnum)(price_list_1.PriceListType),
|
|
175
|
+
__metadata("design:type", String)
|
|
176
|
+
], AdminPostPriceListsPriceListReq.prototype, "type", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
(0, class_validator_1.IsArray)(),
|
|
179
|
+
(0, class_transformer_1.Type)(function () { return price_list_1.AdminPriceListPricesCreateReq; }),
|
|
180
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
181
|
+
__metadata("design:type", Array)
|
|
182
|
+
], AdminPostPriceListsPriceListReq.prototype, "prices", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
(0, class_validator_1.IsOptional)(),
|
|
185
|
+
(0, class_validator_1.IsArray)(),
|
|
186
|
+
(0, class_transformer_1.Type)(function () { return CustomerGroup; }),
|
|
187
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
188
|
+
__metadata("design:type", Array)
|
|
189
|
+
], AdminPostPriceListsPriceListReq.prototype, "customer_groups", void 0);
|
|
190
|
+
return AdminPostPriceListsPriceListReq;
|
|
191
|
+
}());
|
|
192
|
+
exports.AdminPostPriceListsPriceListReq = AdminPostPriceListsPriceListReq;
|
|
193
|
+
//# sourceMappingURL=create-price-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-price-list.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/price-lists/create-price-list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,mDAMwB;AAExB,2DAIqC;AACrC,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACV,qBAAM,IAAA,qBAAS,EAAC,+BAA+B,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAAtE,SAAS,GAAG,SAA0D;gBAEtE,gBAAgB,GACpB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;gBAErB,qBAAM,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,EAAA;;gBAApD,SAAS,GAAG,SAAwC;gBAE1D,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAA;;;;KACpC,EAAA;AAED;IAAA;IAGA,CAAC;IADC;QADC,IAAA,0BAAQ,GAAE;;6CACD;IACZ,oBAAC;CAAA,AAHD,IAGC;AAED;IAAA;IA8BA,CAAC;IA5BC;QADC,IAAA,0BAAQ,GAAE;;iEACC;IAGZ;QADC,IAAA,0BAAQ,GAAE;;wEACQ;IAGnB;QADC,IAAA,4BAAU,GAAE;kCACD,IAAI;sEAAA;IAGhB;QADC,IAAA,4BAAU,GAAE;kCACH,IAAI;oEAAA;IAId;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,wBAAM,EAAC,4BAAe,CAAC;;mEACA;IAGxB;QADC,IAAA,wBAAM,EAAC,0BAAa,CAAC;;iEACH;IAKnB;QAHC,IAAA,yBAAO,GAAE;QACT,IAAA,wBAAI,EAAC,cAAM,OAAA,0CAA6B,EAA7B,CAA6B,CAAC;QACzC,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;mEACQ;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;;4EACE;IACnC,sCAAC;CAAA,AA9BD,IA8BC;AA9BY,0EAA+B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
|
+
/**
|
|
3
|
+
* @oas [delete] /price-lists/{id}
|
|
4
|
+
* operationId: "DeletePriceListsPriceList"
|
|
5
|
+
* summary: "Delete a Price List"
|
|
6
|
+
* description: "Deletes a Price List"
|
|
7
|
+
* x-authenticated: true
|
|
8
|
+
* parameters:
|
|
9
|
+
* - (path) id=* {string} The id of the Price List to delete.
|
|
10
|
+
* tags:
|
|
11
|
+
* - Price List
|
|
12
|
+
* responses:
|
|
13
|
+
* 200:
|
|
14
|
+
* description: OK
|
|
15
|
+
* content:
|
|
16
|
+
* application/json:
|
|
17
|
+
* schema:
|
|
18
|
+
* properties:
|
|
19
|
+
* id:
|
|
20
|
+
* type: string
|
|
21
|
+
* description: The id of the deleted Price List.
|
|
22
|
+
* object:
|
|
23
|
+
* type: string
|
|
24
|
+
* description: The type of the object that was deleted.
|
|
25
|
+
* deleted:
|
|
26
|
+
* type: boolean
|
|
27
|
+
*/
|
|
28
|
+
export default _default;
|
|
@@ -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
|