@medusajs/medusa 1.1.65-tax-api.48 → 1.2.2-dev.47
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 +51 -0
- 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/api/routes/admin/customer-groups/add-customers-batch.js +106 -0
- package/dist/api/routes/admin/customer-groups/add-customers-batch.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/create-customer-group.d.ts +2 -2
- package/dist/api/routes/admin/customer-groups/create-customer-group.js +3 -3
- package/dist/api/routes/admin/customer-groups/create-customer-group.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/delete-customer-group.d.ts +28 -0
- package/dist/api/routes/admin/customer-groups/delete-customer-group.js +84 -0
- package/dist/api/routes/admin/customer-groups/delete-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.d.ts +27 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.js +106 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.d.ts +25 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.js +113 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/index.d.ts +6 -0
- package/dist/api/routes/admin/customer-groups/index.js +13 -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/customer-groups/update-customer-group.d.ts +28 -0
- package/dist/api/routes/admin/customer-groups/update-customer-group.js +124 -0
- package/dist/api/routes/admin/customer-groups/update-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customers/list-customers.js +11 -46
- package/dist/api/routes/admin/customers/list-customers.js.map +1 -1
- package/dist/api/routes/admin/customers/update-customer.d.ts +14 -0
- package/dist/api/routes/admin/customers/update-customer.js +49 -10
- package/dist/api/routes/admin/customers/update-customer.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/orders/receive-swap.d.ts +46 -0
- package/dist/api/routes/admin/orders/receive-swap.js +159 -0
- package/dist/api/routes/admin/orders/receive-swap.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js +3 -58
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-products.js +3 -54
- package/dist/api/routes/admin/tax-rates/add-to-products.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js +3 -58
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/create-tax-rate.js +14 -113
- package/dist/api/routes/admin/tax-rates/create-tax-rate.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/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/controllers/list-customers.d.ts +0 -0
- package/dist/controllers/list-customers.js +1 -0
- package/dist/controllers/list-customers.js.map +1 -0
- package/dist/migrations/1644943746861-customer_groups.js +2 -2
- package/dist/migrations/1644943746861-customer_groups.js.map +1 -1
- package/dist/models/customer-group.js +3 -1
- package/dist/models/customer-group.js.map +1 -1
- package/dist/models/customer.js +14 -1
- package/dist/models/customer.js.map +1 -1
- package/dist/repositories/customer-group.d.ts +3 -1
- package/dist/repositories/customer-group.js +77 -0
- package/dist/repositories/customer-group.js.map +1 -1
- package/dist/repositories/money-amount.d.ts +6 -0
- package/dist/repositories/money-amount.js +97 -0
- package/dist/repositories/money-amount.js.map +1 -1
- package/dist/services/customer-group.d.ts +57 -1
- package/dist/services/customer-group.js +246 -1
- package/dist/services/customer-group.js.map +1 -1
- package/dist/services/customer.js +12 -3
- package/dist/services/customer.js.map +1 -1
- package/dist/services/discount.js +17 -9
- package/dist/services/discount.js.map +1 -1
- package/dist/services/invite.d.ts +3 -3
- package/dist/services/invite.js +4 -2
- package/dist/services/invite.js.map +1 -1
- package/dist/services/product-collection.js +29 -8
- package/dist/services/product-collection.js.map +1 -1
- package/dist/services/product-variant.d.ts +1 -0
- package/dist/services/product-variant.js +96 -85
- package/dist/services/product-variant.js.map +1 -1
- package/dist/services/product.js +35 -25
- package/dist/services/product.js.map +1 -1
- package/dist/services/region.js +1 -0
- package/dist/services/region.js.map +1 -1
- package/dist/services/swap.js +2 -1
- package/dist/services/swap.js.map +1 -1
- package/dist/services/tax-rate.js +164 -156
- package/dist/services/tax-rate.js.map +1 -1
- package/dist/types/customer-groups.d.ts +15 -0
- package/dist/types/customer-groups.js +68 -0
- package/dist/types/customer-groups.js.map +1 -0
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,57 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.1](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.64...@medusajs/medusa@1.2.1) (2022-02-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add tax repo to withTransaction in region service ([#1126](https://github.com/medusajs/medusa/issues/1126)) ([549ad3b](https://github.com/medusajs/medusa/commit/549ad3b907b27dd985157c4cb58d07162b1b739d))
|
|
12
|
+
* allow offset and limit in products free text search ([#1082](https://github.com/medusajs/medusa/issues/1082)) ([a81def2](https://github.com/medusajs/medusa/commit/a81def2f75a9fea4a113d2d2e92037c7ae0e4de6))
|
|
13
|
+
* export params type ([9d6489d](https://github.com/medusajs/medusa/commit/9d6489d7e24015cac399d687f38121edbc812487))
|
|
14
|
+
* export request types from add and remove product endpoints ([#1078](https://github.com/medusajs/medusa/issues/1078)) ([1f2ee04](https://github.com/medusajs/medusa/commit/1f2ee04abe9769cca9421cb9a3c96dce2eaac4cb))
|
|
15
|
+
* unit test case for `CustomerGroupServiceMock.retrieve` ([aa8bbfd](https://github.com/medusajs/medusa/commit/aa8bbfdd58240fc5b56cb79c0b5c3b4a834d937a))
|
|
16
|
+
* variant price update ([#1093](https://github.com/medusajs/medusa/issues/1093)) ([59d5d8a](https://github.com/medusajs/medusa/commit/59d5d8a185ad7035bdca89cf527509af1672e1c0))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* add `extend` param for customer groups ([bf3e04f](https://github.com/medusajs/medusa/commit/bf3e04f41ac3df14c7ecdb7355d7e2e0ec7cd8c0))
|
|
22
|
+
* add and remove products to/from collection in bulk endpoints ([#1032](https://github.com/medusajs/medusa/issues/1032)) ([1e4cc2f](https://github.com/medusajs/medusa/commit/1e4cc2fc80372613f26880c3cce3c9c1c0d1f2c6))
|
|
23
|
+
* customer group update ([#1098](https://github.com/medusajs/medusa/issues/1098)) ([d80eaa1](https://github.com/medusajs/medusa/commit/d80eaa172d9db928a2fee60a33a10032045ed74d))
|
|
24
|
+
* GET customer group endpoint ([de06b47](https://github.com/medusajs/medusa/commit/de06b47b15443aa3ec95028124fd65694921083f))
|
|
25
|
+
* new tax api ([#979](https://github.com/medusajs/medusa/issues/979)) ([47588e7](https://github.com/medusajs/medusa/commit/47588e7a8d3b2ae2fed0c1e87fdf1ee2db6bcdc2)), closes [#885](https://github.com/medusajs/medusa/issues/885) [#896](https://github.com/medusajs/medusa/issues/896) [#911](https://github.com/medusajs/medusa/issues/911) [#945](https://github.com/medusajs/medusa/issues/945) [#950](https://github.com/medusajs/medusa/issues/950) [#951](https://github.com/medusajs/medusa/issues/951) [#954](https://github.com/medusajs/medusa/issues/954) [#969](https://github.com/medusajs/medusa/issues/969) [#998](https://github.com/medusajs/medusa/issues/998) [#1017](https://github.com/medusajs/medusa/issues/1017) [#1110](https://github.com/medusajs/medusa/issues/1110)
|
|
26
|
+
* update customer groups ([#1075](https://github.com/medusajs/medusa/issues/1075)) ([73359a6](https://github.com/medusajs/medusa/commit/73359a632b2d65369b0db62d9e21979e5e26bea8))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# [1.2.0](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.64...@medusajs/medusa@1.2.0) (2022-02-25)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* allow offset and limit in products free text search ([#1082](https://github.com/medusajs/medusa/issues/1082)) ([c2241d1](https://github.com/medusajs/medusa/commit/c2241d110178d9ed992793d582ef652c4a23b729))
|
|
38
|
+
* export params type ([4ee2af2](https://github.com/medusajs/medusa/commit/4ee2af2582d6c6420e7faf238447b77499e5d32d))
|
|
39
|
+
* export request types from add and remove product endpoints ([#1078](https://github.com/medusajs/medusa/issues/1078)) ([449e666](https://github.com/medusajs/medusa/commit/449e6664283edc2bce42b97b9d52def1841a9a18))
|
|
40
|
+
* unit test case for `CustomerGroupServiceMock.retrieve` ([def8763](https://github.com/medusajs/medusa/commit/def8763ee203c60728815ef3d36e57b5533b97c8))
|
|
41
|
+
* variant price update ([#1093](https://github.com/medusajs/medusa/issues/1093)) ([cb7b211](https://github.com/medusajs/medusa/commit/cb7b211c9bb3188ecf072fa1734055a4ddfe7f86))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* add `extend` param for customer groups ([ecd6ed8](https://github.com/medusajs/medusa/commit/ecd6ed820e77904fe59ff6fcc9195533968dd9f3))
|
|
47
|
+
* add and remove products to/from collection in bulk endpoints ([#1032](https://github.com/medusajs/medusa/issues/1032)) ([6629403](https://github.com/medusajs/medusa/commit/66294038f0ccf0b81bcf099b590379acffb647ba))
|
|
48
|
+
* customer group update ([#1098](https://github.com/medusajs/medusa/issues/1098)) ([694e2df](https://github.com/medusajs/medusa/commit/694e2df20f8c1b125c51f7d24b1e3abdc4b3cff6))
|
|
49
|
+
* GET customer group endpoint ([21d99a4](https://github.com/medusajs/medusa/commit/21d99a44a9fb2bd0f52c8bc8b5c75d200ef6d539))
|
|
50
|
+
* new tax api ([#979](https://github.com/medusajs/medusa/issues/979)) ([c56660f](https://github.com/medusajs/medusa/commit/c56660fca9921a3f3637bc137d9794781c5b090f)), closes [#885](https://github.com/medusajs/medusa/issues/885) [#896](https://github.com/medusajs/medusa/issues/896) [#911](https://github.com/medusajs/medusa/issues/911) [#945](https://github.com/medusajs/medusa/issues/945) [#950](https://github.com/medusajs/medusa/issues/950) [#951](https://github.com/medusajs/medusa/issues/951) [#954](https://github.com/medusajs/medusa/issues/954) [#969](https://github.com/medusajs/medusa/issues/969) [#998](https://github.com/medusajs/medusa/issues/998) [#1017](https://github.com/medusajs/medusa/issues/1017) [#1110](https://github.com/medusajs/medusa/issues/1110)
|
|
51
|
+
* update customer groups ([#1075](https://github.com/medusajs/medusa/issues/1075)) ([75fb2ce](https://github.com/medusajs/medusa/commit/75fb2ce9c3a206a9d43cdbd80a356d9ba4d28f3f))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
6
57
|
## [1.1.64](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.63...@medusajs/medusa@1.1.64) (2022-02-06)
|
|
7
58
|
|
|
8
59
|
### Bug Fixes
|
package/dist/api/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export default _default;
|
|
|
3
3
|
export * from "./routes/admin/collections";
|
|
4
4
|
export * from "./routes/admin/auth";
|
|
5
5
|
export * from "./routes/admin/customers";
|
|
6
|
+
export * from "./routes/admin/customer-groups";
|
|
6
7
|
export * from "./routes/admin/discounts";
|
|
7
8
|
export * from "./routes/admin/draft-orders";
|
|
8
9
|
export * from "./routes/admin/gift-cards";
|
package/dist/api/index.js
CHANGED
|
@@ -29,6 +29,7 @@ exports.default = (function (container, config) {
|
|
|
29
29
|
__exportStar(require("./routes/admin/collections"), exports);
|
|
30
30
|
__exportStar(require("./routes/admin/auth"), exports);
|
|
31
31
|
__exportStar(require("./routes/admin/customers"), exports);
|
|
32
|
+
__exportStar(require("./routes/admin/customer-groups"), exports);
|
|
32
33
|
__exportStar(require("./routes/admin/discounts"), exports);
|
|
33
34
|
__exportStar(require("./routes/admin/draft-orders"), exports);
|
|
34
35
|
__exportStar(require("./routes/admin/gift-cards"), exports);
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAgC;AAChC,8EAAsD;AACtD,yDAAkC;AAClC,yDAAkC;AAElC,iCAAiC;AACjC,mBAAe,UAAC,SAAS,EAAE,MAAM;IAC/B,IAAM,GAAG,GAAG,IAAA,gBAAM,GAAE,CAAA;IAEpB,IAAA,eAAK,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;IAC7B,IAAA,eAAK,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;IAE7B,GAAG,CAAC,GAAG,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8DAA2C;AAC3C,4DAAyC;AACzC,yDAAsC;AACtC,uDAAoC;AACpC,+DAA4C;AAC5C,mEAAgD;AAChD,uDAAoC;AACpC,0DAAuC;AACvC,uDAAoC;AACpC,wDAAqC;AACrC,0DAAuC;AACvC,gEAA6C;AAC7C,uDAAoC;AACpC,yDAAsC;AACtC,yDAAsC;AACtC,2DAAwC;AACxC,kEAA+C;AAC/C,yDAAsC;AACtC,8DAA2C;AAC3C,+DAA4C;AAE5C,QAAQ;AACR,sDAAmC;AACnC,uDAAoC;AACpC,6DAA0C;AAC1C,2DAAwC;AACxC,4DAAyC;AACzC,wDAAqC;AACrC,0DAAuC;AACvC,yDAAsC;AACtC,gEAA6C;AAC7C,yDAAsC;AACtC,kEAA+C;AAC/C,uDAAoC;AACpC,0DAAuC"}
|
|
@@ -42,7 +42,13 @@ exports.default = (function () {
|
|
|
42
42
|
statusCode = 500;
|
|
43
43
|
errObj.code = API_ERROR;
|
|
44
44
|
break;
|
|
45
|
+
case medusa_core_utils_1.MedusaError.Types.UNEXPECTED_STATE:
|
|
46
|
+
case medusa_core_utils_1.MedusaError.Types.INVALID_ARGUMENT:
|
|
47
|
+
break;
|
|
45
48
|
default:
|
|
49
|
+
errObj.code = "unknown_error";
|
|
50
|
+
errObj.message = "An unknown error occurred.";
|
|
51
|
+
errObj.type = "unknown_error";
|
|
46
52
|
break;
|
|
47
53
|
}
|
|
48
54
|
res.status(statusCode).json(errObj);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/api/middlewares/error-handler.js"],"names":[],"mappings":";;AAAA,uDAA+C;AAE/C,IAAM,qBAAqB,GAAG,iCAAiC,CAAA;AAC/D,IAAM,mBAAmB,GAAG,gCAAgC,CAAA;AAC5D,IAAM,uBAAuB,GAAG,4BAA4B,CAAA;AAE5D,IAAM,SAAS,GAAG,WAAW,CAAA;AAC7B,IAAM,qBAAqB,GAAG,uBAAuB,CAAA;AACrD,IAA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ChB,MAAM,CAAC,IAAI,GAAG,qBAAqB,CAAA;gBACnC,MAAK;YACP,KAAK,+BAAW,CAAC,KAAK,CAAC,WAAW,CAAC;YACnC,KAAK,+BAAW,CAAC,KAAK,CAAC,YAAY;gBACjC,UAAU,GAAG,GAAG,CAAA;gBAChB,MAAK;YACP,KAAK,+BAAW,CAAC,KAAK,CAAC,SAAS;gBAC9B,UAAU,GAAG,GAAG,CAAA;gBAChB,MAAK;YACP,KAAK,+BAAW,CAAC,KAAK,CAAC,QAAQ;gBAC7B,UAAU,GAAG,GAAG,CAAA;gBAChB,MAAM,CAAC,IAAI,GAAG,SAAS,CAAA;gBACvB,MAAK;YACP,KAAK,+BAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACxC,KAAK,+BAAW,CAAC,KAAK,CAAC,gBAAgB;gBACrC,MAAK;YACP;gBACE,MAAM,CAAC,IAAI,GAAG,eAAe,CAAA;gBAC7B,MAAM,CAAC,OAAO,GAAG,4BAA4B,CAAA;gBAC7C,MAAM,CAAC,IAAI,GAAG,eAAe,CAAA;gBAC7B,MAAK;SACR;QAED,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC,CAAA;AACH,CAAC,EAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CustomerGroupsBatchCustomer } from "../../../../types/customer-groups";
|
|
2
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* @oas [post] /customer-groups/{id}/customers/batch
|
|
5
|
+
* operationId: "PostCustomerGroupsGroupCustomersBatch"
|
|
6
|
+
* summary: "Add a list of customers to a customer group "
|
|
7
|
+
* description: "Adds a list of customers, represented by id's, to a customer group."
|
|
8
|
+
* x-authenticated: true
|
|
9
|
+
* parameters:
|
|
10
|
+
* - (path) id=* {string} The id of the customer group.
|
|
11
|
+
* - (body) customers=* {{id: string }[]} ids of the customers to add
|
|
12
|
+
* tags:
|
|
13
|
+
* - CustomerGroup
|
|
14
|
+
* responses:
|
|
15
|
+
* 200:
|
|
16
|
+
* description: OK
|
|
17
|
+
* content:
|
|
18
|
+
* application/json:
|
|
19
|
+
* schema:
|
|
20
|
+
* properties:
|
|
21
|
+
* customerGroup:
|
|
22
|
+
* $ref: "#/components/schemas/customergroup"
|
|
23
|
+
*/
|
|
24
|
+
export default _default;
|
|
25
|
+
export declare class AdminPostCustomerGroupsGroupCustomersBatchReq {
|
|
26
|
+
customer_ids: CustomerGroupsBatchCustomer[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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.AdminPostCustomerGroupsGroupCustomersBatchReq = void 0;
|
|
49
|
+
var class_transformer_1 = require("class-transformer");
|
|
50
|
+
var class_validator_1 = require("class-validator");
|
|
51
|
+
var customer_groups_1 = require("../../../../types/customer-groups");
|
|
52
|
+
var validator_1 = require("../../../../utils/validator");
|
|
53
|
+
/**
|
|
54
|
+
* @oas [post] /customer-groups/{id}/customers/batch
|
|
55
|
+
* operationId: "PostCustomerGroupsGroupCustomersBatch"
|
|
56
|
+
* summary: "Add a list of customers to a customer group "
|
|
57
|
+
* description: "Adds a list of customers, represented by id's, to a customer group."
|
|
58
|
+
* x-authenticated: true
|
|
59
|
+
* parameters:
|
|
60
|
+
* - (path) id=* {string} The id of the customer group.
|
|
61
|
+
* - (body) customers=* {{id: string }[]} ids of the customers to add
|
|
62
|
+
* tags:
|
|
63
|
+
* - CustomerGroup
|
|
64
|
+
* responses:
|
|
65
|
+
* 200:
|
|
66
|
+
* description: OK
|
|
67
|
+
* content:
|
|
68
|
+
* application/json:
|
|
69
|
+
* schema:
|
|
70
|
+
* properties:
|
|
71
|
+
* customerGroup:
|
|
72
|
+
* $ref: "#/components/schemas/customergroup"
|
|
73
|
+
*/
|
|
74
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
+
var id, validated, customerGroupService, customer_group;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
id = req.params.id;
|
|
80
|
+
return [4 /*yield*/, (0, validator_1.validator)(AdminPostCustomerGroupsGroupCustomersBatchReq, req.body)];
|
|
81
|
+
case 1:
|
|
82
|
+
validated = _a.sent();
|
|
83
|
+
customerGroupService = req.scope.resolve("customerGroupService");
|
|
84
|
+
return [4 /*yield*/, customerGroupService.addCustomers(id, validated.customer_ids.map(function (_a) {
|
|
85
|
+
var id = _a.id;
|
|
86
|
+
return id;
|
|
87
|
+
}))];
|
|
88
|
+
case 2:
|
|
89
|
+
customer_group = _a.sent();
|
|
90
|
+
res.status(200).json({ customer_group: customer_group });
|
|
91
|
+
return [2 /*return*/];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); });
|
|
95
|
+
var AdminPostCustomerGroupsGroupCustomersBatchReq = /** @class */ (function () {
|
|
96
|
+
function AdminPostCustomerGroupsGroupCustomersBatchReq() {
|
|
97
|
+
}
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
100
|
+
(0, class_transformer_1.Type)(function () { return customer_groups_1.CustomerGroupsBatchCustomer; }),
|
|
101
|
+
__metadata("design:type", Array)
|
|
102
|
+
], AdminPostCustomerGroupsGroupCustomersBatchReq.prototype, "customer_ids", void 0);
|
|
103
|
+
return AdminPostCustomerGroupsGroupCustomersBatchReq;
|
|
104
|
+
}());
|
|
105
|
+
exports.AdminPostCustomerGroupsGroupCustomersBatchReq = AdminPostCustomerGroupsGroupCustomersBatchReq;
|
|
106
|
+
//# sourceMappingURL=add-customers-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-customers-batch.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/customer-groups/add-customers-batch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,mDAAgD;AAEhD,qEAA+E;AAC/E,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBACP,qBAAM,IAAA,qBAAS,EAC/B,6CAA6C,EAC7C,GAAG,CAAC,IAAI,CACT,EAAA;;gBAHK,SAAS,GAAG,SAGjB;gBAEK,oBAAoB,GAAyB,GAAG,CAAC,KAAK,CAAC,OAAO,CAClE,sBAAsB,CACvB,CAAA;gBAEsB,qBAAM,oBAAoB,CAAC,YAAY,CAC5D,EAAE,EACF,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,UAAC,EAAM;4BAAJ,EAAE,QAAA;wBAAO,OAAA,EAAE;oBAAF,CAAE,CAAC,CAC3C,EAAA;;gBAHK,cAAc,GAAG,SAGtB;gBACD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,cAAc,gBAAA,EAAE,CAAC,CAAA;;;;KACzC,EAAA;AAED;IAAA;IAIA,CAAC;IADC;QAFC,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC9B,IAAA,wBAAI,EAAC,cAAM,OAAA,6CAA2B,EAA3B,CAA2B,CAAC;;uFACG;IAC7C,oDAAC;CAAA,AAJD,IAIC;AAJY,sGAA6C"}
|
|
@@ -17,8 +17,8 @@ declare const _default: (req: any, res: any) => Promise<void>;
|
|
|
17
17
|
* application/json:
|
|
18
18
|
* schema:
|
|
19
19
|
* properties:
|
|
20
|
-
*
|
|
21
|
-
* $ref: "#/components/schemas/
|
|
20
|
+
* customer_group:
|
|
21
|
+
* $ref: "#/components/schemas/customer_group"
|
|
22
22
|
*/
|
|
23
23
|
export default _default;
|
|
24
24
|
export declare class AdminPostCustomerGroupsReq {
|
|
@@ -66,8 +66,8 @@ var validator_1 = require("../../../../utils/validator");
|
|
|
66
66
|
* application/json:
|
|
67
67
|
* schema:
|
|
68
68
|
* properties:
|
|
69
|
-
*
|
|
70
|
-
* $ref: "#/components/schemas/
|
|
69
|
+
* customer_group:
|
|
70
|
+
* $ref: "#/components/schemas/customer_group"
|
|
71
71
|
*/
|
|
72
72
|
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
73
|
var validated, customerGroupService, customerGroup;
|
|
@@ -80,7 +80,7 @@ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0
|
|
|
80
80
|
return [4 /*yield*/, customerGroupService.create(validated)];
|
|
81
81
|
case 2:
|
|
82
82
|
customerGroup = _a.sent();
|
|
83
|
-
res.status(200).json({
|
|
83
|
+
res.status(200).json({ customer_group: customerGroup });
|
|
84
84
|
return [2 /*return*/];
|
|
85
85
|
}
|
|
86
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-customer-group.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/customer-groups/create-customer-group.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAgE;AAEhE,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACV,qBAAM,IAAA,qBAAS,EAAC,0BAA0B,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAAjE,SAAS,GAAG,SAAqD;gBAEjE,oBAAoB,GAAyB,GAAG,CAAC,KAAK,CAAC,OAAO,CAClE,sBAAsB,CACvB,CAAA;gBAEqB,qBAAM,oBAAoB,CAAC,MAAM,CAAC,SAAS,CAAC,EAAA;;gBAA5D,aAAa,GAAG,SAA4C;gBAClE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"create-customer-group.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/customer-groups/create-customer-group.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAgE;AAEhE,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACV,qBAAM,IAAA,qBAAS,EAAC,0BAA0B,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAAjE,SAAS,GAAG,SAAqD;gBAEjE,oBAAoB,GAAyB,GAAG,CAAC,KAAK,CAAC,OAAO,CAClE,sBAAsB,CACvB,CAAA;gBAEqB,qBAAM,oBAAoB,CAAC,MAAM,CAAC,SAAS,CAAC,EAAA;;gBAA5D,aAAa,GAAG,SAA4C;gBAClE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC,CAAA;;;;KACxD,EAAA;AAED;IAAA;IAOA,CAAC;IALC;QADC,IAAA,0BAAQ,GAAE;;4DACC;IAIZ;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;gEACI;IACnB,iCAAC;CAAA,AAPD,IAOC;AAPY,gEAA0B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
2
|
+
/**
|
|
3
|
+
* @oas [delete] /customer-groups/{id}
|
|
4
|
+
* operationId: "DeleteCustomerGroupsCustomerGroup"
|
|
5
|
+
* summary: "Delete a CustomerGroup"
|
|
6
|
+
* description: "Deletes a CustomerGroup."
|
|
7
|
+
* x-authenticated: true
|
|
8
|
+
* parameters:
|
|
9
|
+
* - (path) id=* {string} The id of the Customer Group
|
|
10
|
+
* tags:
|
|
11
|
+
* - CustomerGroup
|
|
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 customer group.
|
|
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] /customer-groups/{id}
|
|
41
|
+
* operationId: "DeleteCustomerGroupsCustomerGroup"
|
|
42
|
+
* summary: "Delete a CustomerGroup"
|
|
43
|
+
* description: "Deletes a CustomerGroup."
|
|
44
|
+
* x-authenticated: true
|
|
45
|
+
* parameters:
|
|
46
|
+
* - (path) id=* {string} The id of the Customer Group
|
|
47
|
+
* tags:
|
|
48
|
+
* - CustomerGroup
|
|
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 customer group.
|
|
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, customerGroupService;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
id = req.params.id;
|
|
71
|
+
customerGroupService = req.scope.resolve("customerGroupService");
|
|
72
|
+
return [4 /*yield*/, customerGroupService.delete(id)];
|
|
73
|
+
case 1:
|
|
74
|
+
_a.sent();
|
|
75
|
+
res.json({
|
|
76
|
+
id: id,
|
|
77
|
+
object: "customer_group",
|
|
78
|
+
deleted: true,
|
|
79
|
+
});
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}); });
|
|
84
|
+
//# sourceMappingURL=delete-customer-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-customer-group.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/customer-groups/delete-customer-group.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBAEnB,oBAAoB,GAAyB,GAAG,CAAC,KAAK,CAAC,OAAO,CAClE,sBAAsB,CACvB,CAAA;gBAED,qBAAM,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAA;;gBAArC,SAAqC,CAAA;gBAErC,GAAG,CAAC,IAAI,CAAC;oBACP,EAAE,EAAE,EAAE;oBACN,MAAM,EAAE,gBAAgB;oBACxB,OAAO,EAAE,IAAI;iBACd,CAAC,CAAA;;;;KACH,EAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CustomerGroupsBatchCustomer } from "../../../../types/customer-groups";
|
|
2
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* @oas [delete] /customer-groups/{id}/customers/batch
|
|
5
|
+
* operationId: "DeleteCustomerGroupsGroupCustomerBatch"
|
|
6
|
+
* summary: "Remove a list of customers from a customer group "
|
|
7
|
+
* description: "Removes a list of customers, represented by id's, from a customer group."
|
|
8
|
+
* x-authenticated: true
|
|
9
|
+
* parameters:
|
|
10
|
+
* - (path) id=* {string} The id of the customer group.
|
|
11
|
+
* - (body) customers=* {{id: string }[]} ids of the customers to remove
|
|
12
|
+
* tags:
|
|
13
|
+
* - CustomerGroup
|
|
14
|
+
* responses:
|
|
15
|
+
* 200:
|
|
16
|
+
* description: OK
|
|
17
|
+
* content:
|
|
18
|
+
* application/json:
|
|
19
|
+
* schema:
|
|
20
|
+
* properties:
|
|
21
|
+
* customerGroup:
|
|
22
|
+
* $ref: "#/components/schemas/customergroup"
|
|
23
|
+
*/
|
|
24
|
+
export default _default;
|
|
25
|
+
export declare class AdminDeleteCustomerGroupsGroupCustomerBatchReq {
|
|
26
|
+
customer_ids: CustomerGroupsBatchCustomer[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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.AdminDeleteCustomerGroupsGroupCustomerBatchReq = void 0;
|
|
49
|
+
var class_transformer_1 = require("class-transformer");
|
|
50
|
+
var class_validator_1 = require("class-validator");
|
|
51
|
+
var customer_groups_1 = require("../../../../types/customer-groups");
|
|
52
|
+
var validator_1 = require("../../../../utils/validator");
|
|
53
|
+
/**
|
|
54
|
+
* @oas [delete] /customer-groups/{id}/customers/batch
|
|
55
|
+
* operationId: "DeleteCustomerGroupsGroupCustomerBatch"
|
|
56
|
+
* summary: "Remove a list of customers from a customer group "
|
|
57
|
+
* description: "Removes a list of customers, represented by id's, from a customer group."
|
|
58
|
+
* x-authenticated: true
|
|
59
|
+
* parameters:
|
|
60
|
+
* - (path) id=* {string} The id of the customer group.
|
|
61
|
+
* - (body) customers=* {{id: string }[]} ids of the customers to remove
|
|
62
|
+
* tags:
|
|
63
|
+
* - CustomerGroup
|
|
64
|
+
* responses:
|
|
65
|
+
* 200:
|
|
66
|
+
* description: OK
|
|
67
|
+
* content:
|
|
68
|
+
* application/json:
|
|
69
|
+
* schema:
|
|
70
|
+
* properties:
|
|
71
|
+
* customerGroup:
|
|
72
|
+
* $ref: "#/components/schemas/customergroup"
|
|
73
|
+
*/
|
|
74
|
+
exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
+
var id, validated, customerGroupService, customer_group;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
id = req.params.id;
|
|
80
|
+
return [4 /*yield*/, (0, validator_1.validator)(AdminDeleteCustomerGroupsGroupCustomerBatchReq, req.body)];
|
|
81
|
+
case 1:
|
|
82
|
+
validated = _a.sent();
|
|
83
|
+
customerGroupService = req.scope.resolve("customerGroupService");
|
|
84
|
+
return [4 /*yield*/, customerGroupService.removeCustomer(id, validated.customer_ids.map(function (_a) {
|
|
85
|
+
var id = _a.id;
|
|
86
|
+
return id;
|
|
87
|
+
}))];
|
|
88
|
+
case 2:
|
|
89
|
+
customer_group = _a.sent();
|
|
90
|
+
res.status(200).json({ customer_group: customer_group });
|
|
91
|
+
return [2 /*return*/];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); });
|
|
95
|
+
var AdminDeleteCustomerGroupsGroupCustomerBatchReq = /** @class */ (function () {
|
|
96
|
+
function AdminDeleteCustomerGroupsGroupCustomerBatchReq() {
|
|
97
|
+
}
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
100
|
+
(0, class_transformer_1.Type)(function () { return customer_groups_1.CustomerGroupsBatchCustomer; }),
|
|
101
|
+
__metadata("design:type", Array)
|
|
102
|
+
], AdminDeleteCustomerGroupsGroupCustomerBatchReq.prototype, "customer_ids", void 0);
|
|
103
|
+
return AdminDeleteCustomerGroupsGroupCustomerBatchReq;
|
|
104
|
+
}());
|
|
105
|
+
exports.AdminDeleteCustomerGroupsGroupCustomerBatchReq = AdminDeleteCustomerGroupsGroupCustomerBatchReq;
|
|
106
|
+
//# sourceMappingURL=delete-customers-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-customers-batch.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/customer-groups/delete-customers-batch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,mDAAgD;AAEhD,qEAA+E;AAC/E,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBACP,qBAAM,IAAA,qBAAS,EAC/B,8CAA8C,EAC9C,GAAG,CAAC,IAAI,CACT,EAAA;;gBAHK,SAAS,GAAG,SAGjB;gBAEK,oBAAoB,GAAyB,GAAG,CAAC,KAAK,CAAC,OAAO,CAClE,sBAAsB,CACvB,CAAA;gBAEsB,qBAAM,oBAAoB,CAAC,cAAc,CAC9D,EAAE,EACF,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,UAAC,EAAM;4BAAJ,EAAE,QAAA;wBAAO,OAAA,EAAE;oBAAF,CAAE,CAAC,CAC3C,EAAA;;gBAHK,cAAc,GAAG,SAGtB;gBACD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,cAAc,gBAAA,EAAE,CAAC,CAAA;;;;KACzC,EAAA;AAED;IAAA;IAIA,CAAC;IADC;QAFC,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC9B,IAAA,wBAAI,EAAC,cAAM,OAAA,6CAA2B,EAA3B,CAA2B,CAAC;;wFACG;IAC7C,qDAAC;CAAA,AAJD,IAIC;AAJY,wGAA8C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FindParams } from "../../../../types/common";
|
|
2
|
+
declare const _default: (req: any, res: any) => Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* @oas [get] /customer-groups/{id}
|
|
5
|
+
* operationId: "GetCustomerGroupsGroup"
|
|
6
|
+
* summary: "Retrieve a CustomerGroup"
|
|
7
|
+
* description: "Retrieves a Customer Group."
|
|
8
|
+
* x-authenticated: true
|
|
9
|
+
* parameters:
|
|
10
|
+
* - (path) id=* {string} The id of the Customer Group.
|
|
11
|
+
* tags:
|
|
12
|
+
* - CustomerGroup
|
|
13
|
+
* responses:
|
|
14
|
+
* 200:
|
|
15
|
+
* description: OK
|
|
16
|
+
* content:
|
|
17
|
+
* application/json:
|
|
18
|
+
* schema:
|
|
19
|
+
* properties:
|
|
20
|
+
* customer_group:
|
|
21
|
+
* $ref: "#/components/schemas/customer_group"
|
|
22
|
+
*/
|
|
23
|
+
export default _default;
|
|
24
|
+
export declare class AdminGetCustomerGroupsGroupParams extends FindParams {
|
|
25
|
+
}
|