@purpleschool/gptbot 0.7.18 → 0.7.20
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/index.ts +1 -1
- package/api/controllers/http/kie.ts +5 -0
- package/api/controllers/http/user.ts +2 -0
- package/api/routes.ts +2 -0
- package/build/api/controllers/http/index.js +1 -1
- package/build/api/controllers/http/kie.js +7 -0
- package/build/api/controllers/http/user.js +2 -0
- package/build/api/routes.js +2 -0
- package/build/commands/user/get-telegram-notification.command.js +12 -0
- package/build/commands/user/send-telegram-notification.command.js +15 -0
- package/build/constants/errors/errors.js +5 -0
- package/build/models/index.js +1 -0
- package/build/models/user.schema.js +9 -1
- package/build/models/users-filter-notification.schema.js +15 -0
- package/commands/user/get-telegram-notification.command.ts +12 -0
- package/commands/user/send-telegram-notification.command.ts +15 -0
- package/constants/errors/errors.ts +5 -0
- package/models/index.ts +1 -0
- package/models/user.schema.ts +9 -0
- package/models/users-filter-notification.schema.ts +13 -0
- package/package.json +1 -1
- package/api/controllers/http/midjourney.ts +0 -5
- package/build/api/controllers/http/midjourney.js +0 -7
|
@@ -14,7 +14,7 @@ export * from './form-submission';
|
|
|
14
14
|
export * from './key-value';
|
|
15
15
|
export * from './referral';
|
|
16
16
|
export * from './message';
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './kie';
|
|
18
18
|
export * from './page';
|
|
19
19
|
export * from './payment';
|
|
20
20
|
export * from './presentation';
|
|
@@ -10,4 +10,6 @@ export const USER_ROUTES = {
|
|
|
10
10
|
GET_ORDERS: (uuid: string) => `orders/${uuid}`,
|
|
11
11
|
GET_SUBSCRIPTIONS: (uuid: string) => `subscriptions/${uuid}`,
|
|
12
12
|
GET_PRODUCTS: (uuid: string) => `products/${uuid}`,
|
|
13
|
+
GET_COUNT_NOTIFICATION: 'broadcast/count',
|
|
14
|
+
SEND_NOTIFICATION: 'broadcast',
|
|
13
15
|
} as const;
|
package/api/routes.ts
CHANGED
|
@@ -27,6 +27,8 @@ export const REST_API = {
|
|
|
27
27
|
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_SUBSCRIPTIONS(uuid)}`,
|
|
28
28
|
GET_PRODUCTS: (uuid: string) =>
|
|
29
29
|
`${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
|
|
30
|
+
GET_COUNT: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_COUNT_NOTIFICATION}`,
|
|
31
|
+
SEND_NOTIFICATION: `${ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
|
|
30
32
|
},
|
|
31
33
|
PAGE: {
|
|
32
34
|
GET: `${ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${CONTROLLERS.PAGE_ROUTES.GET_ALL}`,
|
|
@@ -30,7 +30,7 @@ __exportStar(require("./form-submission"), exports);
|
|
|
30
30
|
__exportStar(require("./key-value"), exports);
|
|
31
31
|
__exportStar(require("./referral"), exports);
|
|
32
32
|
__exportStar(require("./message"), exports);
|
|
33
|
-
__exportStar(require("./
|
|
33
|
+
__exportStar(require("./kie"), exports);
|
|
34
34
|
__exportStar(require("./page"), exports);
|
|
35
35
|
__exportStar(require("./payment"), exports);
|
|
36
36
|
__exportStar(require("./presentation"), exports);
|
package/build/api/routes.js
CHANGED
|
@@ -56,6 +56,8 @@ exports.REST_API = {
|
|
|
56
56
|
GET_ORDERS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_ORDERS(uuid)}`,
|
|
57
57
|
GET_SUBSCRIPTIONS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_SUBSCRIPTIONS(uuid)}`,
|
|
58
58
|
GET_PRODUCTS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_PRODUCTS(uuid)}`,
|
|
59
|
+
GET_COUNT: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.GET_COUNT_NOTIFICATION}`,
|
|
60
|
+
SEND_NOTIFICATION: `${exports.ROOT}/${CONTROLLERS.USER_CONTROLLER}/${CONTROLLERS.USER_ROUTES.SEND_NOTIFICATION}`,
|
|
59
61
|
},
|
|
60
62
|
PAGE: {
|
|
61
63
|
GET: `${exports.ROOT}/${CONTROLLERS.PAGE_CONTROLLER}/${CONTROLLERS.PAGE_ROUTES.GET_ALL}`,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetTelegramNotificationCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var GetTelegramNotificationCommand;
|
|
7
|
+
(function (GetTelegramNotificationCommand) {
|
|
8
|
+
GetTelegramNotificationCommand.QueryParamsSchema = models_1.UserFilterSchema;
|
|
9
|
+
GetTelegramNotificationCommand.ResponseSchema = zod_1.z.object({
|
|
10
|
+
count: zod_1.z.number(),
|
|
11
|
+
});
|
|
12
|
+
})(GetTelegramNotificationCommand || (exports.GetTelegramNotificationCommand = GetTelegramNotificationCommand = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SendTelegramNotificationCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var SendTelegramNotificationCommand;
|
|
7
|
+
(function (SendTelegramNotificationCommand) {
|
|
8
|
+
SendTelegramNotificationCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
filters: models_1.UserFilterSchema,
|
|
10
|
+
messageMd: zod_1.z.string(),
|
|
11
|
+
});
|
|
12
|
+
SendTelegramNotificationCommand.ResponseSchema = zod_1.z.object({
|
|
13
|
+
count: zod_1.z.number(),
|
|
14
|
+
});
|
|
15
|
+
})(SendTelegramNotificationCommand || (exports.SendTelegramNotificationCommand = SendTelegramNotificationCommand = {}));
|
|
@@ -734,6 +734,11 @@ exports.ERRORS = {
|
|
|
734
734
|
message: 'Telegram профиль не найден',
|
|
735
735
|
httpCode: 404,
|
|
736
736
|
},
|
|
737
|
+
FIND_USERS_BY_FILTERS_FOR_TELEGRAM_NOTIFICATION_ERROR: {
|
|
738
|
+
code: 'A161',
|
|
739
|
+
message: 'Ошибка при поиске пользователей по фильтрам для отправки Telegram-уведомления',
|
|
740
|
+
httpCode: 500,
|
|
741
|
+
},
|
|
737
742
|
TELEGRAM_PROFILE_FIND_ERROR: {
|
|
738
743
|
code: 'A170',
|
|
739
744
|
message: 'Ошибка при поиске Telegram профиля',
|
package/build/models/index.js
CHANGED
|
@@ -63,3 +63,4 @@ __exportStar(require("./prompt-topic.schema"), exports);
|
|
|
63
63
|
__exportStar(require("./prompt.schema"), exports);
|
|
64
64
|
__exportStar(require("./folder.schema"), exports);
|
|
65
65
|
__exportStar(require("./filters.schema"), exports);
|
|
66
|
+
__exportStar(require("./users-filter-notification.schema"), exports);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserSchema = void 0;
|
|
3
|
+
exports.UserAggregateSchema = exports.UserSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const user_to_subscription_schema_1 = require("./user-to-subscription.schema");
|
|
6
|
+
const user_to_product_schema_1 = require("./user-to-product.schema");
|
|
5
7
|
exports.UserSchema = zod_1.z.object({
|
|
6
8
|
uuid: zod_1.z.string().uuid(),
|
|
7
9
|
email: zod_1.z.string().email(),
|
|
@@ -16,3 +18,9 @@ exports.UserSchema = zod_1.z.object({
|
|
|
16
18
|
createdAt: zod_1.z.date(),
|
|
17
19
|
updatedAt: zod_1.z.date(),
|
|
18
20
|
});
|
|
21
|
+
exports.UserAggregateSchema = zod_1.z.object({
|
|
22
|
+
user: exports.UserSchema,
|
|
23
|
+
telegramId: zod_1.z.number().optional(),
|
|
24
|
+
userToSubscription: zod_1.z.array(user_to_subscription_schema_1.UserToSubscriptionSchema),
|
|
25
|
+
userToProduct: zod_1.z.array(user_to_product_schema_1.UserToProductSchema),
|
|
26
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserFilterSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UserFilterSchema = zod_1.z.object({
|
|
6
|
+
registeredFrom: zod_1.z.string().datetime().optional(),
|
|
7
|
+
registeredTo: zod_1.z.string().datetime().optional(),
|
|
8
|
+
lastLoginFrom: zod_1.z.string().datetime().optional(),
|
|
9
|
+
lastLoginTo: zod_1.z.string().datetime().optional(),
|
|
10
|
+
hasSubscription: zod_1.z.boolean().optional(),
|
|
11
|
+
hasProducts: zod_1.z.boolean().optional(),
|
|
12
|
+
balanceFrom: zod_1.z.number().optional(),
|
|
13
|
+
balanceTo: zod_1.z.number().optional(),
|
|
14
|
+
uuids: zod_1.z.array(zod_1.z.string().uuid()).optional(),
|
|
15
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserFilterSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetTelegramNotificationCommand {
|
|
5
|
+
export const QueryParamsSchema = UserFilterSchema;
|
|
6
|
+
export type QueryParams = z.infer<typeof QueryParamsSchema>;
|
|
7
|
+
|
|
8
|
+
export const ResponseSchema = z.object({
|
|
9
|
+
count: z.number(),
|
|
10
|
+
});
|
|
11
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserFilterSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace SendTelegramNotificationCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
filters: UserFilterSchema,
|
|
7
|
+
messageMd: z.string(),
|
|
8
|
+
});
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
count: z.number(),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -734,6 +734,11 @@ export const ERRORS = {
|
|
|
734
734
|
message: 'Telegram профиль не найден',
|
|
735
735
|
httpCode: 404,
|
|
736
736
|
},
|
|
737
|
+
FIND_USERS_BY_FILTERS_FOR_TELEGRAM_NOTIFICATION_ERROR: {
|
|
738
|
+
code: 'A161',
|
|
739
|
+
message: 'Ошибка при поиске пользователей по фильтрам для отправки Telegram-уведомления',
|
|
740
|
+
httpCode: 500,
|
|
741
|
+
},
|
|
737
742
|
TELEGRAM_PROFILE_FIND_ERROR: {
|
|
738
743
|
code: 'A170',
|
|
739
744
|
message: 'Ошибка при поиске Telegram профиля',
|
package/models/index.ts
CHANGED
package/models/user.schema.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { UserToSubscriptionSchema } from './user-to-subscription.schema';
|
|
3
|
+
import { UserToProductSchema } from './user-to-product.schema';
|
|
2
4
|
|
|
3
5
|
export const UserSchema = z.object({
|
|
4
6
|
uuid: z.string().uuid(),
|
|
@@ -15,3 +17,10 @@ export const UserSchema = z.object({
|
|
|
15
17
|
createdAt: z.date(),
|
|
16
18
|
updatedAt: z.date(),
|
|
17
19
|
});
|
|
20
|
+
|
|
21
|
+
export const UserAggregateSchema = z.object({
|
|
22
|
+
user: UserSchema,
|
|
23
|
+
telegramId: z.number().optional(),
|
|
24
|
+
userToSubscription: z.array(UserToSubscriptionSchema),
|
|
25
|
+
userToProduct: z.array(UserToProductSchema),
|
|
26
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const UserFilterSchema = z.object({
|
|
4
|
+
registeredFrom: z.string().datetime().optional(),
|
|
5
|
+
registeredTo: z.string().datetime().optional(),
|
|
6
|
+
lastLoginFrom: z.string().datetime().optional(),
|
|
7
|
+
lastLoginTo: z.string().datetime().optional(),
|
|
8
|
+
hasSubscription: z.boolean().optional(),
|
|
9
|
+
hasProducts: z.boolean().optional(),
|
|
10
|
+
balanceFrom: z.number().optional(),
|
|
11
|
+
balanceTo: z.number().optional(),
|
|
12
|
+
uuids: z.array(z.string().uuid()).optional(),
|
|
13
|
+
});
|
package/package.json
CHANGED