@purpleschool/gptbot 0.6.4 → 0.6.11
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 +6 -0
- package/api/routes.ts +11 -0
- package/build/api/controllers/http/user.js +6 -0
- package/build/api/routes.js +6 -0
- package/build/commands/folder/delete-folder.command.js +2 -2
- package/build/commands/payment/index.js +1 -0
- package/build/commands/payment/recurrent.command.js +47 -0
- package/build/commands/subscription/dismiss-subscription-renewal.command.js +12 -0
- package/build/commands/subscription/get-subscriptions-summary.command.js +1 -0
- package/build/commands/user/find-user-by-uuid.command.js +21 -0
- package/build/commands/user/find-users-by-criteria.command.js +32 -0
- package/build/commands/user/get-user-balance.command.js +15 -0
- package/build/commands/user/get-user-orders.command.js +27 -0
- package/build/commands/user/get-user-products.command.js +25 -0
- package/build/commands/user/get-user-subscriptions.command.js +25 -0
- package/build/commands/user/index.js +6 -1
- package/build/constants/errors/errors.js +12 -2
- package/build/constants/order/enums/order-sort-by.enum.js +11 -0
- package/build/constants/product/enums/index.js +1 -0
- package/build/constants/product/enums/product-sort-by.enum.js +9 -0
- package/build/constants/subscription/enums/index.js +1 -0
- package/build/constants/subscription/enums/subscription-sort-by.enum.js +9 -0
- package/build/constants/subscription/enums/subscription-status.enum.js +2 -0
- package/build/constants/ui-notification/enums/ui-notification-type.enum.js +1 -0
- package/build/constants/user/enums/index.js +2 -0
- package/build/constants/user/enums/sort-order.enum.js +8 -0
- package/build/constants/user/enums/user-sort-by.enum.js +9 -0
- package/build/models/order.schema.js +3 -1
- package/commands/folder/delete-folder.command.ts +1 -1
- package/commands/payment/index.ts +1 -0
- package/commands/payment/recurrent.command.ts +48 -0
- package/commands/subscription/dismiss-subscription-renewal.command.ts +13 -0
- package/commands/subscription/get-subscriptions-summary.command.ts +1 -0
- package/commands/user/find-user-by-uuid.command.ts +23 -0
- package/commands/user/find-users-by-criteria.command.ts +34 -0
- package/commands/user/{find-user.command.ts → get-user-balance.command.ts} +4 -3
- package/commands/user/get-user-orders.command.ts +28 -0
- package/commands/user/get-user-products.command.ts +26 -0
- package/commands/user/get-user-subscriptions.command.ts +26 -0
- package/commands/user/index.ts +6 -1
- package/constants/errors/errors.ts +12 -2
- package/constants/order/enums/order-sort-by.enum.ts +7 -0
- package/constants/product/enums/index.ts +1 -0
- package/constants/product/enums/product-sort-by.enum.ts +5 -0
- package/constants/subscription/enums/index.ts +1 -0
- package/constants/subscription/enums/subscription-sort-by.enum.ts +5 -0
- package/constants/subscription/enums/subscription-status.enum.ts +2 -0
- package/constants/ui-notification/enums/ui-notification-type.enum.ts +1 -0
- package/constants/user/enums/index.ts +2 -0
- package/constants/user/enums/sort-order.enum.ts +4 -0
- package/constants/user/enums/user-sort-by.enum.ts +5 -0
- package/models/order.schema.ts +3 -1
- package/package.json +1 -1
- package/build/commands/user/find-user.command.js +0 -14
|
@@ -4,4 +4,10 @@ export const USER_ROUTES = {
|
|
|
4
4
|
GET: 'me',
|
|
5
5
|
POST: 'up-balance',
|
|
6
6
|
CHECK_EMAIL: 'check-email',
|
|
7
|
+
FIND_BY_CRITERIA: 'criteria',
|
|
8
|
+
FIND_BY_UUID: (uuid: string) => `${uuid}`,
|
|
9
|
+
GET_BALANCE: (uuid: string) => `balance/${uuid}`,
|
|
10
|
+
GET_ORDERS: (uuid: string) => `orders/${uuid}`,
|
|
11
|
+
GET_SUBSCRIPTIONS: (uuid: string) => `subscriptions/${uuid}`,
|
|
12
|
+
GET_PRODUCTS: (uuid: string) => `products/${uuid}`,
|
|
7
13
|
} as const;
|
package/api/routes.ts
CHANGED
|
@@ -16,6 +16,17 @@ export const REST_API = {
|
|
|
16
16
|
GET: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET}`,
|
|
17
17
|
POST: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.POST}`,
|
|
18
18
|
CHECK_EMAIL: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CHECK_EMAIL}`,
|
|
19
|
+
FIND_BY_CRITERIA: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.FIND_BY_CRITERIA}`,
|
|
20
|
+
FIND_BY_UUID: (uuid: string) =>
|
|
21
|
+
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.FIND_BY_UUID(uuid)}`,
|
|
22
|
+
GET_BALANCE: (uuid: string) =>
|
|
23
|
+
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_BALANCE(uuid)}`,
|
|
24
|
+
GET_ORDERS: (uuid: string) =>
|
|
25
|
+
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_ORDERS(uuid)}`,
|
|
26
|
+
GET_SUBSCRIPTIONS: (uuid: string) =>
|
|
27
|
+
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_SUBSCRIPTIONS(uuid)}`,
|
|
28
|
+
GET_PRODUCTS: (uuid: string) =>
|
|
29
|
+
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
|
|
19
30
|
},
|
|
20
31
|
PAGE: {
|
|
21
32
|
GET: `${ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${CONTROLLERS.PAGE_ROUTES.GET_ALL}`,
|
|
@@ -6,4 +6,10 @@ exports.USER_ROUTES = {
|
|
|
6
6
|
GET: 'me',
|
|
7
7
|
POST: 'up-balance',
|
|
8
8
|
CHECK_EMAIL: 'check-email',
|
|
9
|
+
FIND_BY_CRITERIA: 'criteria',
|
|
10
|
+
FIND_BY_UUID: (uuid) => `${uuid}`,
|
|
11
|
+
GET_BALANCE: (uuid) => `balance/${uuid}`,
|
|
12
|
+
GET_ORDERS: (uuid) => `orders/${uuid}`,
|
|
13
|
+
GET_SUBSCRIPTIONS: (uuid) => `subscriptions/${uuid}`,
|
|
14
|
+
GET_PRODUCTS: (uuid) => `products/${uuid}`,
|
|
9
15
|
};
|
package/build/api/routes.js
CHANGED
|
@@ -50,6 +50,12 @@ exports.REST_API = {
|
|
|
50
50
|
GET: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET}`,
|
|
51
51
|
POST: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.POST}`,
|
|
52
52
|
CHECK_EMAIL: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.CHECK_EMAIL}`,
|
|
53
|
+
FIND_BY_CRITERIA: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.FIND_BY_CRITERIA}`,
|
|
54
|
+
FIND_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.FIND_BY_UUID(uuid)}`,
|
|
55
|
+
GET_BALANCE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_BALANCE(uuid)}`,
|
|
56
|
+
GET_ORDERS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_ORDERS(uuid)}`,
|
|
57
|
+
GET_SUBSCRIPTIONS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_SUBSCRIPTIONS(uuid)}`,
|
|
58
|
+
GET_PRODUCTS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
|
|
53
59
|
},
|
|
54
60
|
PAGE: {
|
|
55
61
|
GET: `${exports.ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${CONTROLLERS.PAGE_ROUTES.GET_ALL}`,
|
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DeleteFolderCommand = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
|
-
const
|
|
8
|
+
const models_1 = require("../../models");
|
|
9
9
|
var DeleteFolderCommand;
|
|
10
10
|
(function (DeleteFolderCommand) {
|
|
11
|
-
DeleteFolderCommand.RequestSchema =
|
|
11
|
+
DeleteFolderCommand.RequestSchema = models_1.FolderSchema.pick({
|
|
12
12
|
uuid: true,
|
|
13
13
|
});
|
|
14
14
|
DeleteFolderCommand.ResponseSchema = zod_1.default.object({
|
|
@@ -18,3 +18,4 @@ __exportStar(require("./check.command"), exports);
|
|
|
18
18
|
__exportStar(require("./get-payment-history.command"), exports);
|
|
19
19
|
__exportStar(require("./pay.command"), exports);
|
|
20
20
|
__exportStar(require("./receipt.command"), exports);
|
|
21
|
+
__exportStar(require("./recurrent.command"), exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecurrentNotificationCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var RecurrentNotificationCommand;
|
|
6
|
+
(function (RecurrentNotificationCommand) {
|
|
7
|
+
RecurrentNotificationCommand.RequestSchema = zod_1.z
|
|
8
|
+
.object({
|
|
9
|
+
Id: zod_1.z.string(),
|
|
10
|
+
AccountId: zod_1.z.string(),
|
|
11
|
+
Description: zod_1.z.string(),
|
|
12
|
+
Email: zod_1.z.string(),
|
|
13
|
+
Amount: zod_1.z.number(),
|
|
14
|
+
Currency: zod_1.z.string(), // "RUB", "USD", "EUR", "GBP"
|
|
15
|
+
RequireConfirmation: zod_1.z.boolean(),
|
|
16
|
+
StartDate: zod_1.z.string(), // ISO‐8601 datetime in UTC, e.g. "2025-07-21T14:30:00Z"
|
|
17
|
+
Interval: zod_1.z.string(), // "Week", "Month", "Year"
|
|
18
|
+
Period: zod_1.z.number(),
|
|
19
|
+
Status: zod_1.z.string(),
|
|
20
|
+
SuccessfulTransactionsNumber: zod_1.z.number(),
|
|
21
|
+
FailedTransactionsNumber: zod_1.z.number(),
|
|
22
|
+
MaxPeriods: zod_1.z.number().optional(),
|
|
23
|
+
LastTransactionDate: zod_1.z.string().optional(), // "yyyy-MM-dd HH:mm:ss"
|
|
24
|
+
NextTransactionDate: zod_1.z.string().optional(), // "yyyy-MM-dd HH:mm:ss"
|
|
25
|
+
})
|
|
26
|
+
.transform((data) => ({
|
|
27
|
+
id: data.Id,
|
|
28
|
+
accountId: data.AccountId,
|
|
29
|
+
description: data.Description,
|
|
30
|
+
email: data.Email,
|
|
31
|
+
amount: data.Amount,
|
|
32
|
+
currency: data.Currency,
|
|
33
|
+
requireConfirmation: data.RequireConfirmation,
|
|
34
|
+
startDate: data.StartDate,
|
|
35
|
+
interval: data.Interval,
|
|
36
|
+
period: data.Period,
|
|
37
|
+
status: data.Status,
|
|
38
|
+
successfulTransactionsNumber: data.SuccessfulTransactionsNumber,
|
|
39
|
+
failedTransactionsNumber: data.FailedTransactionsNumber,
|
|
40
|
+
maxPeriods: data.MaxPeriods,
|
|
41
|
+
lastTransactionDate: data.LastTransactionDate,
|
|
42
|
+
nextTransactionDate: data.NextTransactionDate,
|
|
43
|
+
}));
|
|
44
|
+
RecurrentNotificationCommand.ResponseSchema = zod_1.z.object({
|
|
45
|
+
code: zod_1.z.number(),
|
|
46
|
+
});
|
|
47
|
+
})(RecurrentNotificationCommand || (exports.RecurrentNotificationCommand = RecurrentNotificationCommand = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DismissSubscriptionRenewalCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var DismissSubscriptionRenewalCommand;
|
|
7
|
+
(function (DismissSubscriptionRenewalCommand) {
|
|
8
|
+
DismissSubscriptionRenewalCommand.RequestParamSchema = zod_1.z.object({
|
|
9
|
+
uuidSiteUserToSubscription: zod_1.z.string(),
|
|
10
|
+
});
|
|
11
|
+
DismissSubscriptionRenewalCommand.ResponseSchema = models_1.UserToSubscriptionSchema;
|
|
12
|
+
})(DismissSubscriptionRenewalCommand || (exports.DismissSubscriptionRenewalCommand = DismissSubscriptionRenewalCommand = {}));
|
|
@@ -9,5 +9,6 @@ var GetSubscriptionsSummaryCommand;
|
|
|
9
9
|
features: zod_1.z.array(models_1.SubscriptionFeatureSchema),
|
|
10
10
|
subscriptions: zod_1.z.array(models_1.UserToSubscriptionWithSubscriptionSchema),
|
|
11
11
|
products: zod_1.z.array(models_1.UserToProductWithProductSchema),
|
|
12
|
+
latest: models_1.UserToSubscriptionWithSubscriptionSchema.nullable(),
|
|
12
13
|
});
|
|
13
14
|
})(GetSubscriptionsSummaryCommand || (exports.GetSubscriptionsSummaryCommand = GetSubscriptionsSummaryCommand = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindUserByUuidCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var FindUserByUuidCommand;
|
|
7
|
+
(function (FindUserByUuidCommand) {
|
|
8
|
+
FindUserByUuidCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
});
|
|
11
|
+
FindUserByUuidCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: models_1.UserSchema.omit({
|
|
13
|
+
verifyTokenHash: true,
|
|
14
|
+
password: true,
|
|
15
|
+
passwordHash: true,
|
|
16
|
+
restoreTokenHash: true,
|
|
17
|
+
}).extend({
|
|
18
|
+
telegramId: zod_1.z.number().nullable(),
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
})(FindUserByUuidCommand || (exports.FindUserByUuidCommand = FindUserByUuidCommand = {}));
|
|
@@ -0,0 +1,32 @@
|
|
|
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.FindUsersByCriteriaCommand = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const models_1 = require("../../models");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
10
|
+
var FindUsersByCriteriaCommand;
|
|
11
|
+
(function (FindUsersByCriteriaCommand) {
|
|
12
|
+
FindUsersByCriteriaCommand.RequestSchema = zod_1.default
|
|
13
|
+
.object({
|
|
14
|
+
uuid: zod_1.default.string().uuid().optional(),
|
|
15
|
+
email: zod_1.default.string().email().optional(),
|
|
16
|
+
status: zod_1.default.nativeEnum(constants_1.USER_STATUS).optional(),
|
|
17
|
+
role: zod_1.default.nativeEnum(constants_1.ROLE).optional(),
|
|
18
|
+
createdAt: zod_1.default.date().optional(),
|
|
19
|
+
updatedAt: zod_1.default.date().optional(),
|
|
20
|
+
sortBy: zod_1.default.nativeEnum(constants_1.USER_SORT_BY).optional(),
|
|
21
|
+
sortOrder: zod_1.default.nativeEnum(constants_1.SORT_ORDER).default(constants_1.SORT_ORDER.DESC).optional(),
|
|
22
|
+
})
|
|
23
|
+
.partial();
|
|
24
|
+
FindUsersByCriteriaCommand.ResponseSchema = zod_1.default.object({
|
|
25
|
+
data: zod_1.default.array(models_1.UserSchema.omit({
|
|
26
|
+
verifyTokenHash: true,
|
|
27
|
+
password: true,
|
|
28
|
+
passwordHash: true,
|
|
29
|
+
restoreTokenHash: true,
|
|
30
|
+
})),
|
|
31
|
+
});
|
|
32
|
+
})(FindUsersByCriteriaCommand || (exports.FindUsersByCriteriaCommand = FindUsersByCriteriaCommand = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUserBalanceCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var GetUserBalanceCommand;
|
|
6
|
+
(function (GetUserBalanceCommand) {
|
|
7
|
+
GetUserBalanceCommand.RequestSchema = zod_1.z.object({
|
|
8
|
+
uuid: zod_1.z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
GetUserBalanceCommand.ResponseSchema = zod_1.z.object({
|
|
11
|
+
data: zod_1.z.object({
|
|
12
|
+
totalTokenBalance: zod_1.z.number(),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
})(GetUserBalanceCommand || (exports.GetUserBalanceCommand = GetUserBalanceCommand = {}));
|
|
@@ -0,0 +1,27 @@
|
|
|
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.GetUserOrdersCommand = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const models_1 = require("../../models");
|
|
10
|
+
const order_sort_by_enum_1 = require("../../constants/order/enums/order-sort-by.enum");
|
|
11
|
+
var GetUserOrdersCommand;
|
|
12
|
+
(function (GetUserOrdersCommand) {
|
|
13
|
+
GetUserOrdersCommand.RequestParamSchema = zod_1.default.object({
|
|
14
|
+
uuid: zod_1.default.string().uuid(),
|
|
15
|
+
});
|
|
16
|
+
GetUserOrdersCommand.RequestSchema = zod_1.default
|
|
17
|
+
.object({
|
|
18
|
+
status: zod_1.default.nativeEnum(constants_1.ORDER_STATUS).optional(),
|
|
19
|
+
type: zod_1.default.nativeEnum(constants_1.ORDER_TYPE).optional(),
|
|
20
|
+
sortBy: zod_1.default.nativeEnum(order_sort_by_enum_1.ORDER_SORT_BY).optional(),
|
|
21
|
+
sortOrder: zod_1.default.nativeEnum(constants_1.SORT_ORDER).default(constants_1.SORT_ORDER.DESC).optional(),
|
|
22
|
+
})
|
|
23
|
+
.partial();
|
|
24
|
+
GetUserOrdersCommand.ResponseSchema = zod_1.default.object({
|
|
25
|
+
data: zod_1.default.array(models_1.OrderSchema),
|
|
26
|
+
});
|
|
27
|
+
})(GetUserOrdersCommand || (exports.GetUserOrdersCommand = GetUserOrdersCommand = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
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.GetUserProductsCommand = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const models_1 = require("../../models");
|
|
10
|
+
var GetUserProductsCommand;
|
|
11
|
+
(function (GetUserProductsCommand) {
|
|
12
|
+
GetUserProductsCommand.RequestParamSchema = zod_1.default.object({
|
|
13
|
+
uuid: zod_1.default.string().uuid(),
|
|
14
|
+
});
|
|
15
|
+
GetUserProductsCommand.RequestSchema = zod_1.default
|
|
16
|
+
.object({
|
|
17
|
+
status: zod_1.default.nativeEnum(constants_1.PRODUCT_STATUS).optional(),
|
|
18
|
+
sortBy: zod_1.default.nativeEnum(constants_1.PRODUCT_SORT_BY).optional(),
|
|
19
|
+
sortOrder: zod_1.default.nativeEnum(constants_1.SORT_ORDER).default(constants_1.SORT_ORDER.DESC).optional(),
|
|
20
|
+
})
|
|
21
|
+
.partial();
|
|
22
|
+
GetUserProductsCommand.ResponseSchema = zod_1.default.object({
|
|
23
|
+
data: zod_1.default.array(models_1.UserToProductSchema),
|
|
24
|
+
});
|
|
25
|
+
})(GetUserProductsCommand || (exports.GetUserProductsCommand = GetUserProductsCommand = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
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.GetUserSubscriptionsCommand = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const models_1 = require("../../models");
|
|
10
|
+
var GetUserSubscriptionsCommand;
|
|
11
|
+
(function (GetUserSubscriptionsCommand) {
|
|
12
|
+
GetUserSubscriptionsCommand.RequestParamSchema = zod_1.default.object({
|
|
13
|
+
uuid: zod_1.default.string().uuid(),
|
|
14
|
+
});
|
|
15
|
+
GetUserSubscriptionsCommand.RequestSchema = zod_1.default
|
|
16
|
+
.object({
|
|
17
|
+
status: zod_1.default.nativeEnum(constants_1.SUBSCRIPTION_STATUS).optional(),
|
|
18
|
+
sortBy: zod_1.default.nativeEnum(constants_1.SUBSCRIPTION_SORT_BY).optional(),
|
|
19
|
+
sortOrder: zod_1.default.nativeEnum(constants_1.SORT_ORDER).default(constants_1.SORT_ORDER.DESC).optional(),
|
|
20
|
+
})
|
|
21
|
+
.partial();
|
|
22
|
+
GetUserSubscriptionsCommand.ResponseSchema = zod_1.default.object({
|
|
23
|
+
data: zod_1.default.array(models_1.UserToSubscriptionSchema),
|
|
24
|
+
});
|
|
25
|
+
})(GetUserSubscriptionsCommand || (exports.GetUserSubscriptionsCommand = GetUserSubscriptionsCommand = {}));
|
|
@@ -15,6 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./check-email.command"), exports);
|
|
18
|
-
__exportStar(require("./find-user.command"), exports);
|
|
18
|
+
__exportStar(require("./find-user-by-uuid.command"), exports);
|
|
19
19
|
__exportStar(require("./get-me.command"), exports);
|
|
20
20
|
__exportStar(require("./up-token-bonus-balance.command"), exports);
|
|
21
|
+
__exportStar(require("./find-users-by-criteria.command"), exports);
|
|
22
|
+
__exportStar(require("./get-user-balance.command"), exports);
|
|
23
|
+
__exportStar(require("./get-user-orders.command"), exports);
|
|
24
|
+
__exportStar(require("./get-user-subscriptions.command"), exports);
|
|
25
|
+
__exportStar(require("./get-user-products.command"), exports);
|
|
@@ -227,11 +227,11 @@ exports.ERRORS = {
|
|
|
227
227
|
},
|
|
228
228
|
SUBSCRIPTION_DELETE_ERROR: { code: 'A051', message: 'Подписка не была удалена', httpCode: 500 },
|
|
229
229
|
SUBSCRIPTION_CREATE_ERROR: { code: 'A052', message: 'Подписка не была создана', httpCode: 500 },
|
|
230
|
-
SUBSCRIPTION_FIND_ERROR: { code: 'A053', message: 'Подписка не найдена', httpCode:
|
|
230
|
+
SUBSCRIPTION_FIND_ERROR: { code: 'A053', message: 'Подписка не найдена', httpCode: 500 },
|
|
231
231
|
SUBSCRIPTIONS_FIND_ERROR: {
|
|
232
232
|
code: 'A054',
|
|
233
233
|
message: 'Подписки не найдены',
|
|
234
|
-
httpCode:
|
|
234
|
+
httpCode: 500,
|
|
235
235
|
},
|
|
236
236
|
SUBSCRIPTION_BUY_ERROR: {
|
|
237
237
|
code: 'A097',
|
|
@@ -1438,6 +1438,16 @@ exports.ERRORS = {
|
|
|
1438
1438
|
message: 'Произошла ошибка при построении списка функций подписки',
|
|
1439
1439
|
httpCode: 500,
|
|
1440
1440
|
},
|
|
1441
|
+
USER_TO_SUBSCRIPTION_NOT_FOUND: {
|
|
1442
|
+
code: 'A311',
|
|
1443
|
+
message: 'Подписка пользователя не найдена',
|
|
1444
|
+
httpCode: 404,
|
|
1445
|
+
},
|
|
1446
|
+
SUBSCRIPTION_NOT_ACTIVE: {
|
|
1447
|
+
code: 'A312',
|
|
1448
|
+
message: 'Подписка не активна',
|
|
1449
|
+
httpCode: 401,
|
|
1450
|
+
},
|
|
1441
1451
|
FOLDER_DELETE_ERROR: {
|
|
1442
1452
|
code: 'A311',
|
|
1443
1453
|
message: 'Папка не была удалена',
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ORDER_SORT_BY = void 0;
|
|
4
|
+
var ORDER_SORT_BY;
|
|
5
|
+
(function (ORDER_SORT_BY) {
|
|
6
|
+
ORDER_SORT_BY["STATUS"] = "status";
|
|
7
|
+
ORDER_SORT_BY["TYPE"] = "type";
|
|
8
|
+
ORDER_SORT_BY["SUM"] = "sum";
|
|
9
|
+
ORDER_SORT_BY["CREATED_AT"] = "createdAt";
|
|
10
|
+
ORDER_SORT_BY["UPDATED_AT"] = "updatedAt";
|
|
11
|
+
})(ORDER_SORT_BY || (exports.ORDER_SORT_BY = ORDER_SORT_BY = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRODUCT_SORT_BY = void 0;
|
|
4
|
+
var PRODUCT_SORT_BY;
|
|
5
|
+
(function (PRODUCT_SORT_BY) {
|
|
6
|
+
PRODUCT_SORT_BY["STATUS"] = "status";
|
|
7
|
+
PRODUCT_SORT_BY["CREATED_AT"] = "createdAt";
|
|
8
|
+
PRODUCT_SORT_BY["UPDATED_AT"] = "updatedAt";
|
|
9
|
+
})(PRODUCT_SORT_BY || (exports.PRODUCT_SORT_BY = PRODUCT_SORT_BY = {}));
|
|
@@ -21,3 +21,4 @@ __exportStar(require("./subscription-status.enum"), exports);
|
|
|
21
21
|
__exportStar(require("./subscription-type.enum"), exports);
|
|
22
22
|
__exportStar(require("./user-to-subscription-type.enum"), exports);
|
|
23
23
|
__exportStar(require("./user-to-subscription-marks.enum"), exports);
|
|
24
|
+
__exportStar(require("./subscription-sort-by.enum"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUBSCRIPTION_SORT_BY = void 0;
|
|
4
|
+
var SUBSCRIPTION_SORT_BY;
|
|
5
|
+
(function (SUBSCRIPTION_SORT_BY) {
|
|
6
|
+
SUBSCRIPTION_SORT_BY["STATUS"] = "status";
|
|
7
|
+
SUBSCRIPTION_SORT_BY["CREATED_AT"] = "createdAt";
|
|
8
|
+
SUBSCRIPTION_SORT_BY["UPDATED_AT"] = "updatedAt";
|
|
9
|
+
})(SUBSCRIPTION_SORT_BY || (exports.SUBSCRIPTION_SORT_BY = SUBSCRIPTION_SORT_BY = {}));
|
|
@@ -7,4 +7,6 @@ var SUBSCRIPTION_STATUS;
|
|
|
7
7
|
SUBSCRIPTION_STATUS["canceled"] = "canceled";
|
|
8
8
|
SUBSCRIPTION_STATUS["expired"] = "expired";
|
|
9
9
|
SUBSCRIPTION_STATUS["upgraded"] = "upgraded";
|
|
10
|
+
SUBSCRIPTION_STATUS["rejected"] = "rejected";
|
|
11
|
+
SUBSCRIPTION_STATUS["past_due"] = "past_due";
|
|
10
12
|
})(SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = SUBSCRIPTION_STATUS = {}));
|
|
@@ -4,4 +4,5 @@ exports.UI_NOTIFICATION_TYPE = void 0;
|
|
|
4
4
|
var UI_NOTIFICATION_TYPE;
|
|
5
5
|
(function (UI_NOTIFICATION_TYPE) {
|
|
6
6
|
UI_NOTIFICATION_TYPE["CONNECT_TELEGRAM_BONUS"] = "CONNECT_TELEGRAM_BONUS";
|
|
7
|
+
UI_NOTIFICATION_TYPE["SUBSCRIPTION_PAST_DUE"] = "SUBSCRIPTION_PAST_DUE";
|
|
7
8
|
})(UI_NOTIFICATION_TYPE || (exports.UI_NOTIFICATION_TYPE = UI_NOTIFICATION_TYPE = {}));
|
|
@@ -16,3 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./singup-method.enum"), exports);
|
|
18
18
|
__exportStar(require("./user-status"), exports);
|
|
19
|
+
__exportStar(require("./user-sort-by.enum"), exports);
|
|
20
|
+
__exportStar(require("./sort-order.enum"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SORT_ORDER = void 0;
|
|
4
|
+
var SORT_ORDER;
|
|
5
|
+
(function (SORT_ORDER) {
|
|
6
|
+
SORT_ORDER["ASC"] = "asc";
|
|
7
|
+
SORT_ORDER["DESC"] = "desc";
|
|
8
|
+
})(SORT_ORDER || (exports.SORT_ORDER = SORT_ORDER = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USER_SORT_BY = void 0;
|
|
4
|
+
var USER_SORT_BY;
|
|
5
|
+
(function (USER_SORT_BY) {
|
|
6
|
+
USER_SORT_BY["EMAIL"] = "email";
|
|
7
|
+
USER_SORT_BY["CREATED_AT"] = "createdAt";
|
|
8
|
+
USER_SORT_BY["UPDATED_AT"] = "updatedAt";
|
|
9
|
+
})(USER_SORT_BY || (exports.USER_SORT_BY = USER_SORT_BY = {}));
|
|
@@ -5,9 +5,11 @@ const zod_1 = require("zod");
|
|
|
5
5
|
exports.OrderSchema = zod_1.z.object({
|
|
6
6
|
uuid: zod_1.z.string().uuid(),
|
|
7
7
|
userId: zod_1.z.string().uuid(),
|
|
8
|
-
status: zod_1.z.
|
|
8
|
+
status: zod_1.z.string(),
|
|
9
|
+
type: zod_1.z.string(),
|
|
9
10
|
productId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
10
11
|
subscriptionId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
12
|
+
sum: zod_1.z.number(),
|
|
11
13
|
createdAt: zod_1.z.date(),
|
|
12
14
|
updatedAt: zod_1.z.date(),
|
|
13
15
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace RecurrentNotificationCommand {
|
|
4
|
+
export const RequestSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
Id: z.string(),
|
|
7
|
+
AccountId: z.string(),
|
|
8
|
+
Description: z.string(),
|
|
9
|
+
Email: z.string(),
|
|
10
|
+
Amount: z.number(),
|
|
11
|
+
Currency: z.string(), // "RUB", "USD", "EUR", "GBP"
|
|
12
|
+
RequireConfirmation: z.boolean(),
|
|
13
|
+
StartDate: z.string(), // ISO‐8601 datetime in UTC, e.g. "2025-07-21T14:30:00Z"
|
|
14
|
+
Interval: z.string(), // "Week", "Month", "Year"
|
|
15
|
+
Period: z.number(),
|
|
16
|
+
Status: z.string(),
|
|
17
|
+
SuccessfulTransactionsNumber: z.number(),
|
|
18
|
+
FailedTransactionsNumber: z.number(),
|
|
19
|
+
MaxPeriods: z.number().optional(),
|
|
20
|
+
LastTransactionDate: z.string().optional(), // "yyyy-MM-dd HH:mm:ss"
|
|
21
|
+
NextTransactionDate: z.string().optional(), // "yyyy-MM-dd HH:mm:ss"
|
|
22
|
+
})
|
|
23
|
+
.transform((data) => ({
|
|
24
|
+
id: data.Id,
|
|
25
|
+
accountId: data.AccountId,
|
|
26
|
+
description: data.Description,
|
|
27
|
+
email: data.Email,
|
|
28
|
+
amount: data.Amount,
|
|
29
|
+
currency: data.Currency,
|
|
30
|
+
requireConfirmation: data.RequireConfirmation,
|
|
31
|
+
startDate: data.StartDate,
|
|
32
|
+
interval: data.Interval,
|
|
33
|
+
period: data.Period,
|
|
34
|
+
status: data.Status,
|
|
35
|
+
successfulTransactionsNumber: data.SuccessfulTransactionsNumber,
|
|
36
|
+
failedTransactionsNumber: data.FailedTransactionsNumber,
|
|
37
|
+
maxPeriods: data.MaxPeriods,
|
|
38
|
+
lastTransactionDate: data.LastTransactionDate,
|
|
39
|
+
nextTransactionDate: data.NextTransactionDate,
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
43
|
+
|
|
44
|
+
export const ResponseSchema = z.object({
|
|
45
|
+
code: z.number(),
|
|
46
|
+
});
|
|
47
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserToSubscriptionSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DismissSubscriptionRenewalCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuidSiteUserToSubscription: z.string(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = UserToSubscriptionSchema;
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -10,6 +10,7 @@ export namespace GetSubscriptionsSummaryCommand {
|
|
|
10
10
|
features: z.array(SubscriptionFeatureSchema),
|
|
11
11
|
subscriptions: z.array(UserToSubscriptionWithSubscriptionSchema),
|
|
12
12
|
products: z.array(UserToProductWithProductSchema),
|
|
13
|
+
latest: UserToSubscriptionWithSubscriptionSchema.nullable(),
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UserSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindUserByUuidCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: UserSchema.omit({
|
|
13
|
+
verifyTokenHash: true,
|
|
14
|
+
password: true,
|
|
15
|
+
passwordHash: true,
|
|
16
|
+
restoreTokenHash: true,
|
|
17
|
+
}).extend({
|
|
18
|
+
telegramId: z.number().nullable(),
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { UserSchema } from '../../models';
|
|
3
|
+
import { ROLE, SORT_ORDER, USER_SORT_BY, USER_STATUS } from '../../constants';
|
|
4
|
+
|
|
5
|
+
export namespace FindUsersByCriteriaCommand {
|
|
6
|
+
export const RequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
uuid: z.string().uuid().optional(),
|
|
9
|
+
email: z.string().email().optional(),
|
|
10
|
+
status: z.nativeEnum(USER_STATUS).optional(),
|
|
11
|
+
role: z.nativeEnum(ROLE).optional(),
|
|
12
|
+
createdAt: z.date().optional(),
|
|
13
|
+
updatedAt: z.date().optional(),
|
|
14
|
+
|
|
15
|
+
sortBy: z.nativeEnum(USER_SORT_BY).optional(),
|
|
16
|
+
sortOrder: z.nativeEnum(SORT_ORDER).default(SORT_ORDER.DESC).optional(),
|
|
17
|
+
})
|
|
18
|
+
.partial();
|
|
19
|
+
|
|
20
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
21
|
+
|
|
22
|
+
export const ResponseSchema = z.object({
|
|
23
|
+
data: z.array(
|
|
24
|
+
UserSchema.omit({
|
|
25
|
+
verifyTokenHash: true,
|
|
26
|
+
password: true,
|
|
27
|
+
passwordHash: true,
|
|
28
|
+
restoreTokenHash: true,
|
|
29
|
+
}),
|
|
30
|
+
),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
34
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { UserSchema } from '../../models';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
|
|
4
|
-
export namespace
|
|
3
|
+
export namespace GetUserBalanceCommand {
|
|
5
4
|
export const RequestSchema = z.object({
|
|
6
5
|
uuid: z.string().uuid(),
|
|
7
6
|
});
|
|
@@ -9,7 +8,9 @@ export namespace FindUserCommand {
|
|
|
9
8
|
export type Request = z.infer<typeof RequestSchema>;
|
|
10
9
|
|
|
11
10
|
export const ResponseSchema = z.object({
|
|
12
|
-
data:
|
|
11
|
+
data: z.object({
|
|
12
|
+
totalTokenBalance: z.number(),
|
|
13
|
+
}),
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { ORDER_STATUS, ORDER_TYPE, SORT_ORDER } from '../../constants';
|
|
3
|
+
import { OrderSchema } from '../../models';
|
|
4
|
+
import { ORDER_SORT_BY } from '../../constants/order/enums/order-sort-by.enum';
|
|
5
|
+
|
|
6
|
+
export namespace GetUserOrdersCommand {
|
|
7
|
+
export const RequestParamSchema = z.object({
|
|
8
|
+
uuid: z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
12
|
+
|
|
13
|
+
export const RequestSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
status: z.nativeEnum(ORDER_STATUS).optional(),
|
|
16
|
+
type: z.nativeEnum(ORDER_TYPE).optional(),
|
|
17
|
+
|
|
18
|
+
sortBy: z.nativeEnum(ORDER_SORT_BY).optional(),
|
|
19
|
+
sortOrder: z.nativeEnum(SORT_ORDER).default(SORT_ORDER.DESC).optional(),
|
|
20
|
+
})
|
|
21
|
+
.partial();
|
|
22
|
+
|
|
23
|
+
export const ResponseSchema = z.object({
|
|
24
|
+
data: z.array(OrderSchema),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { PRODUCT_SORT_BY, PRODUCT_STATUS, SORT_ORDER } from '../../constants';
|
|
3
|
+
import { UserToProductSchema } from '../../models';
|
|
4
|
+
|
|
5
|
+
export namespace GetUserProductsCommand {
|
|
6
|
+
export const RequestParamSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
11
|
+
|
|
12
|
+
export const RequestSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
status: z.nativeEnum(PRODUCT_STATUS).optional(),
|
|
15
|
+
|
|
16
|
+
sortBy: z.nativeEnum(PRODUCT_SORT_BY).optional(),
|
|
17
|
+
sortOrder: z.nativeEnum(SORT_ORDER).default(SORT_ORDER.DESC).optional(),
|
|
18
|
+
})
|
|
19
|
+
.partial();
|
|
20
|
+
|
|
21
|
+
export const ResponseSchema = z.object({
|
|
22
|
+
data: z.array(UserToProductSchema),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { SORT_ORDER, SUBSCRIPTION_SORT_BY, SUBSCRIPTION_STATUS } from '../../constants';
|
|
3
|
+
import { UserToSubscriptionSchema } from '../../models';
|
|
4
|
+
|
|
5
|
+
export namespace GetUserSubscriptionsCommand {
|
|
6
|
+
export const RequestParamSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
11
|
+
|
|
12
|
+
export const RequestSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
status: z.nativeEnum(SUBSCRIPTION_STATUS).optional(),
|
|
15
|
+
|
|
16
|
+
sortBy: z.nativeEnum(SUBSCRIPTION_SORT_BY).optional(),
|
|
17
|
+
sortOrder: z.nativeEnum(SORT_ORDER).default(SORT_ORDER.DESC).optional(),
|
|
18
|
+
})
|
|
19
|
+
.partial();
|
|
20
|
+
|
|
21
|
+
export const ResponseSchema = z.object({
|
|
22
|
+
data: z.array(UserToSubscriptionSchema),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
26
|
+
}
|
package/commands/user/index.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export * from './check-email.command';
|
|
2
|
-
export * from './find-user.command';
|
|
2
|
+
export * from './find-user-by-uuid.command';
|
|
3
3
|
export * from './get-me.command';
|
|
4
4
|
export * from './up-token-bonus-balance.command';
|
|
5
|
+
export * from './find-users-by-criteria.command';
|
|
6
|
+
export * from './get-user-balance.command';
|
|
7
|
+
export * from './get-user-orders.command';
|
|
8
|
+
export * from './get-user-subscriptions.command';
|
|
9
|
+
export * from './get-user-products.command';
|
|
@@ -226,11 +226,11 @@ export const ERRORS = {
|
|
|
226
226
|
},
|
|
227
227
|
SUBSCRIPTION_DELETE_ERROR: { code: 'A051', message: 'Подписка не была удалена', httpCode: 500 },
|
|
228
228
|
SUBSCRIPTION_CREATE_ERROR: { code: 'A052', message: 'Подписка не была создана', httpCode: 500 },
|
|
229
|
-
SUBSCRIPTION_FIND_ERROR: { code: 'A053', message: 'Подписка не найдена', httpCode:
|
|
229
|
+
SUBSCRIPTION_FIND_ERROR: { code: 'A053', message: 'Подписка не найдена', httpCode: 500 },
|
|
230
230
|
SUBSCRIPTIONS_FIND_ERROR: {
|
|
231
231
|
code: 'A054',
|
|
232
232
|
message: 'Подписки не найдены',
|
|
233
|
-
httpCode:
|
|
233
|
+
httpCode: 500,
|
|
234
234
|
},
|
|
235
235
|
SUBSCRIPTION_BUY_ERROR: {
|
|
236
236
|
code: 'A097',
|
|
@@ -1444,6 +1444,16 @@ export const ERRORS = {
|
|
|
1444
1444
|
message: 'Произошла ошибка при построении списка функций подписки',
|
|
1445
1445
|
httpCode: 500,
|
|
1446
1446
|
},
|
|
1447
|
+
USER_TO_SUBSCRIPTION_NOT_FOUND: {
|
|
1448
|
+
code: 'A311',
|
|
1449
|
+
message: 'Подписка пользователя не найдена',
|
|
1450
|
+
httpCode: 404,
|
|
1451
|
+
},
|
|
1452
|
+
SUBSCRIPTION_NOT_ACTIVE: {
|
|
1453
|
+
code: 'A312',
|
|
1454
|
+
message: 'Подписка не активна',
|
|
1455
|
+
httpCode: 401,
|
|
1456
|
+
},
|
|
1447
1457
|
FOLDER_DELETE_ERROR: {
|
|
1448
1458
|
code: 'A311',
|
|
1449
1459
|
message: 'Папка не была удалена',
|
package/models/order.schema.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { z } from 'zod';
|
|
|
3
3
|
export const OrderSchema = z.object({
|
|
4
4
|
uuid: z.string().uuid(),
|
|
5
5
|
userId: z.string().uuid(),
|
|
6
|
-
status: z.
|
|
6
|
+
status: z.string(),
|
|
7
|
+
type: z.string(),
|
|
7
8
|
productId: z.nullable(z.string().uuid()),
|
|
8
9
|
subscriptionId: z.nullable(z.string().uuid()),
|
|
10
|
+
sum: z.number(),
|
|
9
11
|
|
|
10
12
|
createdAt: z.date(),
|
|
11
13
|
updatedAt: z.date(),
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FindUserCommand = void 0;
|
|
4
|
-
const models_1 = require("../../models");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
var FindUserCommand;
|
|
7
|
-
(function (FindUserCommand) {
|
|
8
|
-
FindUserCommand.RequestSchema = zod_1.z.object({
|
|
9
|
-
uuid: zod_1.z.string().uuid(),
|
|
10
|
-
});
|
|
11
|
-
FindUserCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
-
data: models_1.UserSchema,
|
|
13
|
-
});
|
|
14
|
-
})(FindUserCommand || (exports.FindUserCommand = FindUserCommand = {}));
|