@medusajs/medusa 1.1.63 → 1.1.64
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/CHANGELOG.md +6 -0
- package/package.json +3 -3
- package/dist/api/routes/admin/product-tags/create-collection.d.ts +0 -41
- package/dist/api/routes/admin/product-tags/create-collection.js +0 -125
- package/dist/api/routes/admin/product-tags/create-collection.js.map +0 -1
- package/dist/api/routes/admin/product-tags/delete-collection.d.ts +0 -28
- package/dist/api/routes/admin/product-tags/delete-collection.js +0 -84
- package/dist/api/routes/admin/product-tags/delete-collection.js.map +0 -1
- package/dist/api/routes/admin/product-tags/get-collection.d.ts +0 -22
- package/dist/api/routes/admin/product-tags/get-collection.js +0 -74
- package/dist/api/routes/admin/product-tags/get-collection.js.map +0 -1
- package/dist/api/routes/admin/product-tags/list-collections.d.ts +0 -40
- package/dist/api/routes/admin/product-tags/list-collections.js +0 -215
- package/dist/api/routes/admin/product-tags/list-collections.js.map +0 -1
- package/dist/api/routes/admin/product-tags/update-collection.d.ts +0 -41
- package/dist/api/routes/admin/product-tags/update-collection.js +0 -127
- package/dist/api/routes/admin/product-tags/update-collection.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/add-to-product-types.d.ts +0 -29
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js +0 -177
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/add-to-products.d.ts +0 -29
- package/dist/api/routes/admin/tax-rates/add-to-products.js +0 -173
- package/dist/api/routes/admin/tax-rates/add-to-products.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.d.ts +0 -29
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js +0 -177
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/create-tax-rate.d.ts +0 -35
- package/dist/api/routes/admin/tax-rates/create-tax-rate.js +0 -286
- package/dist/api/routes/admin/tax-rates/create-tax-rate.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/delete-tax-rate.d.ts +0 -28
- package/dist/api/routes/admin/tax-rates/delete-tax-rate.js +0 -84
- package/dist/api/routes/admin/tax-rates/delete-tax-rate.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/get-tax-rate.d.ts +0 -26
- package/dist/api/routes/admin/tax-rates/get-tax-rate.js +0 -106
- package/dist/api/routes/admin/tax-rates/get-tax-rate.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/index.d.ts +0 -21
- package/dist/api/routes/admin/tax-rates/index.js +0 -74
- package/dist/api/routes/admin/tax-rates/index.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/list-tax-rates.d.ts +0 -44
- package/dist/api/routes/admin/tax-rates/list-tax-rates.js +0 -178
- package/dist/api/routes/admin/tax-rates/list-tax-rates.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/update-tax-rate.d.ts +0 -35
- package/dist/api/routes/admin/tax-rates/update-tax-rate.js +0 -286
- package/dist/api/routes/admin/tax-rates/update-tax-rate.js.map +0 -1
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.d.ts +0 -7
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.js +0 -91
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.js.map +0 -1
- package/dist/api/routes/store/carts/calculate-taxes.d.ts +0 -24
- package/dist/api/routes/store/carts/calculate-taxes.js +0 -153
- package/dist/api/routes/store/carts/calculate-taxes.js.map +0 -1
- package/dist/interfaces/cart-completion-strategy.d.ts +0 -20
- package/dist/interfaces/cart-completion-strategy.js +0 -10
- package/dist/interfaces/cart-completion-strategy.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -3
- package/dist/interfaces/index.js +0 -16
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/tax-calculation-strategy.d.ts +0 -16
- package/dist/interfaces/tax-calculation-strategy.js +0 -10
- package/dist/interfaces/tax-calculation-strategy.js.map +0 -1
- package/dist/interfaces/tax-service.d.ts +0 -51
- package/dist/interfaces/tax-service.js +0 -3
- package/dist/interfaces/tax-service.js.map +0 -1
- package/dist/loaders/strategies.d.ts +0 -12
- package/dist/loaders/strategies.js +0 -32
- package/dist/loaders/strategies.js.map +0 -1
- package/dist/migrations/1641636508055-new_tax_system.d.ts +0 -6
- package/dist/migrations/1641636508055-new_tax_system.js +0 -248
- package/dist/migrations/1641636508055-new_tax_system.js.map +0 -1
- package/dist/models/line-item-tax-line.d.ts +0 -7
- package/dist/models/line-item-tax-line.js +0 -65
- package/dist/models/line-item-tax-line.js.map +0 -1
- package/dist/models/product-tax-rate.d.ts +0 -40
- package/dist/models/product-tax-rate.js +0 -88
- package/dist/models/product-tax-rate.js.map +0 -1
- package/dist/models/product-type-tax-rate.d.ts +0 -40
- package/dist/models/product-type-tax-rate.js +0 -88
- package/dist/models/product-type-tax-rate.js.map +0 -1
- package/dist/models/shipping-method-tax-line.d.ts +0 -7
- package/dist/models/shipping-method-tax-line.js +0 -65
- package/dist/models/shipping-method-tax-line.js.map +0 -1
- package/dist/models/shipping-tax-rate.d.ts +0 -40
- package/dist/models/shipping-tax-rate.js +0 -88
- package/dist/models/shipping-tax-rate.js.map +0 -1
- package/dist/models/tax-line.d.ts +0 -39
- package/dist/models/tax-line.js +0 -79
- package/dist/models/tax-line.js.map +0 -1
- package/dist/models/tax-provider.d.ts +0 -17
- package/dist/models/tax-provider.js +0 -44
- package/dist/models/tax-provider.js.map +0 -1
- package/dist/models/tax-rate.d.ts +0 -58
- package/dist/models/tax-rate.js +0 -159
- package/dist/models/tax-rate.js.map +0 -1
- package/dist/repositories/line-item-tax-line.d.ts +0 -4
- package/dist/repositories/line-item-tax-line.js +0 -38
- package/dist/repositories/line-item-tax-line.js.map +0 -1
- package/dist/repositories/product-tax-rate.d.ts +0 -4
- package/dist/repositories/product-tax-rate.js +0 -38
- package/dist/repositories/product-tax-rate.js.map +0 -1
- package/dist/repositories/shipping-method-tax-line.d.ts +0 -4
- package/dist/repositories/shipping-method-tax-line.js +0 -38
- package/dist/repositories/shipping-method-tax-line.js.map +0 -1
- package/dist/repositories/shipping-tax-rate.d.ts +0 -4
- package/dist/repositories/shipping-tax-rate.js +0 -38
- package/dist/repositories/shipping-tax-rate.js.map +0 -1
- package/dist/repositories/tax-rate.d.ts +0 -18
- package/dist/repositories/tax-rate.js +0 -359
- package/dist/repositories/tax-rate.js.map +0 -1
- package/dist/services/product-tax-rate.d.ts +0 -25
- package/dist/services/product-tax-rate.js +0 -104
- package/dist/services/product-tax-rate.js.map +0 -1
- package/dist/services/product-type.d.ts +0 -27
- package/dist/services/product-type.js +0 -112
- package/dist/services/product-type.js.map +0 -1
- package/dist/services/shipping-tax-rate.d.ts +0 -26
- package/dist/services/shipping-tax-rate.js +0 -105
- package/dist/services/shipping-tax-rate.js.map +0 -1
- package/dist/services/system-tax.d.ts +0 -9
- package/dist/services/system-tax.js +0 -89
- package/dist/services/system-tax.js.map +0 -1
- package/dist/services/tax-provider.d.ts +0 -105
- package/dist/services/tax-provider.js +0 -455
- package/dist/services/tax-provider.js.map +0 -1
- package/dist/services/tax-rate.d.ts +0 -31
- package/dist/services/tax-rate.js +0 -405
- package/dist/services/tax-rate.js.map +0 -1
- package/dist/strategies/cart-completion.d.ts +0 -17
- package/dist/strategies/cart-completion.js +0 -336
- package/dist/strategies/cart-completion.js.map +0 -1
- package/dist/strategies/tax-calculation.d.ts +0 -11
- package/dist/strategies/tax-calculation.js +0 -147
- package/dist/strategies/tax-calculation.js.map +0 -1
- package/dist/types/product-tax-rate.d.ts +0 -10
- package/dist/types/product-tax-rate.js +0 -13
- package/dist/types/product-tax-rate.js.map +0 -1
- package/dist/types/request.d.ts +0 -3
- package/dist/types/request.js +0 -3
- package/dist/types/request.js.map +0 -1
- package/dist/types/shipping-tax-rate.d.ts +0 -10
- package/dist/types/shipping-tax-rate.js +0 -13
- package/dist/types/shipping-tax-rate.js.map +0 -1
- package/dist/types/tax-rate.d.ts +0 -25
- package/dist/types/tax-rate.js +0 -3
- package/dist/types/tax-rate.js.map +0 -1
- package/dist/types/tax-service.d.ts +0 -34
- package/dist/types/tax-service.js +0 -3
- package/dist/types/tax-service.js.map +0 -1
- package/dist/types/totals.d.ts +0 -42
- package/dist/types/totals.js +0 -3
- package/dist/types/totals.js.map +0 -1
|
@@ -1,215 +0,0 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
30
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
31
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
32
|
-
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;
|
|
33
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
34
|
-
};
|
|
35
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
36
|
-
if (mod && mod.__esModule) return mod;
|
|
37
|
-
var result = {};
|
|
38
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
39
|
-
__setModuleDefault(result, mod);
|
|
40
|
-
return result;
|
|
41
|
-
};
|
|
42
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
43
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
44
|
-
};
|
|
45
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
46
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
47
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
48
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
49
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
50
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
51
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
55
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
56
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
57
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
58
|
-
function step(op) {
|
|
59
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
60
|
-
while (_) try {
|
|
61
|
-
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;
|
|
62
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
63
|
-
switch (op[0]) {
|
|
64
|
-
case 0: case 1: t = op; break;
|
|
65
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
66
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
67
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
68
|
-
default:
|
|
69
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
70
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
71
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
72
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
73
|
-
if (t[2]) _.ops.pop();
|
|
74
|
-
_.trys.pop(); continue;
|
|
75
|
-
}
|
|
76
|
-
op = body.call(thisArg, _);
|
|
77
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
78
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
82
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
83
|
-
if (!m) return o;
|
|
84
|
-
var i = m.call(o), r, ar = [], e;
|
|
85
|
-
try {
|
|
86
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
87
|
-
}
|
|
88
|
-
catch (error) { e = { error: error }; }
|
|
89
|
-
finally {
|
|
90
|
-
try {
|
|
91
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
92
|
-
}
|
|
93
|
-
finally { if (e) throw e.error; }
|
|
94
|
-
}
|
|
95
|
-
return ar;
|
|
96
|
-
};
|
|
97
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
98
|
-
exports.AdminGetCollectionsParams = exports.AdminGetCollectionsPaginationParams = void 0;
|
|
99
|
-
var class_transformer_1 = require("class-transformer");
|
|
100
|
-
var class_validator_1 = require("class-validator");
|
|
101
|
-
var lodash_1 = __importStar(require("lodash"));
|
|
102
|
-
var _1 = require(".");
|
|
103
|
-
var common_1 = require("../../../../types/common");
|
|
104
|
-
var validator_1 = require("../../../../utils/validator");
|
|
105
|
-
/**
|
|
106
|
-
* @oas [get] /collections
|
|
107
|
-
* operationId: "GetCollections"
|
|
108
|
-
* summary: "List Product Collections"
|
|
109
|
-
* description: "Retrieve a list of Product Collection."
|
|
110
|
-
* x-authenticated: true
|
|
111
|
-
* parameters:
|
|
112
|
-
* - (query) limit {string} The number of collections to return.
|
|
113
|
-
* - (query) offset {string} The offset of collections to return.
|
|
114
|
-
* - (query) title {string} The title of collections to return.
|
|
115
|
-
* - (query) handle {string} The handle of collections to return.
|
|
116
|
-
* - (query) deleted_at {DateComparisonOperator} Date comparison for when resulting collections was deleted, i.e. less than, greater than etc.
|
|
117
|
-
* - (query) created_at {DateComparisonOperator} Date comparison for when resulting collections was created, i.e. less than, greater than etc.
|
|
118
|
-
* - (query) updated_at {DateComparisonOperator} Date comparison for when resulting collections was updated, i.e. less than, greater than etc.
|
|
119
|
-
* tags:
|
|
120
|
-
* - Collection
|
|
121
|
-
* responses:
|
|
122
|
-
* "200":
|
|
123
|
-
* description: OK
|
|
124
|
-
* content:
|
|
125
|
-
* application/json:
|
|
126
|
-
* schema:
|
|
127
|
-
* properties:
|
|
128
|
-
* collection:
|
|
129
|
-
* $ref: "#/components/schemas/product_collection"
|
|
130
|
-
*/
|
|
131
|
-
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
132
|
-
var validated, productCollectionService, listConfig, filterableFields, _a, collections, count;
|
|
133
|
-
return __generator(this, function (_b) {
|
|
134
|
-
switch (_b.label) {
|
|
135
|
-
case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminGetCollectionsParams, req.query)];
|
|
136
|
-
case 1:
|
|
137
|
-
validated = _b.sent();
|
|
138
|
-
productCollectionService = req.scope.resolve("productCollectionService");
|
|
139
|
-
listConfig = {
|
|
140
|
-
select: _1.defaultAdminCollectionsFields,
|
|
141
|
-
relations: _1.defaultAdminCollectionsRelations,
|
|
142
|
-
skip: validated.offset,
|
|
143
|
-
take: validated.limit,
|
|
144
|
-
};
|
|
145
|
-
filterableFields = lodash_1.default.omit(validated, ["limit", "offset"]);
|
|
146
|
-
return [4 /*yield*/, productCollectionService.listAndCount(lodash_1.default.pickBy(filterableFields, lodash_1.identity), listConfig)];
|
|
147
|
-
case 2:
|
|
148
|
-
_a = __read.apply(void 0, [_b.sent(), 2]), collections = _a[0], count = _a[1];
|
|
149
|
-
res.status(200).json({
|
|
150
|
-
collections: collections,
|
|
151
|
-
count: count,
|
|
152
|
-
offset: validated.offset,
|
|
153
|
-
limit: validated.limit,
|
|
154
|
-
});
|
|
155
|
-
return [2 /*return*/];
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
}); });
|
|
159
|
-
var AdminGetCollectionsPaginationParams = /** @class */ (function () {
|
|
160
|
-
function AdminGetCollectionsPaginationParams() {
|
|
161
|
-
this.limit = 10;
|
|
162
|
-
this.offset = 0;
|
|
163
|
-
}
|
|
164
|
-
__decorate([
|
|
165
|
-
(0, class_validator_1.IsNumber)(),
|
|
166
|
-
(0, class_validator_1.IsOptional)(),
|
|
167
|
-
(0, class_transformer_1.Type)(function () { return Number; }),
|
|
168
|
-
__metadata("design:type", Object)
|
|
169
|
-
], AdminGetCollectionsPaginationParams.prototype, "limit", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
(0, class_validator_1.IsNumber)(),
|
|
172
|
-
(0, class_validator_1.IsOptional)(),
|
|
173
|
-
(0, class_transformer_1.Type)(function () { return Number; }),
|
|
174
|
-
__metadata("design:type", Object)
|
|
175
|
-
], AdminGetCollectionsPaginationParams.prototype, "offset", void 0);
|
|
176
|
-
return AdminGetCollectionsPaginationParams;
|
|
177
|
-
}());
|
|
178
|
-
exports.AdminGetCollectionsPaginationParams = AdminGetCollectionsPaginationParams;
|
|
179
|
-
var AdminGetCollectionsParams = /** @class */ (function (_super) {
|
|
180
|
-
__extends(AdminGetCollectionsParams, _super);
|
|
181
|
-
function AdminGetCollectionsParams() {
|
|
182
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
183
|
-
}
|
|
184
|
-
__decorate([
|
|
185
|
-
(0, class_validator_1.IsOptional)(),
|
|
186
|
-
(0, class_validator_1.IsString)(),
|
|
187
|
-
__metadata("design:type", String)
|
|
188
|
-
], AdminGetCollectionsParams.prototype, "title", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
(0, class_validator_1.IsOptional)(),
|
|
191
|
-
(0, class_validator_1.IsString)(),
|
|
192
|
-
__metadata("design:type", String)
|
|
193
|
-
], AdminGetCollectionsParams.prototype, "handle", void 0);
|
|
194
|
-
__decorate([
|
|
195
|
-
(0, class_validator_1.IsOptional)(),
|
|
196
|
-
(0, class_validator_1.ValidateNested)(),
|
|
197
|
-
(0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
|
|
198
|
-
__metadata("design:type", common_1.DateComparisonOperator)
|
|
199
|
-
], AdminGetCollectionsParams.prototype, "created_at", void 0);
|
|
200
|
-
__decorate([
|
|
201
|
-
(0, class_validator_1.IsOptional)(),
|
|
202
|
-
(0, class_validator_1.ValidateNested)(),
|
|
203
|
-
(0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
|
|
204
|
-
__metadata("design:type", common_1.DateComparisonOperator)
|
|
205
|
-
], AdminGetCollectionsParams.prototype, "updated_at", void 0);
|
|
206
|
-
__decorate([
|
|
207
|
-
(0, class_validator_1.ValidateNested)(),
|
|
208
|
-
(0, class_validator_1.IsOptional)(),
|
|
209
|
-
(0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
|
|
210
|
-
__metadata("design:type", common_1.DateComparisonOperator)
|
|
211
|
-
], AdminGetCollectionsParams.prototype, "deleted_at", void 0);
|
|
212
|
-
return AdminGetCollectionsParams;
|
|
213
|
-
}(AdminGetCollectionsPaginationParams));
|
|
214
|
-
exports.AdminGetCollectionsParams = AdminGetCollectionsParams;
|
|
215
|
-
//# sourceMappingURL=list-collections.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-collections.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/product-tags/list-collections.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,mDAAgF;AAChF,+CAAoC;AACpC,sBAGU;AAEV,mDAAiE;AACjE,yDAAuD;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACV,qBAAM,IAAA,qBAAS,EAAC,yBAAyB,EAAE,GAAG,CAAC,KAAK,CAAC,EAAA;;gBAAjE,SAAS,GAAG,SAAqD;gBAEjE,wBAAwB,GAA6B,GAAG,CAAC,KAAK,CAAC,OAAO,CAC1E,0BAA0B,CAC3B,CAAA;gBAEK,UAAU,GAAG;oBACjB,MAAM,EAAE,gCAA6B;oBACrC,SAAS,EAAE,mCAAgC;oBAC3C,IAAI,EAAE,SAAS,CAAC,MAAM;oBACtB,IAAI,EAAE,SAAS,CAAC,KAAK;iBACtB,CAAA;gBAEK,gBAAgB,GAAG,gBAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAA;gBAElC,qBAAM,wBAAwB,CAAC,YAAY,CACtE,gBAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,iBAAQ,CAAC,EACpC,UAAU,CACX,EAAA;;gBAHK,KAAA,sBAAuB,SAG5B,KAAA,EAHM,WAAW,QAAA,EAAE,KAAK,QAAA;gBAKzB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,WAAW,aAAA;oBACX,KAAK,OAAA;oBACL,MAAM,EAAE,SAAS,CAAC,MAAM;oBACxB,KAAK,EAAE,SAAS,CAAC,KAAK;iBACvB,CAAC,CAAA;;;;KACH,EAAA;AAED;IAAA;QAIE,UAAK,GAAG,EAAE,CAAA;QAKV,WAAM,GAAG,CAAC,CAAA;IACZ,CAAC;IANC;QAHC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;QACZ,IAAA,wBAAI,EAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;;sEACT;IAKV;QAHC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;QACZ,IAAA,wBAAI,EAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;;uEACT;IACZ,0CAAC;CAAA,AAVD,IAUC;AAVY,kFAAmC;AAYhD;IAA+C,6CAAmC;IAAlF;;IAuBA,CAAC;IApBC;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,0BAAQ,GAAE;;4DACG;IAId;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,0BAAQ,GAAE;;6DACI;IAKf;QAHC,IAAA,4BAAU,GAAE;QACZ,IAAA,gCAAc,GAAE;QAChB,IAAA,wBAAI,EAAC,cAAM,OAAA,+BAAsB,EAAtB,CAAsB,CAAC;kCACtB,+BAAsB;iEAAA;IAKnC;QAHC,IAAA,4BAAU,GAAE;QACZ,IAAA,gCAAc,GAAE;QAChB,IAAA,wBAAI,EAAC,cAAM,OAAA,+BAAsB,EAAtB,CAAsB,CAAC;kCACtB,+BAAsB;iEAAA;IAKnC;QAHC,IAAA,gCAAc,GAAE;QAChB,IAAA,4BAAU,GAAE;QACZ,IAAA,wBAAI,EAAC,cAAM,OAAA,+BAAsB,EAAtB,CAAsB,CAAC;kCACtB,+BAAsB;iEAAA;IACrC,gCAAC;CAAA,AAvBD,CAA+C,mCAAmC,GAuBjF;AAvBY,8DAAyB"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
|
-
/**
|
|
3
|
-
* @oas [post] /collections/{id}
|
|
4
|
-
* operationId: "PostCollectionsCollection"
|
|
5
|
-
* summary: "Update a Product Collection"
|
|
6
|
-
* description: "Updates a Product Collection."
|
|
7
|
-
* x-authenticated: true
|
|
8
|
-
* parameters:
|
|
9
|
-
* - (path) id=* {string} The id of the Collection.
|
|
10
|
-
* requestBody:
|
|
11
|
-
* content:
|
|
12
|
-
* application/json:
|
|
13
|
-
* schema:
|
|
14
|
-
* properties:
|
|
15
|
-
* title:
|
|
16
|
-
* type: string
|
|
17
|
-
* description: The title to identify the Collection by.
|
|
18
|
-
* handle:
|
|
19
|
-
* type: string
|
|
20
|
-
* description: An optional handle to be used in slugs, if none is provided we will kebab-case the title.
|
|
21
|
-
* metadata:
|
|
22
|
-
* description: An optional set of key-value pairs to hold additional information.
|
|
23
|
-
* type: object
|
|
24
|
-
* tags:
|
|
25
|
-
* - Collection
|
|
26
|
-
* responses:
|
|
27
|
-
* "200":
|
|
28
|
-
* description: OK
|
|
29
|
-
* content:
|
|
30
|
-
* application/json:
|
|
31
|
-
* schema:
|
|
32
|
-
* properties:
|
|
33
|
-
* collection:
|
|
34
|
-
* $ref: "#/components/schemas/product_collection"
|
|
35
|
-
*/
|
|
36
|
-
export default _default;
|
|
37
|
-
export declare class AdminPostCollectionsCollectionReq {
|
|
38
|
-
title?: string;
|
|
39
|
-
handle?: string;
|
|
40
|
-
metadata?: object;
|
|
41
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
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.AdminPostCollectionsCollectionReq = void 0;
|
|
49
|
-
var class_validator_1 = require("class-validator");
|
|
50
|
-
var validator_1 = require("../../../../utils/validator");
|
|
51
|
-
/**
|
|
52
|
-
* @oas [post] /collections/{id}
|
|
53
|
-
* operationId: "PostCollectionsCollection"
|
|
54
|
-
* summary: "Update a Product Collection"
|
|
55
|
-
* description: "Updates a Product Collection."
|
|
56
|
-
* x-authenticated: true
|
|
57
|
-
* parameters:
|
|
58
|
-
* - (path) id=* {string} The id of the Collection.
|
|
59
|
-
* requestBody:
|
|
60
|
-
* content:
|
|
61
|
-
* application/json:
|
|
62
|
-
* schema:
|
|
63
|
-
* properties:
|
|
64
|
-
* title:
|
|
65
|
-
* type: string
|
|
66
|
-
* description: The title to identify the Collection by.
|
|
67
|
-
* handle:
|
|
68
|
-
* type: string
|
|
69
|
-
* description: An optional handle to be used in slugs, if none is provided we will kebab-case the title.
|
|
70
|
-
* metadata:
|
|
71
|
-
* description: An optional set of key-value pairs to hold additional information.
|
|
72
|
-
* type: object
|
|
73
|
-
* tags:
|
|
74
|
-
* - Collection
|
|
75
|
-
* responses:
|
|
76
|
-
* "200":
|
|
77
|
-
* description: OK
|
|
78
|
-
* content:
|
|
79
|
-
* application/json:
|
|
80
|
-
* schema:
|
|
81
|
-
* properties:
|
|
82
|
-
* collection:
|
|
83
|
-
* $ref: "#/components/schemas/product_collection"
|
|
84
|
-
*/
|
|
85
|
-
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
-
var id, validated, productCollectionService, updated, collection;
|
|
87
|
-
return __generator(this, function (_a) {
|
|
88
|
-
switch (_a.label) {
|
|
89
|
-
case 0:
|
|
90
|
-
id = req.params.id;
|
|
91
|
-
return [4 /*yield*/, (0, validator_1.validator)(AdminPostCollectionsCollectionReq, req.body)];
|
|
92
|
-
case 1:
|
|
93
|
-
validated = _a.sent();
|
|
94
|
-
productCollectionService = req.scope.resolve("productCollectionService");
|
|
95
|
-
return [4 /*yield*/, productCollectionService.update(id, validated)];
|
|
96
|
-
case 2:
|
|
97
|
-
updated = _a.sent();
|
|
98
|
-
return [4 /*yield*/, productCollectionService.retrieve(updated.id)];
|
|
99
|
-
case 3:
|
|
100
|
-
collection = _a.sent();
|
|
101
|
-
res.status(200).json({ collection: collection });
|
|
102
|
-
return [2 /*return*/];
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}); });
|
|
106
|
-
var AdminPostCollectionsCollectionReq = /** @class */ (function () {
|
|
107
|
-
function AdminPostCollectionsCollectionReq() {
|
|
108
|
-
}
|
|
109
|
-
__decorate([
|
|
110
|
-
(0, class_validator_1.IsString)(),
|
|
111
|
-
(0, class_validator_1.IsOptional)(),
|
|
112
|
-
__metadata("design:type", String)
|
|
113
|
-
], AdminPostCollectionsCollectionReq.prototype, "title", void 0);
|
|
114
|
-
__decorate([
|
|
115
|
-
(0, class_validator_1.IsString)(),
|
|
116
|
-
(0, class_validator_1.IsOptional)(),
|
|
117
|
-
__metadata("design:type", String)
|
|
118
|
-
], AdminPostCollectionsCollectionReq.prototype, "handle", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
(0, class_validator_1.IsObject)(),
|
|
121
|
-
(0, class_validator_1.IsOptional)(),
|
|
122
|
-
__metadata("design:type", Object)
|
|
123
|
-
], AdminPostCollectionsCollectionReq.prototype, "metadata", void 0);
|
|
124
|
-
return AdminPostCollectionsCollectionReq;
|
|
125
|
-
}());
|
|
126
|
-
exports.AdminPostCollectionsCollectionReq = AdminPostCollectionsCollectionReq;
|
|
127
|
-
//# sourceMappingURL=update-collection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-collection.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/product-tags/update-collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAgE;AAEhE,yDAAuD;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBAEP,qBAAM,IAAA,qBAAS,EAAC,iCAAiC,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAAxE,SAAS,GAAG,SAA4D;gBACxE,wBAAwB,GAA6B,GAAG,CAAC,KAAK,CAAC,OAAO,CAC1E,0BAA0B,CAC3B,CAAA;gBAEe,qBAAM,wBAAwB,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,EAAA;;gBAA9D,OAAO,GAAG,SAAoD;gBACjD,qBAAM,wBAAwB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAA;;gBAAhE,UAAU,GAAG,SAAmD;gBAEtE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,UAAU,YAAA,EAAE,CAAC,CAAA;;;;KACrC,EAAA;AAED;IAAA;IAYA,CAAC;IATC;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;oEACC;IAId;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;qEACE;IAIf;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;uEACI;IACnB,wCAAC;CAAA,AAZD,IAYC;AAZY,8EAAiC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
|
-
/**
|
|
3
|
-
* @oas [post] /tax-rates/:id/product-types
|
|
4
|
-
* operationId: "PostTaxRatesTaxRateProductTypes"
|
|
5
|
-
* summary: "Add Tax Rate to Product Types"
|
|
6
|
-
* description: "Associates a Tax Rate with a list of Product Types"
|
|
7
|
-
* x-authenticated: true
|
|
8
|
-
* tags:
|
|
9
|
-
* - Tax Rates
|
|
10
|
-
* responses:
|
|
11
|
-
* 200:
|
|
12
|
-
* description: OK
|
|
13
|
-
* content:
|
|
14
|
-
* application/json:
|
|
15
|
-
* schema:
|
|
16
|
-
* properties:
|
|
17
|
-
* tax_rate:
|
|
18
|
-
* type: array
|
|
19
|
-
* items:
|
|
20
|
-
* $ref: "#/components/schemas/tax_rate"
|
|
21
|
-
*/
|
|
22
|
-
export default _default;
|
|
23
|
-
export declare class AdminPostTaxRatesTaxRateProductTypesReq {
|
|
24
|
-
product_types: string[];
|
|
25
|
-
}
|
|
26
|
-
export declare class AdminPostTaxRatesTaxRateProductTypesParams {
|
|
27
|
-
expand?: string[];
|
|
28
|
-
fields?: string[];
|
|
29
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
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
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
48
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
49
|
-
if (!m) return o;
|
|
50
|
-
var i = m.call(o), r, ar = [], e;
|
|
51
|
-
try {
|
|
52
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
53
|
-
}
|
|
54
|
-
catch (error) { e = { error: error }; }
|
|
55
|
-
finally {
|
|
56
|
-
try {
|
|
57
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
58
|
-
}
|
|
59
|
-
finally { if (e) throw e.error; }
|
|
60
|
-
}
|
|
61
|
-
return ar;
|
|
62
|
-
};
|
|
63
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
64
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
65
|
-
if (ar || !(i in from)) {
|
|
66
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
67
|
-
ar[i] = from[i];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
71
|
-
};
|
|
72
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
|
-
exports.AdminPostTaxRatesTaxRateProductTypesParams = exports.AdminPostTaxRatesTaxRateProductTypesReq = void 0;
|
|
74
|
-
var get_query_config_1 = require("./utils/get-query-config");
|
|
75
|
-
var class_validator_1 = require("class-validator");
|
|
76
|
-
var validator_1 = require("../../../../utils/validator");
|
|
77
|
-
/**
|
|
78
|
-
* @oas [post] /tax-rates/:id/product-types
|
|
79
|
-
* operationId: "PostTaxRatesTaxRateProductTypes"
|
|
80
|
-
* summary: "Add Tax Rate to Product Types"
|
|
81
|
-
* description: "Associates a Tax Rate with a list of Product Types"
|
|
82
|
-
* x-authenticated: true
|
|
83
|
-
* tags:
|
|
84
|
-
* - Tax Rates
|
|
85
|
-
* responses:
|
|
86
|
-
* 200:
|
|
87
|
-
* description: OK
|
|
88
|
-
* content:
|
|
89
|
-
* application/json:
|
|
90
|
-
* schema:
|
|
91
|
-
* properties:
|
|
92
|
-
* tax_rate:
|
|
93
|
-
* type: array
|
|
94
|
-
* items:
|
|
95
|
-
* $ref: "#/components/schemas/tax_rate"
|
|
96
|
-
*/
|
|
97
|
-
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
|
-
var value, query, rateService, productTypeService, err_1, config, rate, data;
|
|
99
|
-
return __generator(this, function (_a) {
|
|
100
|
-
switch (_a.label) {
|
|
101
|
-
case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminPostTaxRatesTaxRateProductTypesReq, req.body)];
|
|
102
|
-
case 1:
|
|
103
|
-
value = _a.sent();
|
|
104
|
-
return [4 /*yield*/, (0, validator_1.validator)(AdminPostTaxRatesTaxRateProductTypesParams, req.query)];
|
|
105
|
-
case 2:
|
|
106
|
-
query = _a.sent();
|
|
107
|
-
rateService = req.scope.resolve("taxRateService");
|
|
108
|
-
productTypeService = req.scope.resolve("productTypeService");
|
|
109
|
-
_a.label = 3;
|
|
110
|
-
case 3:
|
|
111
|
-
_a.trys.push([3, 5, , 8]);
|
|
112
|
-
return [4 /*yield*/, rateService.addToProductType(req.params.id, value.product_types)];
|
|
113
|
-
case 4:
|
|
114
|
-
_a.sent();
|
|
115
|
-
return [3 /*break*/, 8];
|
|
116
|
-
case 5:
|
|
117
|
-
err_1 = _a.sent();
|
|
118
|
-
if (!(err_1.code === "23503")) return [3 /*break*/, 7];
|
|
119
|
-
// A foreign key constraint failed meaning some thing doesn't exist
|
|
120
|
-
// either it is a product type or the tax rate itself. Using Promise.all
|
|
121
|
-
// will try to retrieve all of the resources and will fail when something
|
|
122
|
-
// is not found.
|
|
123
|
-
return [4 /*yield*/, Promise.all(__spreadArray([
|
|
124
|
-
rateService.retrieve(req.params.id, {
|
|
125
|
-
select: ["id"],
|
|
126
|
-
})
|
|
127
|
-
], __read(value.product_types.map(function (id) {
|
|
128
|
-
return productTypeService.retrieve(id, {
|
|
129
|
-
select: ["id"],
|
|
130
|
-
});
|
|
131
|
-
})), false))];
|
|
132
|
-
case 6:
|
|
133
|
-
// A foreign key constraint failed meaning some thing doesn't exist
|
|
134
|
-
// either it is a product type or the tax rate itself. Using Promise.all
|
|
135
|
-
// will try to retrieve all of the resources and will fail when something
|
|
136
|
-
// is not found.
|
|
137
|
-
_a.sent();
|
|
138
|
-
_a.label = 7;
|
|
139
|
-
case 7: throw err_1;
|
|
140
|
-
case 8:
|
|
141
|
-
config = (0, get_query_config_1.getRetrieveConfig)(query.fields, query.expand);
|
|
142
|
-
return [4 /*yield*/, rateService.retrieve(req.params.id, config)];
|
|
143
|
-
case 9:
|
|
144
|
-
rate = _a.sent();
|
|
145
|
-
data = (0, get_query_config_1.pickByConfig)(rate, config);
|
|
146
|
-
res.json({ tax_rate: data });
|
|
147
|
-
return [2 /*return*/];
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}); });
|
|
151
|
-
var AdminPostTaxRatesTaxRateProductTypesReq = /** @class */ (function () {
|
|
152
|
-
function AdminPostTaxRatesTaxRateProductTypesReq() {
|
|
153
|
-
}
|
|
154
|
-
__decorate([
|
|
155
|
-
(0, class_validator_1.IsArray)(),
|
|
156
|
-
__metadata("design:type", Array)
|
|
157
|
-
], AdminPostTaxRatesTaxRateProductTypesReq.prototype, "product_types", void 0);
|
|
158
|
-
return AdminPostTaxRatesTaxRateProductTypesReq;
|
|
159
|
-
}());
|
|
160
|
-
exports.AdminPostTaxRatesTaxRateProductTypesReq = AdminPostTaxRatesTaxRateProductTypesReq;
|
|
161
|
-
var AdminPostTaxRatesTaxRateProductTypesParams = /** @class */ (function () {
|
|
162
|
-
function AdminPostTaxRatesTaxRateProductTypesParams() {
|
|
163
|
-
}
|
|
164
|
-
__decorate([
|
|
165
|
-
(0, class_validator_1.IsArray)(),
|
|
166
|
-
(0, class_validator_1.IsOptional)(),
|
|
167
|
-
__metadata("design:type", Array)
|
|
168
|
-
], AdminPostTaxRatesTaxRateProductTypesParams.prototype, "expand", void 0);
|
|
169
|
-
__decorate([
|
|
170
|
-
(0, class_validator_1.IsArray)(),
|
|
171
|
-
(0, class_validator_1.IsOptional)(),
|
|
172
|
-
__metadata("design:type", Array)
|
|
173
|
-
], AdminPostTaxRatesTaxRateProductTypesParams.prototype, "fields", void 0);
|
|
174
|
-
return AdminPostTaxRatesTaxRateProductTypesParams;
|
|
175
|
-
}());
|
|
176
|
-
exports.AdminPostTaxRatesTaxRateProductTypesParams = AdminPostTaxRatesTaxRateProductTypesParams;
|
|
177
|
-
//# sourceMappingURL=add-to-product-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-to-product-types.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/add-to-product-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA0E;AAC1E,mDAAqD;AAIrD,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACd,qBAAM,IAAA,qBAAS,EAC3B,uCAAuC,EACvC,GAAG,CAAC,IAAI,CACT,EAAA;;gBAHK,KAAK,GAAG,SAGb;gBAEa,qBAAM,IAAA,qBAAS,EAC3B,0CAA0C,EAC1C,GAAG,CAAC,KAAK,CACV,EAAA;;gBAHK,KAAK,GAAG,SAGb;gBAEK,WAAW,GAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;gBACjE,kBAAkB,GACtB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;;;;gBAGvC,qBAAM,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,aAAa,CAAC,EAAA;;gBAAtE,SAAsE,CAAA;;;;qBAElE,CAAA,KAAG,CAAC,IAAI,KAAK,OAAO,CAAA,EAApB,wBAAoB;gBACtB,mEAAmE;gBACnE,wEAAwE;gBACxE,yEAAyE;gBACzE,gBAAgB;gBAChB,qBAAM,OAAO,CAAC,GAAG;wBACf,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE;4BAClC,MAAM,EAAE,CAAC,IAAI,CAAC;yBACf,CAAqB;8BACnB,KAAK,CAAC,aAAa,CAAC,GAAG,CACxB,UAAC,EAAE;wBACD,OAAA,kBAAkB,CAAC,QAAQ,CAAC,EAAE,EAAE;4BAC9B,MAAM,EAAE,CAAC,IAAI,CAAC;yBACf,CAAqB;oBAFtB,CAEsB,CACzB,UACD,EAAA;;gBAdF,mEAAmE;gBACnE,wEAAwE;gBACxE,yEAAyE;gBACzE,gBAAgB;gBAChB,SAUE,CAAA;;oBAGJ,MAAM,KAAG,CAAA;;gBAGL,MAAM,GAAG,IAAA,oCAAiB,EAC9B,KAAK,CAAC,MAA2B,EACjC,KAAK,CAAC,MAAM,CACb,CAAA;gBACY,qBAAM,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EAAA;;gBAAxD,IAAI,GAAG,SAAiD;gBACxD,IAAI,GAAG,IAAA,+BAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAA;gBAEvC,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;;KAC7B,EAAA;AAED;IAAA;IAGA,CAAC;IADC;QADC,IAAA,yBAAO,GAAE;;kFACa;IACzB,8CAAC;CAAA,AAHD,IAGC;AAHY,0FAAuC;AAKpD;IAAA;IAQA,CAAC;IALC;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;8EACI;IAIjB;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;8EACI;IACnB,iDAAC;CAAA,AARD,IAQC;AARY,gGAA0C"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
|
-
/**
|
|
3
|
-
* @oas [post] /tax-rates/:id/products
|
|
4
|
-
* operationId: "PostTaxRatesTaxRateProducts"
|
|
5
|
-
* summary: "Add Tax Rate to Products"
|
|
6
|
-
* description: "Associates a Tax Rate with a list of Products"
|
|
7
|
-
* x-authenticated: true
|
|
8
|
-
* tags:
|
|
9
|
-
* - Tax Rates
|
|
10
|
-
* responses:
|
|
11
|
-
* 200:
|
|
12
|
-
* description: OK
|
|
13
|
-
* content:
|
|
14
|
-
* application/json:
|
|
15
|
-
* schema:
|
|
16
|
-
* properties:
|
|
17
|
-
* tax_rate:
|
|
18
|
-
* type: array
|
|
19
|
-
* items:
|
|
20
|
-
* $ref: "#/components/schemas/tax_rate"
|
|
21
|
-
*/
|
|
22
|
-
export default _default;
|
|
23
|
-
export declare class AdminPostTaxRatesTaxRateProductsReq {
|
|
24
|
-
products: string[];
|
|
25
|
-
}
|
|
26
|
-
export declare class AdminPostTaxRatesTaxRateProductsParams {
|
|
27
|
-
expand?: string[];
|
|
28
|
-
fields?: string[];
|
|
29
|
-
}
|