@purpleschool/gptbot 0.5.97 → 0.5.99

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.
Files changed (63) hide show
  1. package/api/controllers/http/index.ts +3 -0
  2. package/api/controllers/http/prompt-category.ts +10 -0
  3. package/api/controllers/http/prompt-topic.ts +11 -0
  4. package/api/controllers/http/prompt.ts +11 -0
  5. package/api/routes.ts +40 -0
  6. package/build/api/controllers/http/index.js +3 -0
  7. package/build/api/controllers/http/prompt-category.js +12 -0
  8. package/build/api/controllers/http/prompt-topic.js +13 -0
  9. package/build/api/controllers/http/prompt.js +13 -0
  10. package/build/api/routes.js +29 -0
  11. package/build/commands/index.js +3 -0
  12. package/build/commands/prompt/create-prompt.command.js +19 -0
  13. package/build/commands/prompt/delete-prompt.command.js +18 -0
  14. package/build/commands/prompt/find-all-prompts.command.js +11 -0
  15. package/build/commands/prompt/find-prompt-by-uuid.command.js +14 -0
  16. package/build/commands/prompt/find-prompts-by-topic.command.js +17 -0
  17. package/build/commands/prompt/index.js +22 -0
  18. package/build/commands/prompt/update-prompt.command.js +22 -0
  19. package/build/commands/prompt-category/create-prompt-category.command.js +19 -0
  20. package/build/commands/prompt-category/delete-prompt-category.command.js +18 -0
  21. package/build/commands/prompt-category/find-all-prompt-categories.command.js +11 -0
  22. package/build/commands/prompt-category/find-prompt-category-by-uuid.command.js +14 -0
  23. package/build/commands/prompt-category/index.js +21 -0
  24. package/build/commands/prompt-category/update-prompt-category.command.js +22 -0
  25. package/build/commands/prompt-topic/create-prompt-topic.command.js +19 -0
  26. package/build/commands/prompt-topic/delete-prompt-topic.command.js +18 -0
  27. package/build/commands/prompt-topic/find-all-prompt-topics.command.js +11 -0
  28. package/build/commands/prompt-topic/find-prompt-topic-by-category.command.js +23 -0
  29. package/build/commands/prompt-topic/find-prompt-topic-by-uuid.command.js +14 -0
  30. package/build/commands/prompt-topic/index.js +22 -0
  31. package/build/commands/prompt-topic/update-prompt-topic.command.js +22 -0
  32. package/build/constants/errors/errors.js +80 -0
  33. package/build/models/index.js +3 -0
  34. package/build/models/prompt-category.schema.js +20 -0
  35. package/build/models/prompt-topic.schema.js +22 -0
  36. package/build/models/prompt.schema.js +13 -0
  37. package/commands/index.ts +3 -0
  38. package/commands/prompt/create-prompt.command.ts +18 -0
  39. package/commands/prompt/delete-prompt.command.ts +17 -0
  40. package/commands/prompt/find-all-prompts.command.ts +12 -0
  41. package/commands/prompt/find-prompt-by-uuid.command.ts +16 -0
  42. package/commands/prompt/find-prompts-by-topic.command.ts +16 -0
  43. package/commands/prompt/index.ts +6 -0
  44. package/commands/prompt/update-prompt.command.ts +24 -0
  45. package/commands/prompt-category/create-prompt-category.command.ts +18 -0
  46. package/commands/prompt-category/delete-prompt-category.command.ts +17 -0
  47. package/commands/prompt-category/find-all-prompt-categories.command.ts +12 -0
  48. package/commands/prompt-category/find-prompt-category-by-uuid.command.ts +16 -0
  49. package/commands/prompt-category/index.ts +5 -0
  50. package/commands/prompt-category/update-prompt-category.command.ts +24 -0
  51. package/commands/prompt-topic/create-prompt-topic.command.ts +18 -0
  52. package/commands/prompt-topic/delete-prompt-topic.command.ts +17 -0
  53. package/commands/prompt-topic/find-all-prompt-topics.command.ts +12 -0
  54. package/commands/prompt-topic/find-prompt-topic-by-category.command.ts +25 -0
  55. package/commands/prompt-topic/find-prompt-topic-by-uuid.command.ts +16 -0
  56. package/commands/prompt-topic/index.ts +6 -0
  57. package/commands/prompt-topic/update-prompt-topic.command.ts +24 -0
  58. package/constants/errors/errors.ts +80 -0
  59. package/models/index.ts +3 -0
  60. package/models/prompt-category.schema.ts +17 -0
  61. package/models/prompt-topic.schema.ts +19 -0
  62. package/models/prompt.schema.ts +12 -0
  63. package/package.json +1 -1
@@ -1338,4 +1338,84 @@ exports.ERRORS = {
1338
1338
  message: 'Отзывы не найдены',
1339
1339
  httpCode: 404,
1340
1340
  },
1341
+ PROMPT_CATEGORIES_FIND_ERROR: {
1342
+ code: 'A291',
1343
+ message: 'Промпт категории не найдены',
1344
+ httpCode: 404,
1345
+ },
1346
+ PROMPT_CATEGORY_UPDATE_ERROR: {
1347
+ code: 'A292',
1348
+ message: 'Промпт тема не была обновлена',
1349
+ httpCode: 500,
1350
+ },
1351
+ PROMPT_TOPIC_DELETE_ERROR: {
1352
+ code: 'A293',
1353
+ message: 'Промпт тема не была удалена',
1354
+ httpCode: 500,
1355
+ },
1356
+ PROMPT_TOPIC_CREATE_ERROR: {
1357
+ code: 'A294',
1358
+ message: 'Промпт тема не была создана',
1359
+ httpCode: 500,
1360
+ },
1361
+ PROMPT_TOPIC_FIND_ERROR: {
1362
+ code: 'A295',
1363
+ message: 'Промпт тема не найдена',
1364
+ httpCode: 404,
1365
+ },
1366
+ PROMPT_TOPICS_FIND_ERROR: {
1367
+ code: 'A296',
1368
+ message: 'Промпт темы не найдены',
1369
+ httpCode: 404,
1370
+ },
1371
+ PROMPT_TOPIC_UPDATE_ERROR: {
1372
+ code: 'A297',
1373
+ message: 'Промпт тема не была обновлена',
1374
+ httpCode: 500,
1375
+ },
1376
+ PROMPT_DELETE_ERROR: {
1377
+ code: 'A298',
1378
+ message: 'Промпт не был удалён',
1379
+ httpCode: 500,
1380
+ },
1381
+ PROMPT_CREATE_ERROR: {
1382
+ code: 'A299',
1383
+ message: 'Промпт не был создан',
1384
+ httpCode: 500,
1385
+ },
1386
+ PROMPT_FIND_ERROR: {
1387
+ code: 'A300',
1388
+ message: 'Промпт не найден',
1389
+ httpCode: 404,
1390
+ },
1391
+ PROMPTS_FIND_ERROR: {
1392
+ code: 'A301',
1393
+ message: 'Промпты не найдены',
1394
+ httpCode: 404,
1395
+ },
1396
+ PROMPT_UPDATE_ERROR: {
1397
+ code: 'A302',
1398
+ message: 'Промпт не был обновлён',
1399
+ httpCode: 500,
1400
+ },
1401
+ PROMPT_TOPIC_PROMPT_COUNT_ERROR: {
1402
+ code: 'A303',
1403
+ message: 'Счётчик промптов не был увеличен',
1404
+ httpCode: 500,
1405
+ },
1406
+ PROMPT_CATEGORY_DELETE_ERROR: {
1407
+ code: 'A304',
1408
+ message: 'Промпт категория не была удалена',
1409
+ httpCode: 500,
1410
+ },
1411
+ PROMPT_CATEGORY_CREATE_ERROR: {
1412
+ code: 'A305',
1413
+ message: 'Промпт категория не была создана',
1414
+ httpCode: 500,
1415
+ },
1416
+ PROMPT_CATEGORY_FIND_ERROR: {
1417
+ code: 'A306',
1418
+ message: 'Промпт категория не найдена',
1419
+ httpCode: 404,
1420
+ },
1341
1421
  };
@@ -57,3 +57,6 @@ __exportStar(require("./user.schema"), exports);
57
57
  __exportStar(require("./utm.schema"), exports);
58
58
  __exportStar(require("./ui-notification.schema"), exports);
59
59
  __exportStar(require("./review.schema"), exports);
60
+ __exportStar(require("./prompt-category.schema"), exports);
61
+ __exportStar(require("./prompt-topic.schema"), exports);
62
+ __exportStar(require("./prompt.schema"), exports);
@@ -0,0 +1,20 @@
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.PromptCategoryWithTopicsAndPromptsSchema = exports.PromptCategorySchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const prompt_topic_schema_1 = require("./prompt-topic.schema");
9
+ exports.PromptCategorySchema = zod_1.default.object({
10
+ uuid: zod_1.default.string().uuid(),
11
+ title: zod_1.default.string(),
12
+ icon: zod_1.default.string(),
13
+ metaTitle: zod_1.default.string().nullable().optional(),
14
+ metaDescription: zod_1.default.string().nullable().optional(),
15
+ createdAt: zod_1.default.date(),
16
+ updatedAt: zod_1.default.date(),
17
+ });
18
+ exports.PromptCategoryWithTopicsAndPromptsSchema = exports.PromptCategorySchema.extend({
19
+ topics: zod_1.default.array(prompt_topic_schema_1.PromptTopicWithPromptsSchema),
20
+ });
@@ -0,0 +1,22 @@
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.PromptTopicWithPromptsSchema = exports.PromptTopicSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const prompt_schema_1 = require("./prompt.schema");
9
+ exports.PromptTopicSchema = zod_1.default.object({
10
+ uuid: zod_1.default.string().uuid(),
11
+ title: zod_1.default.string(),
12
+ content: zod_1.default.string(),
13
+ promptCount: zod_1.default.number().default(0),
14
+ metaTitle: zod_1.default.string().nullable().optional(),
15
+ metaDescription: zod_1.default.string().nullable().optional(),
16
+ categoryId: zod_1.default.string().uuid().nullable(),
17
+ createdAt: zod_1.default.date(),
18
+ updatedAt: zod_1.default.date(),
19
+ });
20
+ exports.PromptTopicWithPromptsSchema = exports.PromptTopicSchema.extend({
21
+ prompts: zod_1.default.array(prompt_schema_1.PromptSchema),
22
+ });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PromptSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../constants");
6
+ exports.PromptSchema = zod_1.z.object({
7
+ uuid: zod_1.z.string().uuid(),
8
+ content: zod_1.z.string(),
9
+ type: zod_1.z.nativeEnum(constants_1.AI_MODEL_CONTENT_TYPE),
10
+ topicId: zod_1.z.string().uuid().nullable(),
11
+ createdAt: zod_1.z.date(),
12
+ updatedAt: zod_1.z.date(),
13
+ });
package/commands/index.ts CHANGED
@@ -30,3 +30,6 @@ export * from './user-to-task';
30
30
  export * from './promocode';
31
31
  export * from './ui-notification';
32
32
  export * from './review';
33
+ export * from './prompt-category';
34
+ export * from './prompt-topic';
35
+ export * from './prompt';
@@ -0,0 +1,18 @@
1
+ import z from 'zod';
2
+ import { PromptSchema } from '../../models';
3
+
4
+ export namespace CreatePromptCommand {
5
+ export const RequestSchema = PromptSchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ });
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: PromptSchema,
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,17 @@
1
+ import z from 'zod';
2
+
3
+ export namespace DeletePromptCommand {
4
+ export const RequestSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+
8
+ export type RequestParam = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: z.object({
12
+ isDeleted: z.boolean(),
13
+ }),
14
+ });
15
+
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { PromptSchema } from '../../models';
3
+
4
+ export namespace FindAllPromptsCommand {
5
+ export type Request = void;
6
+
7
+ export const ResponseSchema = z.object({
8
+ data: z.array(PromptSchema),
9
+ });
10
+
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { PromptSchema } from '../../models';
3
+
4
+ export namespace FindPromptByUuidCommand {
5
+ export const RequestSchema = PromptSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: PromptSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,16 @@
1
+ import z from 'zod';
2
+ import { PromptSchema } from '../../models';
3
+
4
+ export namespace FindPromptsByTopicCommand {
5
+ export const RequestSchema = z.object({
6
+ topicId: z.string().uuid(),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.array(PromptSchema),
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,6 @@
1
+ export * from './create-prompt.command';
2
+ export * from './delete-prompt.command';
3
+ export * from './update-prompt.command';
4
+ export * from './find-prompt-by-uuid.command';
5
+ export * from './find-all-prompts.command';
6
+ export * from './find-prompts-by-topic.command';
@@ -0,0 +1,24 @@
1
+ import z from 'zod';
2
+ import { PromptSchema } from '../../models';
3
+
4
+ export namespace UpdatePromptCommand {
5
+ export const RequestSchema = PromptSchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ }).partial();
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const RequestParamSchema = z.object({
14
+ uuid: z.string().uuid(),
15
+ });
16
+
17
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
18
+
19
+ export const ResponseSchema = z.object({
20
+ data: PromptSchema,
21
+ });
22
+
23
+ export type Response = z.infer<typeof ResponseSchema>;
24
+ }
@@ -0,0 +1,18 @@
1
+ import z from 'zod';
2
+ import { PromptCategorySchema } from '../../models';
3
+
4
+ export namespace CreatePromptCategoryCommand {
5
+ export const RequestSchema = PromptCategorySchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ });
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: PromptCategorySchema,
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,17 @@
1
+ import z from 'zod';
2
+
3
+ export namespace DeletePromptCategoryCommand {
4
+ export const RequestSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+
8
+ export type RequestParam = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: z.object({
12
+ isDeleted: z.boolean(),
13
+ }),
14
+ });
15
+
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { PromptCategorySchema } from '../../models';
3
+
4
+ export namespace FindAllPromptCategoriesCommand {
5
+ export type Request = void;
6
+
7
+ export const ResponseSchema = z.object({
8
+ data: z.array(PromptCategorySchema),
9
+ });
10
+
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { PromptCategorySchema } from '../../models';
3
+
4
+ export namespace FindPromptCategoryByUuidCommand {
5
+ export const RequestSchema = PromptCategorySchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: PromptCategorySchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,5 @@
1
+ export * from './create-prompt-category.command';
2
+ export * from './delete-prompt-category.command';
3
+ export * from './update-prompt-category.command';
4
+ export * from './find-all-prompt-categories.command';
5
+ export * from './find-prompt-category-by-uuid.command';
@@ -0,0 +1,24 @@
1
+ import z from 'zod';
2
+ import { PromptCategorySchema } from '../../models';
3
+
4
+ export namespace UpdatePromptCategoryCommand {
5
+ export const RequestSchema = PromptCategorySchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ }).partial();
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const RequestParamSchema = z.object({
14
+ uuid: z.string().uuid(),
15
+ });
16
+
17
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
18
+
19
+ export const ResponseSchema = z.object({
20
+ data: PromptCategorySchema,
21
+ });
22
+
23
+ export type Response = z.infer<typeof ResponseSchema>;
24
+ }
@@ -0,0 +1,18 @@
1
+ import z from 'zod';
2
+ import { PromptTopicSchema } from '../../models';
3
+
4
+ export namespace CreatePromptTopicCommand {
5
+ export const RequestSchema = PromptTopicSchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ });
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: PromptTopicSchema,
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,17 @@
1
+ import z from 'zod';
2
+
3
+ export namespace DeletePromptTopicCommand {
4
+ export const RequestSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+
8
+ export type RequestParam = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: z.object({
12
+ isDeleted: z.boolean(),
13
+ }),
14
+ });
15
+
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { PromptTopicSchema } from '../../models';
3
+
4
+ export namespace FindAllPromptTopicsCommand {
5
+ export type Request = void;
6
+
7
+ export const ResponseSchema = z.object({
8
+ data: z.array(PromptTopicSchema),
9
+ });
10
+
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
@@ -0,0 +1,25 @@
1
+ import z from 'zod';
2
+ import { PromptTopicWithPromptsSchema } from '../../models';
3
+
4
+ export namespace FindPromptTopicsByCategoryCommand {
5
+ export const RequestParamSchema = z.object({
6
+ categoryId: z.string().uuid(),
7
+ });
8
+
9
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
10
+
11
+ export const RequestSchema = z.object({
12
+ limit: z.string().transform((val) => parseInt(val, 10)),
13
+ offset: z.string().transform((val) => parseInt(val, 10)),
14
+ });
15
+
16
+ export type Request = z.infer<typeof RequestSchema>;
17
+
18
+ export const ResponseSchema = z.object({
19
+ data: z.array(PromptTopicWithPromptsSchema),
20
+ totalPages: z.number(),
21
+ page: z.number(),
22
+ });
23
+
24
+ export type Response = z.infer<typeof ResponseSchema>;
25
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { PromptTopicSchema } from '../../models';
3
+
4
+ export namespace FindPromptTopicByUuidCommand {
5
+ export const RequestSchema = PromptTopicSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: PromptTopicSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,6 @@
1
+ export * from './create-prompt-topic.command';
2
+ export * from './delete-prompt-topic.command';
3
+ export * from './update-prompt-topic.command';
4
+ export * from './find-prompt-topic-by-category.command';
5
+ export * from './find-prompt-topic-by-uuid.command';
6
+ export * from './find-all-prompt-topics.command';
@@ -0,0 +1,24 @@
1
+ import z from 'zod';
2
+ import { PromptTopicSchema } from '../../models';
3
+
4
+ export namespace UpdatePromptTopicCommand {
5
+ export const RequestSchema = PromptTopicSchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ }).partial();
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const RequestParamSchema = z.object({
14
+ uuid: z.string().uuid(),
15
+ });
16
+
17
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
18
+
19
+ export const ResponseSchema = z.object({
20
+ data: PromptTopicSchema,
21
+ });
22
+
23
+ export type Response = z.infer<typeof ResponseSchema>;
24
+ }
@@ -1344,4 +1344,84 @@ export const ERRORS = {
1344
1344
  message: 'Отзывы не найдены',
1345
1345
  httpCode: 404,
1346
1346
  },
1347
+ PROMPT_CATEGORIES_FIND_ERROR: {
1348
+ code: 'A291',
1349
+ message: 'Промпт категории не найдены',
1350
+ httpCode: 404,
1351
+ },
1352
+ PROMPT_CATEGORY_UPDATE_ERROR: {
1353
+ code: 'A292',
1354
+ message: 'Промпт тема не была обновлена',
1355
+ httpCode: 500,
1356
+ },
1357
+ PROMPT_TOPIC_DELETE_ERROR: {
1358
+ code: 'A293',
1359
+ message: 'Промпт тема не была удалена',
1360
+ httpCode: 500,
1361
+ },
1362
+ PROMPT_TOPIC_CREATE_ERROR: {
1363
+ code: 'A294',
1364
+ message: 'Промпт тема не была создана',
1365
+ httpCode: 500,
1366
+ },
1367
+ PROMPT_TOPIC_FIND_ERROR: {
1368
+ code: 'A295',
1369
+ message: 'Промпт тема не найдена',
1370
+ httpCode: 404,
1371
+ },
1372
+ PROMPT_TOPICS_FIND_ERROR: {
1373
+ code: 'A296',
1374
+ message: 'Промпт темы не найдены',
1375
+ httpCode: 404,
1376
+ },
1377
+ PROMPT_TOPIC_UPDATE_ERROR: {
1378
+ code: 'A297',
1379
+ message: 'Промпт тема не была обновлена',
1380
+ httpCode: 500,
1381
+ },
1382
+ PROMPT_DELETE_ERROR: {
1383
+ code: 'A298',
1384
+ message: 'Промпт не был удалён',
1385
+ httpCode: 500,
1386
+ },
1387
+ PROMPT_CREATE_ERROR: {
1388
+ code: 'A299',
1389
+ message: 'Промпт не был создан',
1390
+ httpCode: 500,
1391
+ },
1392
+ PROMPT_FIND_ERROR: {
1393
+ code: 'A300',
1394
+ message: 'Промпт не найден',
1395
+ httpCode: 404,
1396
+ },
1397
+ PROMPTS_FIND_ERROR: {
1398
+ code: 'A301',
1399
+ message: 'Промпты не найдены',
1400
+ httpCode: 404,
1401
+ },
1402
+ PROMPT_UPDATE_ERROR: {
1403
+ code: 'A302',
1404
+ message: 'Промпт не был обновлён',
1405
+ httpCode: 500,
1406
+ },
1407
+ PROMPT_TOPIC_PROMPT_COUNT_ERROR: {
1408
+ code: 'A303',
1409
+ message: 'Счётчик промптов не был увеличен',
1410
+ httpCode: 500,
1411
+ },
1412
+ PROMPT_CATEGORY_DELETE_ERROR: {
1413
+ code: 'A304',
1414
+ message: 'Промпт категория не была удалена',
1415
+ httpCode: 500,
1416
+ },
1417
+ PROMPT_CATEGORY_CREATE_ERROR: {
1418
+ code: 'A305',
1419
+ message: 'Промпт категория не была создана',
1420
+ httpCode: 500,
1421
+ },
1422
+ PROMPT_CATEGORY_FIND_ERROR: {
1423
+ code: 'A306',
1424
+ message: 'Промпт категория не найдена',
1425
+ httpCode: 404,
1426
+ },
1347
1427
  };
package/models/index.ts CHANGED
@@ -41,3 +41,6 @@ export * from './user.schema';
41
41
  export * from './utm.schema';
42
42
  export * from './ui-notification.schema';
43
43
  export * from './review.schema';
44
+ export * from './prompt-category.schema';
45
+ export * from './prompt-topic.schema';
46
+ export * from './prompt.schema';
@@ -0,0 +1,17 @@
1
+ import z from 'zod';
2
+ import { PromptTopicWithPromptsSchema } from './prompt-topic.schema';
3
+
4
+ export const PromptCategorySchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ title: z.string(),
7
+ icon: z.string(),
8
+ metaTitle: z.string().nullable().optional(),
9
+ metaDescription: z.string().nullable().optional(),
10
+
11
+ createdAt: z.date(),
12
+ updatedAt: z.date(),
13
+ });
14
+
15
+ export const PromptCategoryWithTopicsAndPromptsSchema = PromptCategorySchema.extend({
16
+ topics: z.array(PromptTopicWithPromptsSchema),
17
+ });
@@ -0,0 +1,19 @@
1
+ import z from 'zod';
2
+ import { PromptSchema } from './prompt.schema';
3
+
4
+ export const PromptTopicSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ title: z.string(),
7
+ content: z.string(),
8
+ promptCount: z.number().default(0),
9
+ metaTitle: z.string().nullable().optional(),
10
+ metaDescription: z.string().nullable().optional(),
11
+ categoryId: z.string().uuid().nullable(),
12
+
13
+ createdAt: z.date(),
14
+ updatedAt: z.date(),
15
+ });
16
+
17
+ export const PromptTopicWithPromptsSchema = PromptTopicSchema.extend({
18
+ prompts: z.array(PromptSchema),
19
+ });
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { AI_MODEL_CONTENT_TYPE } from '../constants';
3
+
4
+ export const PromptSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ content: z.string(),
7
+ type: z.nativeEnum(AI_MODEL_CONTENT_TYPE),
8
+ topicId: z.string().uuid().nullable(),
9
+
10
+ createdAt: z.date(),
11
+ updatedAt: z.date(),
12
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.97",
3
+ "version": "0.5.99",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",