@purpleschool/gptbot 0.5.96 → 0.5.98

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 (69) hide show
  1. package/api/controllers/http/index.ts +4 -0
  2. package/api/controllers/http/prompt-category.ts +9 -0
  3. package/api/controllers/http/prompt-topic.ts +9 -0
  4. package/api/controllers/http/prompt.ts +8 -0
  5. package/api/controllers/http/review.ts +7 -0
  6. package/api/routes.ts +35 -0
  7. package/build/api/controllers/http/index.js +4 -0
  8. package/build/api/controllers/http/prompt-category.js +11 -0
  9. package/build/api/controllers/http/prompt-topic.js +11 -0
  10. package/build/api/controllers/http/prompt.js +10 -0
  11. package/build/api/controllers/http/review.js +9 -0
  12. package/build/api/routes.js +28 -0
  13. package/build/commands/index.js +4 -0
  14. package/build/commands/prompt/create-prompt.command.js +19 -0
  15. package/build/commands/prompt/delete-prompt.command.js +18 -0
  16. package/build/commands/prompt/index.js +19 -0
  17. package/build/commands/prompt/update-prompt.command.js +22 -0
  18. package/build/commands/prompt-category/create-prompt-category.command.js +19 -0
  19. package/build/commands/prompt-category/delete-prompt-category.command.js +18 -0
  20. package/build/commands/prompt-category/find-all-prompt-categories.command.js +11 -0
  21. package/build/commands/prompt-category/index.js +20 -0
  22. package/build/commands/prompt-category/update-prompt-category.command.js +22 -0
  23. package/build/commands/prompt-topic/create-prompt-topic.command.js +19 -0
  24. package/build/commands/prompt-topic/delete-prompt-topic.command.js +18 -0
  25. package/build/commands/prompt-topic/find-prompt-topic-by-category.command.js +23 -0
  26. package/build/commands/prompt-topic/index.js +20 -0
  27. package/build/commands/prompt-topic/update-prompt-topic.command.js +22 -0
  28. package/build/commands/review/create-review.command.js +17 -0
  29. package/build/commands/review/find-reviews.command.js +20 -0
  30. package/build/commands/review/index.js +18 -0
  31. package/build/constants/errors/errors.js +100 -0
  32. package/build/constants/index.js +1 -0
  33. package/build/constants/review/enums/index.js +17 -0
  34. package/build/constants/review/enums/review-status.enum.js +10 -0
  35. package/build/constants/review/index.js +17 -0
  36. package/build/models/index.js +4 -0
  37. package/build/models/prompt-category.schema.js +20 -0
  38. package/build/models/prompt-topic.schema.js +22 -0
  39. package/build/models/prompt.schema.js +13 -0
  40. package/build/models/review.schema.js +13 -0
  41. package/commands/index.ts +4 -0
  42. package/commands/prompt/create-prompt.command.ts +18 -0
  43. package/commands/prompt/delete-prompt.command.ts +17 -0
  44. package/commands/prompt/index.ts +3 -0
  45. package/commands/prompt/update-prompt.command.ts +24 -0
  46. package/commands/prompt-category/create-prompt-category.command.ts +18 -0
  47. package/commands/prompt-category/delete-prompt-category.command.ts +17 -0
  48. package/commands/prompt-category/find-all-prompt-categories.command.ts +12 -0
  49. package/commands/prompt-category/index.ts +4 -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-prompt-topic-by-category.command.ts +25 -0
  54. package/commands/prompt-topic/index.ts +4 -0
  55. package/commands/prompt-topic/update-prompt-topic.command.ts +24 -0
  56. package/commands/review/create-review.command.ts +19 -0
  57. package/commands/review/find-reviews.command.ts +19 -0
  58. package/commands/review/index.ts +2 -0
  59. package/constants/errors/errors.ts +100 -0
  60. package/constants/index.ts +1 -0
  61. package/constants/review/enums/index.ts +1 -0
  62. package/constants/review/enums/review-status.enum.ts +6 -0
  63. package/constants/review/index.ts +1 -0
  64. package/models/index.ts +4 -0
  65. package/models/prompt-category.schema.ts +17 -0
  66. package/models/prompt-topic.schema.ts +19 -0
  67. package/models/prompt.schema.ts +12 -0
  68. package/models/review.schema.ts +12 -0
  69. package/package.json +1 -1
@@ -44,3 +44,4 @@ __exportStar(require("./unregistered-user"), exports);
44
44
  __exportStar(require("./user"), exports);
45
45
  __exportStar(require("./promocode"), exports);
46
46
  __exportStar(require("./ui-notification"), exports);
47
+ __exportStar(require("./review"), exports);
@@ -0,0 +1,17 @@
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("./review-status.enum"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REVIEW_STATUS = void 0;
4
+ var REVIEW_STATUS;
5
+ (function (REVIEW_STATUS) {
6
+ REVIEW_STATUS["NEW"] = "new";
7
+ REVIEW_STATUS["ON_MODERATION"] = "on_moderation";
8
+ REVIEW_STATUS["ACTIVE"] = "active";
9
+ REVIEW_STATUS["HIDDEN"] = "hidden";
10
+ })(REVIEW_STATUS || (exports.REVIEW_STATUS = REVIEW_STATUS = {}));
@@ -0,0 +1,17 @@
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);
@@ -56,3 +56,7 @@ __exportStar(require("./user-to-subscription.schema"), exports);
56
56
  __exportStar(require("./user.schema"), exports);
57
57
  __exportStar(require("./utm.schema"), exports);
58
58
  __exportStar(require("./ui-notification.schema"), exports);
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
+ });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReviewSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ReviewSchema = zod_1.z.object({
6
+ uuid: zod_1.z.string().uuid(),
7
+ email: zod_1.z.string().email(),
8
+ name: zod_1.z.string(),
9
+ text: zod_1.z.string(),
10
+ rating: zod_1.z.number().int().step(1).min(0).max(5),
11
+ createdAt: zod_1.z.date(),
12
+ updatedAt: zod_1.z.date(),
13
+ });
package/commands/index.ts CHANGED
@@ -29,3 +29,7 @@ export * from './user-to-subscription';
29
29
  export * from './user-to-task';
30
30
  export * from './promocode';
31
31
  export * from './ui-notification';
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,3 @@
1
+ export * from './create-prompt.command';
2
+ export * from './delete-prompt.command';
3
+ export * from './update-prompt.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,4 @@
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';
@@ -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,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,4 @@
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';
@@ -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
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ReviewSchema } from '../../models';
3
+
4
+ export namespace CreateReviewCommand {
5
+ export const RequestSchema = ReviewSchema.pick({
6
+ email: true,
7
+ name: true,
8
+ text: true,
9
+ rating: true,
10
+ });
11
+
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: ReviewSchema,
16
+ });
17
+
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -0,0 +1,19 @@
1
+ import z from 'zod';
2
+ import { ReviewSchema } from '../../models';
3
+
4
+ export namespace FindReviewsCommand {
5
+ export const RequestSchema = z.object({
6
+ limit: z.string().transform((val) => parseInt(val, 10)),
7
+ offset: z.string().transform((val) => parseInt(val, 10)),
8
+ });
9
+
10
+ export type Request = z.infer<typeof RequestSchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: z.array(ReviewSchema),
14
+ totalPages: z.number(),
15
+ page: z.number(),
16
+ });
17
+
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -0,0 +1,2 @@
1
+ export * from './create-review.command';
2
+ export * from './find-reviews.command';
@@ -1324,4 +1324,104 @@ export const ERRORS = {
1324
1324
  message: 'Произошла ошибка при повторном запросе STT',
1325
1325
  httpCode: 500,
1326
1326
  },
1327
+ REVIEW_CREATE_ERROR: {
1328
+ code: 'A287',
1329
+ message: 'Произошла ошибка при создании отзыва',
1330
+ httpCode: 500,
1331
+ },
1332
+ REVIEW_UPDATE_ERROR: {
1333
+ code: 'A288',
1334
+ message: 'Произошла ошибка при обновлении отзыва',
1335
+ httpCode: 500,
1336
+ },
1337
+ REVIEW_DELETE_ERROR: {
1338
+ code: 'A289',
1339
+ message: 'Произошла ошибка при удалении отзыва',
1340
+ httpCode: 500,
1341
+ },
1342
+ REVIEWS_FIND_ERROR: {
1343
+ code: 'A290',
1344
+ message: 'Отзывы не найдены',
1345
+ httpCode: 404,
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
+ },
1327
1427
  };
@@ -28,3 +28,4 @@ export * from './unregistered-user';
28
28
  export * from './user';
29
29
  export * from './promocode';
30
30
  export * from './ui-notification';
31
+ export * from './review';
@@ -0,0 +1 @@
1
+ export * from './review-status.enum';
@@ -0,0 +1,6 @@
1
+ export enum REVIEW_STATUS {
2
+ NEW = 'new',
3
+ ON_MODERATION = 'on_moderation',
4
+ ACTIVE = 'active',
5
+ HIDDEN = 'hidden',
6
+ }
@@ -0,0 +1 @@
1
+ export * from './enums';
package/models/index.ts CHANGED
@@ -40,3 +40,7 @@ export * from './user-to-subscription.schema';
40
40
  export * from './user.schema';
41
41
  export * from './utm.schema';
42
42
  export * from './ui-notification.schema';
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
+ });
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+
3
+ export const ReviewSchema = z.object({
4
+ uuid: z.string().uuid(),
5
+ email: z.string().email(),
6
+ name: z.string(),
7
+ text: z.string(),
8
+ rating: z.number().int().step(1).min(0).max(5),
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.96",
3
+ "version": "0.5.98",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",