@purpleschool/gptbot 0.8.85 → 0.8.86
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/api/controllers/http/user.ts +1 -0
- package/api/routes.ts +2 -0
- package/build/api/controllers/http/user.js +1 -0
- package/build/api/routes.js +1 -0
- package/build/commands/user/cancel-user-product.command.js +21 -0
- package/build/commands/user/index.js +1 -0
- package/build/constants/errors/errors.js +10 -0
- package/commands/user/cancel-user-product.command.ts +21 -0
- package/commands/user/index.ts +1 -0
- package/constants/errors/errors.ts +10 -0
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export const USER_ROUTES = {
|
|
|
11
11
|
GET_SUBSCRIPTIONS: (uuid: string) => `subscriptions/${uuid}`,
|
|
12
12
|
CANCEL_SUBSCRIPTION: (uuid: string) => `subscriptions/${uuid}/cancel`,
|
|
13
13
|
GET_PRODUCTS: (uuid: string) => `products/${uuid}`,
|
|
14
|
+
CANCEL_PRODUCT: (uuid: string) => `products/${uuid}/cancel`,
|
|
14
15
|
GET_PAYMENTS: (uuid: string) => `payments/${uuid}`,
|
|
15
16
|
GET_COUNT_NOTIFICATION: 'broadcast/count',
|
|
16
17
|
SEND_NOTIFICATION: 'broadcast',
|
package/api/routes.ts
CHANGED
|
@@ -33,6 +33,8 @@ export const REST_API = {
|
|
|
33
33
|
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CANCEL_SUBSCRIPTION(uuid)}`,
|
|
34
34
|
GET_PRODUCTS: (uuid: string) =>
|
|
35
35
|
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
|
|
36
|
+
CANCEL_PRODUCT: (uuid: string) =>
|
|
37
|
+
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CANCEL_PRODUCT(uuid)}`,
|
|
36
38
|
GET_COUNT_NOTIFICATION: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_COUNT_NOTIFICATION}`,
|
|
37
39
|
SEND_NOTIFICATION: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
|
|
38
40
|
DELETE_ACCOUNT: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
|
|
@@ -13,6 +13,7 @@ exports.USER_ROUTES = {
|
|
|
13
13
|
GET_SUBSCRIPTIONS: (uuid) => `subscriptions/${uuid}`,
|
|
14
14
|
CANCEL_SUBSCRIPTION: (uuid) => `subscriptions/${uuid}/cancel`,
|
|
15
15
|
GET_PRODUCTS: (uuid) => `products/${uuid}`,
|
|
16
|
+
CANCEL_PRODUCT: (uuid) => `products/${uuid}/cancel`,
|
|
16
17
|
GET_PAYMENTS: (uuid) => `payments/${uuid}`,
|
|
17
18
|
GET_COUNT_NOTIFICATION: 'broadcast/count',
|
|
18
19
|
SEND_NOTIFICATION: 'broadcast',
|
package/build/api/routes.js
CHANGED
|
@@ -61,6 +61,7 @@ exports.REST_API = {
|
|
|
61
61
|
GET_SUBSCRIPTIONS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_SUBSCRIPTIONS(uuid)}`,
|
|
62
62
|
CANCEL_SUBSCRIPTION: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CANCEL_SUBSCRIPTION(uuid)}`,
|
|
63
63
|
GET_PRODUCTS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
|
|
64
|
+
CANCEL_PRODUCT: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CANCEL_PRODUCT(uuid)}`,
|
|
64
65
|
GET_COUNT_NOTIFICATION: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_COUNT_NOTIFICATION}`,
|
|
65
66
|
SEND_NOTIFICATION: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
|
|
66
67
|
DELETE_ACCOUNT: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.DELETE_ACCOUNT}`,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CancelUserProductCommand = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
var CancelUserProductCommand;
|
|
9
|
+
(function (CancelUserProductCommand) {
|
|
10
|
+
CancelUserProductCommand.RequestParamSchema = zod_1.default.object({
|
|
11
|
+
uuid: zod_1.default.string().uuid(),
|
|
12
|
+
});
|
|
13
|
+
CancelUserProductCommand.RequestSchema = zod_1.default.object({
|
|
14
|
+
userToProductId: zod_1.default.string().uuid(),
|
|
15
|
+
});
|
|
16
|
+
CancelUserProductCommand.ResponseSchema = zod_1.default.object({
|
|
17
|
+
data: zod_1.default.object({
|
|
18
|
+
isCancelled: zod_1.default.boolean(),
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
})(CancelUserProductCommand || (exports.CancelUserProductCommand = CancelUserProductCommand = {}));
|
|
@@ -27,3 +27,4 @@ __exportStar(require("./delete-account.command"), exports);
|
|
|
27
27
|
__exportStar(require("./get-aggregated-user-data.command"), exports);
|
|
28
28
|
__exportStar(require("./get-user-payments.command"), exports);
|
|
29
29
|
__exportStar(require("./cancel-user-subscription.command"), exports);
|
|
30
|
+
__exportStar(require("./cancel-user-product.command"), exports);
|
|
@@ -2672,4 +2672,14 @@ exports.ERRORS = {
|
|
|
2672
2672
|
message: 'Для получения награды опубликуйте работу в сообществе',
|
|
2673
2673
|
httpCode: 400,
|
|
2674
2674
|
},
|
|
2675
|
+
PRODUCT_OWNERSHIP_ERROR: {
|
|
2676
|
+
code: 'A565',
|
|
2677
|
+
message: 'Пользователь не является владельцем продукта',
|
|
2678
|
+
httpCode: 400,
|
|
2679
|
+
},
|
|
2680
|
+
PRODUCT_CANCEL_ERROR: {
|
|
2681
|
+
code: 'A566',
|
|
2682
|
+
message: 'Нельзя отменить пакет, которым юзер начал пользоваться',
|
|
2683
|
+
httpCode: 400,
|
|
2684
|
+
},
|
|
2675
2685
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace CancelUserProductCommand {
|
|
4
|
+
export const RequestParamSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const RequestSchema = z.object({
|
|
11
|
+
userToProductId: z.string().uuid(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.object({
|
|
16
|
+
isCancelled: z.boolean(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
package/commands/user/index.ts
CHANGED
|
@@ -2680,4 +2680,14 @@ export const ERRORS = {
|
|
|
2680
2680
|
message: 'Для получения награды опубликуйте работу в сообществе',
|
|
2681
2681
|
httpCode: 400,
|
|
2682
2682
|
},
|
|
2683
|
+
PRODUCT_OWNERSHIP_ERROR: {
|
|
2684
|
+
code: 'A565',
|
|
2685
|
+
message: 'Пользователь не является владельцем продукта',
|
|
2686
|
+
httpCode: 400,
|
|
2687
|
+
},
|
|
2688
|
+
PRODUCT_CANCEL_ERROR: {
|
|
2689
|
+
code: 'A566',
|
|
2690
|
+
message: 'Нельзя отменить пакет, которым юзер начал пользоваться',
|
|
2691
|
+
httpCode: 400,
|
|
2692
|
+
},
|
|
2683
2693
|
};
|