@purpleschool/gptbot 0.8.11 → 0.8.14
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/community.ts +22 -0
- package/api/controllers/http/index.ts +1 -0
- package/api/controllers/http/paraphrase.ts +6 -0
- package/api/routes.ts +46 -0
- package/build/api/controllers/http/community.js +23 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/controllers/http/paraphrase.js +6 -0
- package/build/api/routes.js +30 -0
- package/build/commands/community/archive-community-post.command.js +13 -0
- package/build/commands/community/create-community-post.command.js +35 -0
- package/build/commands/community/delete-community-post.command.js +13 -0
- package/build/commands/community/get-all-community-posts-by-criteria.command.js +25 -0
- package/build/commands/community/get-community-post-by-uuid.command.js +14 -0
- package/build/commands/community/get-my-community-posts-by-criteria.command.js +32 -0
- package/build/commands/community/get-my-favorite-community-posts.command.js +19 -0
- package/build/commands/community/get-my-likes-community-posts.command.js +19 -0
- package/build/commands/community/index.js +27 -0
- package/build/commands/community/set-favorite-community-post.command.js +13 -0
- package/build/commands/community/set-like-community-post.command.js +14 -0
- package/build/commands/community/share-my-community-post.command.js +13 -0
- package/build/commands/index.js +1 -0
- package/build/commands/tools/paraphrase/delete-all-paraphrase-jobs.command.js +8 -0
- package/build/commands/tools/paraphrase/delete-paraphrase-job-by-uuid.command.js +11 -0
- package/build/commands/tools/paraphrase/find-paraphrase-jobs.command.js +18 -0
- package/build/commands/tools/paraphrase/index.js +7 -1
- package/build/commands/tools/paraphrase/retry-paraphrase-job.command.js +14 -0
- package/build/commands/tools/paraphrase/set-reaction-to-paraphrase-job.command.js +18 -0
- package/build/commands/tools/paraphrase/update-paraphrase-job-title.command.js +17 -0
- package/build/constants/community/default-pagination.constant.js +6 -0
- package/build/constants/community/enums/community-aspect-ratio.enum.js +11 -0
- package/build/constants/community/enums/community-post-visibility.enum.js +8 -0
- package/build/constants/community/enums/community-status.enum.js +9 -0
- package/build/constants/community/enums/community-tool-type.enum.js +10 -0
- package/build/constants/community/enums/community-type.enum.js +11 -0
- package/build/constants/community/enums/index.js +21 -0
- package/build/constants/community/index.js +18 -0
- package/build/constants/errors/errors.js +115 -0
- package/build/constants/index.js +1 -0
- package/build/constants/tool/enums/tool-job-status.enum.js +1 -0
- package/build/models/community/community-post-media-data.schema.js +53 -0
- package/build/models/community/community-post.schema.js +43 -0
- package/build/models/community/index.js +18 -0
- package/build/models/index.js +1 -0
- package/build/models/tools/paraphrase/paraphrase-job.schema.js +3 -0
- package/commands/community/archive-community-post.command.ts +13 -0
- package/commands/community/create-community-post.command.ts +45 -0
- package/commands/community/delete-community-post.command.ts +13 -0
- package/commands/community/get-all-community-posts-by-criteria.command.ts +29 -0
- package/commands/community/get-community-post-by-uuid.command.ts +16 -0
- package/commands/community/get-my-community-posts-by-criteria.command.ts +40 -0
- package/commands/community/get-my-favorite-community-posts.command.ts +19 -0
- package/commands/community/get-my-likes-community-posts.command.ts +19 -0
- package/commands/community/index.ts +11 -0
- package/commands/community/set-favorite-community-post.command.ts +13 -0
- package/commands/community/set-like-community-post.command.ts +14 -0
- package/commands/community/share-my-community-post.command.ts +13 -0
- package/commands/index.ts +1 -0
- package/commands/tools/paraphrase/delete-all-paraphrase-jobs.command.ts +6 -0
- package/commands/tools/paraphrase/delete-paraphrase-job-by-uuid.command.ts +11 -0
- package/commands/tools/paraphrase/find-paraphrase-jobs.command.ts +18 -0
- package/commands/tools/paraphrase/index.ts +7 -1
- package/commands/tools/paraphrase/retry-paraphrase-job.command.ts +14 -0
- package/commands/tools/paraphrase/set-reaction-to-paraphrase-job.command.ts +20 -0
- package/commands/tools/paraphrase/update-paraphrase-job-title.command.ts +19 -0
- package/constants/community/default-pagination.constant.ts +4 -0
- package/constants/community/enums/community-aspect-ratio.enum.ts +7 -0
- package/constants/community/enums/community-post-visibility.enum.ts +4 -0
- package/constants/community/enums/community-status.enum.ts +5 -0
- package/constants/community/enums/community-tool-type.enum.ts +6 -0
- package/constants/community/enums/community-type.enum.ts +7 -0
- package/constants/community/enums/index.ts +5 -0
- package/constants/community/index.ts +2 -0
- package/constants/errors/errors.ts +115 -0
- package/constants/index.ts +1 -0
- package/constants/tool/enums/tool-job-status.enum.ts +1 -0
- package/models/community/community-post-media-data.schema.ts +65 -0
- package/models/community/community-post.schema.ts +47 -0
- package/models/community/index.ts +2 -0
- package/models/index.ts +1 -0
- package/models/tools/paraphrase/paraphrase-job.schema.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMMUNITY_TOOL_TYPE = void 0;
|
|
4
|
+
var COMMUNITY_TOOL_TYPE;
|
|
5
|
+
(function (COMMUNITY_TOOL_TYPE) {
|
|
6
|
+
COMMUNITY_TOOL_TYPE["IMAGE_EDITOR"] = "image_editor";
|
|
7
|
+
COMMUNITY_TOOL_TYPE["VIDEO"] = "video";
|
|
8
|
+
COMMUNITY_TOOL_TYPE["VIDEO_EDITOR"] = "video_editor";
|
|
9
|
+
COMMUNITY_TOOL_TYPE["MUSIC"] = "music";
|
|
10
|
+
})(COMMUNITY_TOOL_TYPE || (exports.COMMUNITY_TOOL_TYPE = COMMUNITY_TOOL_TYPE = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMMUNITY_POST_TYPE = void 0;
|
|
4
|
+
var COMMUNITY_POST_TYPE;
|
|
5
|
+
(function (COMMUNITY_POST_TYPE) {
|
|
6
|
+
COMMUNITY_POST_TYPE["IMAGE"] = "image";
|
|
7
|
+
COMMUNITY_POST_TYPE["IMAGE_EDITOR"] = "image_editor";
|
|
8
|
+
COMMUNITY_POST_TYPE["VIDEO"] = "video";
|
|
9
|
+
COMMUNITY_POST_TYPE["VIDEO_EDITOR"] = "video_editor";
|
|
10
|
+
COMMUNITY_POST_TYPE["MUSIC"] = "music";
|
|
11
|
+
})(COMMUNITY_POST_TYPE || (exports.COMMUNITY_POST_TYPE = COMMUNITY_POST_TYPE = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./community-status.enum"), exports);
|
|
18
|
+
__exportStar(require("./community-type.enum"), exports);
|
|
19
|
+
__exportStar(require("./community-aspect-ratio.enum"), exports);
|
|
20
|
+
__exportStar(require("./community-tool-type.enum"), exports);
|
|
21
|
+
__exportStar(require("./community-post-visibility.enum"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
|
18
|
+
__exportStar(require("./default-pagination.constant"), exports);
|
|
@@ -2367,4 +2367,119 @@ exports.ERRORS = {
|
|
|
2367
2367
|
message: 'Ошибка при обновлении профиля пользователя',
|
|
2368
2368
|
httpCode: 500,
|
|
2369
2369
|
},
|
|
2370
|
+
COMMUNITY_POST_CREATE_ERROR: {
|
|
2371
|
+
code: 'A484',
|
|
2372
|
+
message: 'Произошла ошибка при создании поста в сообществе',
|
|
2373
|
+
httpCode: 500,
|
|
2374
|
+
},
|
|
2375
|
+
COMMUNITY_POST_UPDATE_ERROR: {
|
|
2376
|
+
code: 'A485',
|
|
2377
|
+
message: 'Произошла ошибка при обновлении поста в сообществе',
|
|
2378
|
+
httpCode: 500,
|
|
2379
|
+
},
|
|
2380
|
+
COMMUNITY_POST_FIND_ERROR: {
|
|
2381
|
+
code: 'A486',
|
|
2382
|
+
message: 'Произошла ошибка при получении поста в сообществе',
|
|
2383
|
+
httpCode: 500,
|
|
2384
|
+
},
|
|
2385
|
+
COMMUNITY_POST_SET_LIKE_ERROR: {
|
|
2386
|
+
code: 'A487',
|
|
2387
|
+
message: 'Произошла ошибка при установке лайка к посту в сообществе',
|
|
2388
|
+
httpCode: 500,
|
|
2389
|
+
},
|
|
2390
|
+
COMMUNITY_POST_SET_FAVORITE_ERROR: {
|
|
2391
|
+
code: 'A488',
|
|
2392
|
+
message: 'Произошла ошибка при переключении избранного поста в сообществе',
|
|
2393
|
+
httpCode: 500,
|
|
2394
|
+
},
|
|
2395
|
+
COMMUNITY_POST_OWNERSHIP_ERROR: {
|
|
2396
|
+
code: 'A489',
|
|
2397
|
+
message: 'Вы не можете переключать избранное для своего поста',
|
|
2398
|
+
httpCode: 403,
|
|
2399
|
+
},
|
|
2400
|
+
COMMUNITY_POST_PERMISSION_ERROR: {
|
|
2401
|
+
code: 'A490',
|
|
2402
|
+
message: 'У вас нет доступа к этому посту в сообществе',
|
|
2403
|
+
httpCode: 403,
|
|
2404
|
+
},
|
|
2405
|
+
COMMUNITY_POST_DELETE_ERROR: {
|
|
2406
|
+
code: 'A491',
|
|
2407
|
+
message: 'Произошла ошибка при удалении поста в сообществе',
|
|
2408
|
+
httpCode: 500,
|
|
2409
|
+
},
|
|
2410
|
+
COMMUNITY_TOOL_TYPE_REQUIRED: {
|
|
2411
|
+
code: 'A492',
|
|
2412
|
+
message: 'Тип инструмента обязателен',
|
|
2413
|
+
httpCode: 400,
|
|
2414
|
+
},
|
|
2415
|
+
COMMUNITY_TOOL_TYPE_NOT_SUPPORTED: {
|
|
2416
|
+
code: 'A493',
|
|
2417
|
+
message: 'Неподдерживаемый тип инструмента',
|
|
2418
|
+
httpCode: 400,
|
|
2419
|
+
},
|
|
2420
|
+
VIDEO_MODEL_FIND_ERROR: {
|
|
2421
|
+
code: 'A494',
|
|
2422
|
+
message: 'Произошла ошибка при получении модели для генерации видео',
|
|
2423
|
+
httpCode: 500,
|
|
2424
|
+
},
|
|
2425
|
+
VIDEO_EDITOR_MODEL_FIND_ERROR: {
|
|
2426
|
+
code: 'A495',
|
|
2427
|
+
message: 'Произошла ошибка при получении модели для редактирования видео',
|
|
2428
|
+
httpCode: 500,
|
|
2429
|
+
},
|
|
2430
|
+
IMAGE_EDITOR_MODEL_FIND_ERROR: {
|
|
2431
|
+
code: 'A496',
|
|
2432
|
+
message: 'Произошла ошибка при получении модели для редактирования изображения',
|
|
2433
|
+
httpCode: 500,
|
|
2434
|
+
},
|
|
2435
|
+
MUSIC_MODEL_FIND_ERROR: {
|
|
2436
|
+
code: 'A497',
|
|
2437
|
+
message: 'Произошла ошибка при получении модели для генерации музыки',
|
|
2438
|
+
httpCode: 500,
|
|
2439
|
+
},
|
|
2440
|
+
COMMUNITY_POST_NOT_AVAILABLE: {
|
|
2441
|
+
code: 'A498',
|
|
2442
|
+
message: 'Пост в сообществе недоступен',
|
|
2443
|
+
httpCode: 400,
|
|
2444
|
+
},
|
|
2445
|
+
COMMUNITY_POST_NOT_FOUND: {
|
|
2446
|
+
code: 'A499',
|
|
2447
|
+
message: 'Пост в сообществе не найден',
|
|
2448
|
+
httpCode: 404,
|
|
2449
|
+
},
|
|
2450
|
+
COMMUNITY_POST_JOB_NOT_READY: {
|
|
2451
|
+
code: 'A500',
|
|
2452
|
+
message: 'Работа не готова к публикации',
|
|
2453
|
+
httpCode: 404,
|
|
2454
|
+
},
|
|
2455
|
+
MESSAGE_STATUS_ERROR: {
|
|
2456
|
+
code: 'A501',
|
|
2457
|
+
message: 'Статус неудовлетворительный',
|
|
2458
|
+
httpCode: 400,
|
|
2459
|
+
},
|
|
2460
|
+
MESSAGE_ROLE_ERROR: {
|
|
2461
|
+
code: 'A502',
|
|
2462
|
+
message: 'Статус не удовлетворительный',
|
|
2463
|
+
httpCode: 400,
|
|
2464
|
+
},
|
|
2465
|
+
PARAPHRASE_JOB_DELETE_ERROR: {
|
|
2466
|
+
code: 'A503',
|
|
2467
|
+
message: 'Произошла ошибка при удалении задачи перефразирования',
|
|
2468
|
+
httpCode: 500,
|
|
2469
|
+
},
|
|
2470
|
+
PARAPHRASE_SET_REACTION_ERROR: {
|
|
2471
|
+
code: 'A504',
|
|
2472
|
+
message: 'Произошла ошибка при установке оценки задачи перефразирования',
|
|
2473
|
+
httpCode: 500,
|
|
2474
|
+
},
|
|
2475
|
+
PARAPHRASE_UPDATE_TITLE_ERROR: {
|
|
2476
|
+
code: 'A505',
|
|
2477
|
+
message: 'Произошла ошибка при обновлении названия задачи перефразирования',
|
|
2478
|
+
httpCode: 500,
|
|
2479
|
+
},
|
|
2480
|
+
PARAPHRASE_RETRY_REQUEST_ERROR: {
|
|
2481
|
+
code: 'A506',
|
|
2482
|
+
message: 'Произошла ошибка при повторном запросе перефразирования',
|
|
2483
|
+
httpCode: 500,
|
|
2484
|
+
},
|
|
2370
2485
|
};
|
package/build/constants/index.js
CHANGED
|
@@ -56,4 +56,5 @@ __exportStar(require("./cabinet"), exports);
|
|
|
56
56
|
__exportStar(require("./webmaster"), exports);
|
|
57
57
|
__exportStar(require("./webmaster-balance"), exports);
|
|
58
58
|
__exportStar(require("./tool-music"), exports);
|
|
59
|
+
__exportStar(require("./community"), exports);
|
|
59
60
|
__exportStar(require("./user-profile"), exports);
|
|
@@ -4,6 +4,7 @@ exports.TOOL_JOB_STATUS = void 0;
|
|
|
4
4
|
var TOOL_JOB_STATUS;
|
|
5
5
|
(function (TOOL_JOB_STATUS) {
|
|
6
6
|
TOOL_JOB_STATUS["PENDING"] = "pending";
|
|
7
|
+
TOOL_JOB_STATUS["PROCESSING"] = "processing";
|
|
7
8
|
TOOL_JOB_STATUS["COMPLETED"] = "completed";
|
|
8
9
|
TOOL_JOB_STATUS["FAILED"] = "failed";
|
|
9
10
|
})(TOOL_JOB_STATUS || (exports.TOOL_JOB_STATUS = TOOL_JOB_STATUS = {}));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommunityPostMediaDataSchema = exports.MusicCommunityMediaSchema = exports.VideoEditorCommunityMediaSchema = exports.VideoCommunityMediaSchema = exports.ImageEditorCommunityMediaSchema = exports.ImageCommunityMediaSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const music_track_schema_1 = require("../tools/music/music-track.schema");
|
|
7
|
+
const video_job_schema_1 = require("../tools/video/video-job.schema");
|
|
8
|
+
const file_schema_1 = require("../file.schema");
|
|
9
|
+
const tools_1 = require("../tools");
|
|
10
|
+
exports.ImageCommunityMediaSchema = zod_1.z.object({
|
|
11
|
+
type: zod_1.z.literal(constants_1.COMMUNITY_POST_TYPE.IMAGE),
|
|
12
|
+
text: zod_1.z.string().max(10000),
|
|
13
|
+
files: zod_1.z.array(file_schema_1.FileSchema.pick({ url: true })),
|
|
14
|
+
imageFormat: zod_1.z.nativeEnum(constants_1.IMAGE_FORMAT).nullable(),
|
|
15
|
+
});
|
|
16
|
+
exports.ImageEditorCommunityMediaSchema = zod_1.z.object({
|
|
17
|
+
type: zod_1.z.literal(constants_1.COMMUNITY_POST_TYPE.IMAGE_EDITOR),
|
|
18
|
+
prompt: zod_1.z.string(),
|
|
19
|
+
imageUrls: zod_1.z.array(zod_1.z.string()).nullable(),
|
|
20
|
+
});
|
|
21
|
+
exports.VideoCommunityMediaSchema = zod_1.z.object({
|
|
22
|
+
type: zod_1.z.literal(constants_1.COMMUNITY_POST_TYPE.VIDEO),
|
|
23
|
+
title: zod_1.z.string(),
|
|
24
|
+
prompt: zod_1.z.string(),
|
|
25
|
+
videoUrl: zod_1.z.string().nullable(),
|
|
26
|
+
params: video_job_schema_1.VideoJobParamsSchema,
|
|
27
|
+
});
|
|
28
|
+
exports.VideoEditorCommunityMediaSchema = zod_1.z.object({
|
|
29
|
+
type: zod_1.z.literal(constants_1.COMMUNITY_POST_TYPE.VIDEO_EDITOR),
|
|
30
|
+
title: zod_1.z.string(),
|
|
31
|
+
prompt: zod_1.z.string(),
|
|
32
|
+
inputVideoUrl: zod_1.z.string(),
|
|
33
|
+
outputVideoUrl: zod_1.z.string().nullable(),
|
|
34
|
+
});
|
|
35
|
+
exports.MusicCommunityMediaSchema = zod_1.z.object({
|
|
36
|
+
type: zod_1.z.literal(constants_1.COMMUNITY_POST_TYPE.MUSIC),
|
|
37
|
+
params: tools_1.MusicJobParamsSchema,
|
|
38
|
+
prompt: zod_1.z.string(),
|
|
39
|
+
tracks: zod_1.z.array(music_track_schema_1.MusicTrackSchema.pick({
|
|
40
|
+
audioUrl: true,
|
|
41
|
+
coverUrl: true,
|
|
42
|
+
duration: true,
|
|
43
|
+
title: true,
|
|
44
|
+
tags: true,
|
|
45
|
+
})),
|
|
46
|
+
});
|
|
47
|
+
exports.CommunityPostMediaDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
48
|
+
exports.ImageCommunityMediaSchema,
|
|
49
|
+
exports.ImageEditorCommunityMediaSchema,
|
|
50
|
+
exports.VideoCommunityMediaSchema,
|
|
51
|
+
exports.VideoEditorCommunityMediaSchema,
|
|
52
|
+
exports.MusicCommunityMediaSchema,
|
|
53
|
+
]);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResponseCommunityPostSchema = exports.CommunityPostSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const community_post_media_data_schema_1 = require("./community-post-media-data.schema");
|
|
7
|
+
const icon_variants_schema_1 = require("../icon-variants.schema");
|
|
8
|
+
exports.CommunityPostSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
userId: zod_1.z.string().uuid(),
|
|
11
|
+
caption: zod_1.z.string().nullable(),
|
|
12
|
+
status: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_STATUS),
|
|
13
|
+
visibility: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_VISIBILITY),
|
|
14
|
+
type: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_TYPE),
|
|
15
|
+
mediaData: community_post_media_data_schema_1.CommunityPostMediaDataSchema,
|
|
16
|
+
aiModelId: zod_1.z.string().uuid(),
|
|
17
|
+
aiModelTitle: zod_1.z.string(),
|
|
18
|
+
aiModelIcons: icon_variants_schema_1.IconVariantsSchema,
|
|
19
|
+
messageId: zod_1.z.string().nullable(),
|
|
20
|
+
toolJobId: zod_1.z.string().nullable(),
|
|
21
|
+
toolType: zod_1.z.nativeEnum(constants_1.COMMUNITY_TOOL_TYPE).nullable(),
|
|
22
|
+
views: zod_1.z.number(),
|
|
23
|
+
likesCount: zod_1.z.number(),
|
|
24
|
+
publishedAt: zod_1.z.date().nullable(),
|
|
25
|
+
archivedAt: zod_1.z.date().nullable(),
|
|
26
|
+
createdAt: zod_1.z.date(),
|
|
27
|
+
updatedAt: zod_1.z.date(),
|
|
28
|
+
});
|
|
29
|
+
exports.ResponseCommunityPostSchema = zod_1.z.object({
|
|
30
|
+
uuid: zod_1.z.string().uuid(),
|
|
31
|
+
userId: zod_1.z.string().uuid(),
|
|
32
|
+
caption: zod_1.z.string().nullable(),
|
|
33
|
+
status: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_STATUS),
|
|
34
|
+
visibility: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_VISIBILITY),
|
|
35
|
+
type: zod_1.z.nativeEnum(constants_1.COMMUNITY_POST_TYPE),
|
|
36
|
+
mediaData: community_post_media_data_schema_1.CommunityPostMediaDataSchema,
|
|
37
|
+
aiModelId: zod_1.z.string().uuid(),
|
|
38
|
+
aiModelTitle: zod_1.z.string(),
|
|
39
|
+
aiModelIcons: icon_variants_schema_1.IconVariantsSchema,
|
|
40
|
+
views: zod_1.z.number(),
|
|
41
|
+
likesCount: zod_1.z.number(),
|
|
42
|
+
publishedAt: zod_1.z.date().nullable(),
|
|
43
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./community-post.schema"), exports);
|
|
18
|
+
__exportStar(require("./community-post-media-data.schema"), exports);
|
package/build/models/index.js
CHANGED
|
@@ -70,4 +70,5 @@ __exportStar(require("./webmaster.schema"), exports);
|
|
|
70
70
|
__exportStar(require("./webmaster-balance.schema"), exports);
|
|
71
71
|
__exportStar(require("./user-referrals.schema"), exports);
|
|
72
72
|
__exportStar(require("./webmaster-click.schema"), exports);
|
|
73
|
+
__exportStar(require("./community"), exports);
|
|
73
74
|
__exportStar(require("./user-profile.schema"), exports);
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ParaphraseToolJobSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const tool_job_schema_1 = require("../../tool-job.schema");
|
|
6
|
+
const constants_1 = require("../../../constants");
|
|
6
7
|
exports.ParaphraseToolJobSchema = tool_job_schema_1.ToolJobSchema.extend({
|
|
7
8
|
styleId: zod_1.z.string().uuid().nullable().optional(),
|
|
8
9
|
modelId: zod_1.z.string().uuid().nullable().optional(),
|
|
9
10
|
userInput: zod_1.z.string(),
|
|
11
|
+
title: zod_1.z.string(),
|
|
12
|
+
reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
|
|
10
13
|
aiOutput: zod_1.z.string().nullable().optional(),
|
|
11
14
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace ArchiveCommunityPostCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResponseCommunityPostSchema } from '../../models';
|
|
3
|
+
import {
|
|
4
|
+
COMMUNITY_POST_STATUS,
|
|
5
|
+
COMMUNITY_POST_VISIBILITY,
|
|
6
|
+
COMMUNITY_TOOL_TYPE,
|
|
7
|
+
} from '../../constants';
|
|
8
|
+
|
|
9
|
+
export namespace CreateCommunityPostCommand {
|
|
10
|
+
export const RequestBodySchema = z
|
|
11
|
+
.object({
|
|
12
|
+
status: z.nativeEnum(COMMUNITY_POST_STATUS),
|
|
13
|
+
visibility: z.nativeEnum(COMMUNITY_POST_VISIBILITY),
|
|
14
|
+
caption: z.string().max(500).nullable().optional(),
|
|
15
|
+
messageId: z.string().uuid().nullable().optional(),
|
|
16
|
+
toolJobId: z.string().uuid().nullable().optional(),
|
|
17
|
+
toolType: z.nativeEnum(COMMUNITY_TOOL_TYPE).nullable().optional(),
|
|
18
|
+
})
|
|
19
|
+
.refine(
|
|
20
|
+
(data) => {
|
|
21
|
+
const hasMessageId = data.messageId != null;
|
|
22
|
+
const hasToolJobId = data.toolJobId != null;
|
|
23
|
+
|
|
24
|
+
if (!(hasMessageId !== hasToolJobId)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (hasToolJobId && data.toolType == null) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return true;
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
message: 'Either messageId or toolJobId must be provided, but not both.',
|
|
36
|
+
path: ['messageId'],
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
40
|
+
|
|
41
|
+
export const ResponseSchema = z.object({
|
|
42
|
+
data: ResponseCommunityPostSchema,
|
|
43
|
+
});
|
|
44
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DeleteCommunityPostCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResponseCommunityPostSchema } from '../../models';
|
|
3
|
+
import { SORT_ORDER, COMMUNITY_POST_TYPE } from '../../constants';
|
|
4
|
+
|
|
5
|
+
export namespace GetAllCommunityPostsCommand {
|
|
6
|
+
export const RequestQuerySchema = z.object({
|
|
7
|
+
// Pagination
|
|
8
|
+
cursor: z.string().uuid().nullable().optional(),
|
|
9
|
+
limit: z.coerce.number().int().positive().max(100).default(30).optional(),
|
|
10
|
+
|
|
11
|
+
// Sorting
|
|
12
|
+
sortBy: z.enum(['publishedAt', 'views', 'likesCount']).optional(),
|
|
13
|
+
sortOrder: z.nativeEnum(SORT_ORDER).optional(),
|
|
14
|
+
|
|
15
|
+
// Criteria
|
|
16
|
+
userId: z.string().uuid().optional(),
|
|
17
|
+
type: z.nativeEnum(COMMUNITY_POST_TYPE).optional(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
21
|
+
|
|
22
|
+
export const ResponseSchema = z.object({
|
|
23
|
+
data: z.array(ResponseCommunityPostSchema),
|
|
24
|
+
cursor: z.string().uuid().nullable(),
|
|
25
|
+
hasNext: z.boolean(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResponseCommunityPostSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetCommunityPostByUuidCommand {
|
|
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: ResponseCommunityPostSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResponseCommunityPostSchema } from '../../models';
|
|
3
|
+
import {
|
|
4
|
+
COMMUNITY_POST_STATUS,
|
|
5
|
+
COMMUNITY_POST_TYPE,
|
|
6
|
+
COMMUNITY_POST_VISIBILITY,
|
|
7
|
+
DEFAULT_PAGINATION_LIMIT,
|
|
8
|
+
SORT_ORDER,
|
|
9
|
+
} from '../../constants';
|
|
10
|
+
|
|
11
|
+
export namespace GetMyCommunityPostsByCriteriaCommand {
|
|
12
|
+
export const RequestQuerySchema = z.object({
|
|
13
|
+
// Pagination
|
|
14
|
+
cursor: z.string().uuid().nullable().optional(),
|
|
15
|
+
limit: z.coerce
|
|
16
|
+
.number()
|
|
17
|
+
.int()
|
|
18
|
+
.positive()
|
|
19
|
+
.max(100)
|
|
20
|
+
.default(DEFAULT_PAGINATION_LIMIT)
|
|
21
|
+
.optional(),
|
|
22
|
+
|
|
23
|
+
// Sorting
|
|
24
|
+
sortBy: z.enum(['publishedAt', 'views', 'likesCount']).optional(),
|
|
25
|
+
sortOrder: z.nativeEnum(SORT_ORDER).optional(),
|
|
26
|
+
|
|
27
|
+
// Criteria
|
|
28
|
+
visibility: z.nativeEnum(COMMUNITY_POST_VISIBILITY).optional(),
|
|
29
|
+
type: z.nativeEnum(COMMUNITY_POST_TYPE).optional(),
|
|
30
|
+
status: z.nativeEnum(COMMUNITY_POST_STATUS).optional(),
|
|
31
|
+
});
|
|
32
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
33
|
+
|
|
34
|
+
export const ResponseSchema = z.object({
|
|
35
|
+
data: z.array(ResponseCommunityPostSchema),
|
|
36
|
+
cursor: z.string().uuid().nullable(),
|
|
37
|
+
hasNext: z.boolean(),
|
|
38
|
+
});
|
|
39
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DEFAULT_PAGINATION_LIMIT, SORT_ORDER } from '../../constants';
|
|
3
|
+
import { ResponseCommunityPostSchema } from '../../models';
|
|
4
|
+
|
|
5
|
+
export namespace GetMyFavoriteCommunityPostsCommand {
|
|
6
|
+
export const RequestQuerySchema = z.object({
|
|
7
|
+
offset: z.coerce.number().int().min(0).default(0).optional(),
|
|
8
|
+
limit: z.coerce.number().int().min(1).max(100).default(DEFAULT_PAGINATION_LIMIT).optional(),
|
|
9
|
+
sortOrder: z.nativeEnum(SORT_ORDER).optional(),
|
|
10
|
+
});
|
|
11
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: z.array(ResponseCommunityPostSchema),
|
|
15
|
+
page: z.number(),
|
|
16
|
+
totalPages: z.number(),
|
|
17
|
+
});
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DEFAULT_PAGINATION_LIMIT, SORT_ORDER } from '../../constants';
|
|
3
|
+
import { ResponseCommunityPostSchema } from '../../models';
|
|
4
|
+
|
|
5
|
+
export namespace GetMyLikesCommunityPostsCommand {
|
|
6
|
+
export const RequestQuerySchema = z.object({
|
|
7
|
+
offset: z.coerce.number().int().min(0).default(0).optional(),
|
|
8
|
+
limit: z.coerce.number().int().min(1).max(100).default(DEFAULT_PAGINATION_LIMIT).optional(),
|
|
9
|
+
sortOrder: z.nativeEnum(SORT_ORDER).optional(),
|
|
10
|
+
});
|
|
11
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: z.array(ResponseCommunityPostSchema),
|
|
15
|
+
page: z.number(),
|
|
16
|
+
totalPages: z.number(),
|
|
17
|
+
});
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './get-all-community-posts-by-criteria.command';
|
|
2
|
+
export * from './get-community-post-by-uuid.command';
|
|
3
|
+
export * from './create-community-post.command';
|
|
4
|
+
export * from './set-like-community-post.command';
|
|
5
|
+
export * from './set-favorite-community-post.command';
|
|
6
|
+
export * from './delete-community-post.command';
|
|
7
|
+
export * from './archive-community-post.command';
|
|
8
|
+
export * from './get-my-community-posts-by-criteria.command';
|
|
9
|
+
export * from './share-my-community-post.command';
|
|
10
|
+
export * from './get-my-likes-community-posts.command';
|
|
11
|
+
export * from './get-my-favorite-community-posts.command';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace SetFavoriteCommunityPostCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResponseCommunityPostSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace SetLikeCommunityPostCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: ResponseCommunityPostSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace ShareMyCommunityPostCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.string().url(),
|
|
11
|
+
});
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace DeleteParaphraseJobByUUIDCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.void();
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ParaphraseToolJobSchema } from '../../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindParaphraseJobsCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
limit: z.coerce.number().min(1).optional(),
|
|
7
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
8
|
+
title: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: z.array(ParaphraseToolJobSchema),
|
|
14
|
+
totalPages: z.number(),
|
|
15
|
+
page: z.number(),
|
|
16
|
+
});
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|