@purpleschool/gptbot 0.0.1

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 (136) hide show
  1. package/api/controllers/ai-model.ts +6 -0
  2. package/api/controllers/auth.ts +9 -0
  3. package/api/controllers/category.ts +6 -0
  4. package/api/controllers/chat-private.ts +8 -0
  5. package/api/controllers/chat-public.ts +8 -0
  6. package/api/controllers/index.ts +9 -0
  7. package/api/controllers/page.ts +6 -0
  8. package/api/controllers/question.ts +5 -0
  9. package/api/controllers/unregistered-user.ts +1 -0
  10. package/api/controllers/user.ts +5 -0
  11. package/api/index.ts +2 -0
  12. package/api/routes.ts +71 -0
  13. package/build/api/controllers/ai-model.js +8 -0
  14. package/build/api/controllers/auth.js +11 -0
  15. package/build/api/controllers/category.js +8 -0
  16. package/build/api/controllers/chat-private.js +10 -0
  17. package/build/api/controllers/chat-public.js +10 -0
  18. package/build/api/controllers/index.js +25 -0
  19. package/build/api/controllers/page.js +8 -0
  20. package/build/api/controllers/question.js +8 -0
  21. package/build/api/controllers/unregistered-user.js +4 -0
  22. package/build/api/controllers/user.js +7 -0
  23. package/build/api/index.js +18 -0
  24. package/build/api/routes.js +87 -0
  25. package/build/commands/ai-model/create-ai-model.command.js +16 -0
  26. package/build/commands/ai-model/delete-ai-model.command.js +14 -0
  27. package/build/commands/ai-model/find-ai-model.command.js +17 -0
  28. package/build/commands/ai-model/index.js +20 -0
  29. package/build/commands/ai-model/update-ai-model.command.js +19 -0
  30. package/build/commands/auth/create-user.command.js +16 -0
  31. package/build/commands/auth/index.js +21 -0
  32. package/build/commands/auth/login.command.js +17 -0
  33. package/build/commands/auth/register-user.command.js +17 -0
  34. package/build/commands/auth/reset-paasword.command.js +19 -0
  35. package/build/commands/auth/restore-password.command.js +16 -0
  36. package/build/commands/category/create-category.command.js +16 -0
  37. package/build/commands/category/delete-category.command.js +14 -0
  38. package/build/commands/category/find-category.command.js +17 -0
  39. package/build/commands/category/index.js +20 -0
  40. package/build/commands/category/update-category.command.js +19 -0
  41. package/build/commands/chat/create-chat.command.js +15 -0
  42. package/build/commands/chat/delete-chat.command.js +14 -0
  43. package/build/commands/chat/find-chat.command.js +25 -0
  44. package/build/commands/chat/get-my-last-active-chat.command.js +11 -0
  45. package/build/commands/chat/index.js +21 -0
  46. package/build/commands/chat/update-chat.command.js +19 -0
  47. package/build/commands/index.js +25 -0
  48. package/build/commands/message/create-message.command.js +17 -0
  49. package/build/commands/message/index.js +17 -0
  50. package/build/commands/page/create-page.command.js +16 -0
  51. package/build/commands/page/delete-page.command.js +14 -0
  52. package/build/commands/page/find-page.command.js +17 -0
  53. package/build/commands/page/index.js +20 -0
  54. package/build/commands/page/update-page.command.js +19 -0
  55. package/build/commands/question/create-question.command.js +16 -0
  56. package/build/commands/question/delete-question.command.js +14 -0
  57. package/build/commands/question/find-question.command.js +17 -0
  58. package/build/commands/question/index.js +20 -0
  59. package/build/commands/question/update-question.command.js +19 -0
  60. package/build/commands/unregistered-user/create-unregistered-user.command.js +12 -0
  61. package/build/commands/unregistered-user/index.js +17 -0
  62. package/build/commands/user/find-user.command.js +14 -0
  63. package/build/commands/user/index.js +17 -0
  64. package/build/constants/errors/errors.js +185 -0
  65. package/build/constants/errors/index.js +18 -0
  66. package/build/constants/errors/verbose.js +9 -0
  67. package/build/constants/index.js +18 -0
  68. package/build/constants/roles/index.js +17 -0
  69. package/build/constants/roles/role.js +7 -0
  70. package/build/index.js +17 -0
  71. package/build/models/ai-model.schema.js +13 -0
  72. package/build/models/category.schema.js +12 -0
  73. package/build/models/chat.schema.js +13 -0
  74. package/build/models/index.js +24 -0
  75. package/build/models/message.schema.js +13 -0
  76. package/build/models/page.schema.js +16 -0
  77. package/build/models/question.schema.js +12 -0
  78. package/build/models/unregistered-user.schema.js +10 -0
  79. package/build/models/user.schema.js +16 -0
  80. package/commands/ai-model/create-ai-model.command.ts +18 -0
  81. package/commands/ai-model/delete-ai-model.command.ts +15 -0
  82. package/commands/ai-model/find-ai-model.command.ts +22 -0
  83. package/commands/ai-model/index.ts +4 -0
  84. package/commands/ai-model/update-ai-model.command.ts +24 -0
  85. package/commands/auth/create-user.command.ts +17 -0
  86. package/commands/auth/index.ts +5 -0
  87. package/commands/auth/login.command.ts +18 -0
  88. package/commands/auth/register-user.command.ts +18 -0
  89. package/commands/auth/reset-paasword.command.ts +20 -0
  90. package/commands/auth/restore-password.command.ts +16 -0
  91. package/commands/category/create-category.command.ts +18 -0
  92. package/commands/category/delete-category.command.ts +15 -0
  93. package/commands/category/find-category.command.ts +22 -0
  94. package/commands/category/index.ts +4 -0
  95. package/commands/category/update-category.command.ts +24 -0
  96. package/commands/chat/create-chat.command.ts +17 -0
  97. package/commands/chat/delete-chat.command.ts +15 -0
  98. package/commands/chat/find-chat.command.ts +31 -0
  99. package/commands/chat/get-my-last-active-chat.command.ts +10 -0
  100. package/commands/chat/index.ts +5 -0
  101. package/commands/chat/update-chat.command.ts +24 -0
  102. package/commands/index.ts +9 -0
  103. package/commands/message/create-message.command.ts +20 -0
  104. package/commands/message/index.ts +1 -0
  105. package/commands/page/create-page.command.ts +18 -0
  106. package/commands/page/delete-page.command.ts +15 -0
  107. package/commands/page/find-page.command.ts +22 -0
  108. package/commands/page/index.ts +4 -0
  109. package/commands/page/update-page.command.ts +24 -0
  110. package/commands/question/create-question.command.ts +18 -0
  111. package/commands/question/delete-question.command.ts +15 -0
  112. package/commands/question/find-question.command.ts +22 -0
  113. package/commands/question/index.ts +4 -0
  114. package/commands/question/update-question.command.ts +24 -0
  115. package/commands/unregistered-user/create-unregistered-user.command.ts +10 -0
  116. package/commands/unregistered-user/index.ts +1 -0
  117. package/commands/user/find-user.command.ts +16 -0
  118. package/commands/user/index.ts +1 -0
  119. package/constants/errors/errors.ts +183 -0
  120. package/constants/errors/index.ts +2 -0
  121. package/constants/errors/verbose.ts +7 -0
  122. package/constants/index.ts +2 -0
  123. package/constants/roles/index.ts +1 -0
  124. package/constants/roles/role.ts +7 -0
  125. package/index.ts +1 -0
  126. package/models/ai-model.schema.ts +12 -0
  127. package/models/category.schema.ts +11 -0
  128. package/models/chat.schema.ts +12 -0
  129. package/models/index.ts +8 -0
  130. package/models/message.schema.ts +12 -0
  131. package/models/page.schema.ts +15 -0
  132. package/models/question.schema.ts +11 -0
  133. package/models/unregistered-user.schema.ts +9 -0
  134. package/models/user.schema.ts +15 -0
  135. package/package.json +16 -0
  136. package/tsconfig.json +103 -0
@@ -0,0 +1,20 @@
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("./update-category.command"), exports);
18
+ __exportStar(require("./delete-category.command"), exports);
19
+ __exportStar(require("./create-category.command"), exports);
20
+ __exportStar(require("./find-category.command"), exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateCategoryCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const category_schema_1 = require("../../models/category.schema");
6
+ var UpdateCategoryCommand;
7
+ (function (UpdateCategoryCommand) {
8
+ UpdateCategoryCommand.RequestSchema = category_schema_1.CategorySchema.omit({
9
+ createdAt: true,
10
+ updatedAt: true,
11
+ uuid: true,
12
+ }).partial();
13
+ UpdateCategoryCommand.RequestParamSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string().uuid(),
15
+ });
16
+ UpdateCategoryCommand.ResponseSchema = zod_1.z.object({
17
+ data: category_schema_1.CategorySchema,
18
+ });
19
+ })(UpdateCategoryCommand || (exports.UpdateCategoryCommand = UpdateCategoryCommand = {}));
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateChatCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var CreateChatCommand;
7
+ (function (CreateChatCommand) {
8
+ CreateChatCommand.RequestSchema = models_1.ChatSchema.pick({
9
+ categoryId: true,
10
+ aIModelId: true,
11
+ });
12
+ CreateChatCommand.ResponseSchema = zod_1.z.object({
13
+ data: models_1.ChatSchema,
14
+ });
15
+ })(CreateChatCommand || (exports.CreateChatCommand = CreateChatCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteChatCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var DeleteChatCommand;
7
+ (function (DeleteChatCommand) {
8
+ DeleteChatCommand.RequestSchema = models_1.ChatSchema.pick({
9
+ uuid: true,
10
+ });
11
+ DeleteChatCommand.ResponseSchema = zod_1.z.object({
12
+ isDeleted: zod_1.z.boolean(),
13
+ });
14
+ })(DeleteChatCommand || (exports.DeleteChatCommand = DeleteChatCommand = {}));
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindChatCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var FindChatCommand;
7
+ (function (FindChatCommand) {
8
+ FindChatCommand.RequestSchema = models_1.ChatSchema.pick({
9
+ uuid: true,
10
+ });
11
+ FindChatCommand.RequestSchemaByQuery = zod_1.z.object({
12
+ limit: zod_1.z.string().regex(/^\d+$/, { message: 'Limit должен быть числом' }).transform(Number),
13
+ offset: zod_1.z
14
+ .string()
15
+ .regex(/^\d+$/, { message: 'Offset должен быть числом' })
16
+ .transform(Number),
17
+ });
18
+ FindChatCommand.ResponseSchema = zod_1.z.object({
19
+ data: zod_1.z.array(models_1.ChatSchema),
20
+ count: zod_1.z.number(),
21
+ });
22
+ FindChatCommand.ResponseByUUIDSchema = zod_1.z.object({
23
+ data: models_1.ChatSchema,
24
+ });
25
+ })(FindChatCommand || (exports.FindChatCommand = FindChatCommand = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetLastActiveChatCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var GetLastActiveChatCommand;
7
+ (function (GetLastActiveChatCommand) {
8
+ GetLastActiveChatCommand.Response = zod_1.z.object({
9
+ data: zod_1.z.nullable(models_1.ChatSchema),
10
+ });
11
+ })(GetLastActiveChatCommand || (exports.GetLastActiveChatCommand = GetLastActiveChatCommand = {}));
@@ -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("./update-chat.command"), exports);
18
+ __exportStar(require("./delete-chat.command"), exports);
19
+ __exportStar(require("./create-chat.command"), exports);
20
+ __exportStar(require("./find-chat.command"), exports);
21
+ __exportStar(require("./get-my-last-active-chat.command"), exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateChatCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var UpdateChatCommand;
7
+ (function (UpdateChatCommand) {
8
+ UpdateChatCommand.RequestSchema = models_1.ChatSchema.omit({
9
+ createdAt: true,
10
+ updatedAt: true,
11
+ uuid: true,
12
+ }).partial();
13
+ UpdateChatCommand.RequestParamSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string().uuid(),
15
+ });
16
+ UpdateChatCommand.ResponseSchema = zod_1.z.object({
17
+ data: models_1.ChatSchema,
18
+ });
19
+ })(UpdateChatCommand || (exports.UpdateChatCommand = UpdateChatCommand = {}));
@@ -0,0 +1,25 @@
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("./auth"), exports);
18
+ __exportStar(require("./user"), exports);
19
+ __exportStar(require("./page"), exports);
20
+ __exportStar(require("./category"), exports);
21
+ __exportStar(require("./question"), exports);
22
+ __exportStar(require("./unregistered-user"), exports);
23
+ __exportStar(require("./ai-model"), exports);
24
+ __exportStar(require("./chat"), exports);
25
+ __exportStar(require("./message"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateMessageCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var CreateMessageCommand;
7
+ (function (CreateMessageCommand) {
8
+ CreateMessageCommand.RequestSchema = models_1.MessageSchema.pick({
9
+ text: true,
10
+ });
11
+ CreateMessageCommand.RequestParamSchema = zod_1.z.object({
12
+ uuid: zod_1.z.string().uuid(),
13
+ });
14
+ CreateMessageCommand.ResponseSchema = zod_1.z.object({
15
+ data: models_1.MessageSchema,
16
+ });
17
+ })(CreateMessageCommand || (exports.CreateMessageCommand = CreateMessageCommand = {}));
@@ -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("./create-message.command"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreatePageCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var CreatePageCommand;
7
+ (function (CreatePageCommand) {
8
+ CreatePageCommand.RequestSchema = models_1.PageSchema.omit({
9
+ uuid: true,
10
+ createdAt: true,
11
+ updatedAt: true,
12
+ });
13
+ CreatePageCommand.ResponseSchema = zod_1.z.object({
14
+ data: models_1.PageSchema,
15
+ });
16
+ })(CreatePageCommand || (exports.CreatePageCommand = CreatePageCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeletePageCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var DeletePageCommand;
7
+ (function (DeletePageCommand) {
8
+ DeletePageCommand.RequestSchema = models_1.PageSchema.pick({
9
+ uuid: true,
10
+ });
11
+ DeletePageCommand.ResponseSchema = zod_1.z.object({
12
+ isDeleted: zod_1.z.boolean(),
13
+ });
14
+ })(DeletePageCommand || (exports.DeletePageCommand = DeletePageCommand = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindPageCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var FindPageCommand;
7
+ (function (FindPageCommand) {
8
+ FindPageCommand.RequestSchema = models_1.PageSchema.pick({
9
+ uuid: true,
10
+ });
11
+ FindPageCommand.ResponseSchema = zod_1.z.object({
12
+ data: zod_1.z.array(models_1.PageSchema),
13
+ });
14
+ FindPageCommand.ResponseByUUIDSchema = zod_1.z.object({
15
+ data: models_1.PageSchema,
16
+ });
17
+ })(FindPageCommand || (exports.FindPageCommand = FindPageCommand = {}));
@@ -0,0 +1,20 @@
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("./update-page.command"), exports);
18
+ __exportStar(require("./delete-page.command"), exports);
19
+ __exportStar(require("./create-page.command"), exports);
20
+ __exportStar(require("./find-page.command"), exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdatePageCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var UpdatePageCommand;
7
+ (function (UpdatePageCommand) {
8
+ UpdatePageCommand.RequestSchema = models_1.PageSchema.omit({
9
+ createdAt: true,
10
+ updatedAt: true,
11
+ uuid: true,
12
+ }).partial();
13
+ UpdatePageCommand.RequestParamSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string().uuid(),
15
+ });
16
+ UpdatePageCommand.ResponseSchema = zod_1.z.object({
17
+ data: models_1.PageSchema,
18
+ });
19
+ })(UpdatePageCommand || (exports.UpdatePageCommand = UpdatePageCommand = {}));
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateQuestionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var CreateQuestionCommand;
7
+ (function (CreateQuestionCommand) {
8
+ CreateQuestionCommand.RequestSchema = models_1.QuestionSchema.omit({
9
+ uuid: true,
10
+ createdAt: true,
11
+ updatedAt: true,
12
+ });
13
+ CreateQuestionCommand.ResponseSchema = zod_1.z.object({
14
+ data: models_1.QuestionSchema,
15
+ });
16
+ })(CreateQuestionCommand || (exports.CreateQuestionCommand = CreateQuestionCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteQuestionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var DeleteQuestionCommand;
7
+ (function (DeleteQuestionCommand) {
8
+ DeleteQuestionCommand.RequestSchema = models_1.QuestionSchema.pick({
9
+ uuid: true,
10
+ });
11
+ DeleteQuestionCommand.ResponseSchema = zod_1.z.object({
12
+ isDeleted: zod_1.z.boolean(),
13
+ });
14
+ })(DeleteQuestionCommand || (exports.DeleteQuestionCommand = DeleteQuestionCommand = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindQuestionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var FindQuestionCommand;
7
+ (function (FindQuestionCommand) {
8
+ FindQuestionCommand.RequestSchema = models_1.QuestionSchema.pick({
9
+ uuid: true,
10
+ });
11
+ FindQuestionCommand.ResponseSchema = zod_1.z.object({
12
+ data: zod_1.z.array(models_1.QuestionSchema),
13
+ });
14
+ FindQuestionCommand.ResponseByUUIDSchema = zod_1.z.object({
15
+ data: models_1.QuestionSchema,
16
+ });
17
+ })(FindQuestionCommand || (exports.FindQuestionCommand = FindQuestionCommand = {}));
@@ -0,0 +1,20 @@
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("./update-question.command"), exports);
18
+ __exportStar(require("./delete-question.command"), exports);
19
+ __exportStar(require("./create-question.command"), exports);
20
+ __exportStar(require("./find-question.command"), exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateQuestionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var UpdateQuestionCommand;
7
+ (function (UpdateQuestionCommand) {
8
+ UpdateQuestionCommand.RequestSchema = models_1.QuestionSchema.omit({
9
+ createdAt: true,
10
+ updatedAt: true,
11
+ uuid: true,
12
+ }).partial();
13
+ UpdateQuestionCommand.RequestParamSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string().uuid(),
15
+ });
16
+ UpdateQuestionCommand.ResponseSchema = zod_1.z.object({
17
+ data: models_1.QuestionSchema,
18
+ });
19
+ })(UpdateQuestionCommand || (exports.UpdateQuestionCommand = UpdateQuestionCommand = {}));
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnregisteredUserCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var UnregisteredUserCommand;
6
+ (function (UnregisteredUserCommand) {
7
+ UnregisteredUserCommand.ResponseSchema = zod_1.z.object({
8
+ data: zod_1.z.object({
9
+ accessToken: zod_1.z.string(),
10
+ }),
11
+ });
12
+ })(UnregisteredUserCommand || (exports.UnregisteredUserCommand = UnregisteredUserCommand = {}));
@@ -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("./create-unregistered-user.command"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindUserCommand = void 0;
4
+ const models_1 = require("../../models");
5
+ const zod_1 = require("zod");
6
+ var FindUserCommand;
7
+ (function (FindUserCommand) {
8
+ FindUserCommand.RequestSchema = zod_1.z.object({
9
+ uuid: zod_1.z.string().uuid(),
10
+ });
11
+ FindUserCommand.ResponseSchema = zod_1.z.object({
12
+ data: models_1.UserSchema,
13
+ });
14
+ })(FindUserCommand || (exports.FindUserCommand = FindUserCommand = {}));
@@ -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("./find-user.command"), exports);
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERRORS = void 0;
4
+ exports.ERRORS = {
5
+ INTERNAL_SERVER_ERROR: { code: 'A001', message: 'Ошибка севера', httpCode: 500 },
6
+ FORBIDDEN_API: { code: 'C001', message: 'Ошибка авторизации', httpCode: 403 },
7
+ CREATE_USER: {
8
+ code: 'U01',
9
+ message: 'Произошла ошибка при создании пользователя',
10
+ httpCode: 500,
11
+ },
12
+ LOGIN_ERROR: { code: 'U02', message: 'Неверный логин или пароль', httpCode: 401 },
13
+ RESTORE_PASSWORD: {
14
+ code: 'U03',
15
+ message: 'Возникла ошибка при восстановлении пароля',
16
+ httpCode: 401,
17
+ },
18
+ AUTH_INCORRECT_PASSWORD: {
19
+ code: 'U02',
20
+ message: 'Неверный пароль',
21
+ httpCode: 401,
22
+ },
23
+ REGISTER_ERROR: { code: 'U01', message: 'Произошла ошибка при регистрации', httpCode: 500 },
24
+ REGISTER_CONFLICT: { code: 'U04', message: 'Пользователь уже зарегистрирован', httpCode: 409 },
25
+ USER_NOT_FOUND: { code: 'A002', message: 'Пользователь не найден', httpCode: 404 },
26
+ USER_CONFLICT: { code: 'A003', message: 'Пользователь не найден', httpCode: 409 },
27
+ USER_NOT_CREATED: {
28
+ code: 'A004',
29
+ message: 'Произошла ошибка при создании пользователя',
30
+ httpCode: 500,
31
+ },
32
+ PASSWORD_NOT_RESET: {
33
+ code: 'A005',
34
+ message: 'Произошла ошибка при сбросе пароля',
35
+ httpCode: 500,
36
+ },
37
+ USER_NOT_UPDATED: {
38
+ code: 'A006',
39
+ message: 'Произошла ошибка при обновлении пользователя',
40
+ httpCode: 500,
41
+ },
42
+ USER_NOT_EMAIL: {
43
+ code: 'A007',
44
+ message: 'Произошла ошибка при поиске пользователя по Email',
45
+ httpCode: 500,
46
+ },
47
+ USER_NOT_ID: {
48
+ code: 'A008',
49
+ message: 'Произошла ошибка при поиске пользователя по uuid',
50
+ httpCode: 500,
51
+ },
52
+ PAGE_NOT_FOUND_BY_UUID: {
53
+ code: 'A009',
54
+ message: 'Страница с таким uuid не найдена',
55
+ httpCode: 404,
56
+ },
57
+ PAGE_DELETE_ERROR: { code: 'A010', message: 'Страница не была удалена', httpCode: 500 },
58
+ PAGE_CREATE_ERROR: { code: 'A011', message: 'Страница не была создана', httpCode: 500 },
59
+ PAGE_CREATE_ALIAS_CONFLICT: {
60
+ code: 'A012',
61
+ message: 'alias должен быть уникальный',
62
+ httpCode: 409,
63
+ },
64
+ PAGE_FIND_ERROR: { code: 'A013', message: 'Страница не найдена', httpCode: 404 },
65
+ PAGES_FIND_ERROR: { code: 'A014', message: 'Страницы не найдены', httpCode: 404 },
66
+ PAGE_UPDATE_ERROR: { code: 'A015', message: 'Страница не была обновлена', httpCode: 500 },
67
+ CATEGORY_NOT_FOUND_BY_UUID: {
68
+ code: 'A016',
69
+ message: 'Категория с таким uuid не найдена',
70
+ httpCode: 404,
71
+ },
72
+ CATEGORY_DELETE_ERROR: { code: 'A017', message: 'Категория не была удалена', httpCode: 500 },
73
+ CATEGORY_CREATE_ERROR: { code: 'A018', message: 'Категория не была создана', httpCode: 500 },
74
+ CATEGORY_FIND_ERROR: { code: 'A019', message: 'Категория не найдена', httpCode: 404 },
75
+ CATEGORIES_FIND_ERROR: {
76
+ code: 'A020',
77
+ message: 'Категории не найдены',
78
+ httpCode: 404,
79
+ },
80
+ CATEGORY_UPDATE_ERROR: { code: 'A021', message: 'Страница не была обновлена', httpCode: 500 },
81
+ QUESTION_NOT_FOUND_BY_UUID: {
82
+ code: 'A022',
83
+ message: 'Вопрос с таким uuid не найден',
84
+ httpCode: 404,
85
+ },
86
+ QUESTION_DELETE_ERROR: { code: 'A023', message: 'Вопрос не был удалён', httpCode: 500 },
87
+ QUESTION_CREATE_ERROR: { code: 'A024', message: 'Вопрос не был создан', httpCode: 500 },
88
+ QUESTION_FIND_ERROR: { code: 'A025', message: 'Категория не найдена', httpCode: 404 },
89
+ QUESTIONS_FIND_ERROR: {
90
+ code: 'A026',
91
+ message: 'Вопросы не найдены',
92
+ httpCode: 404,
93
+ },
94
+ QUESTION_UPDATE_ERROR: { code: 'A027', message: 'Вопрос не был обновлен', httpCode: 500 },
95
+ SESSION_CREATE_ERROR: {
96
+ code: 'A028',
97
+ message: 'Недоступно по юридическим причинам',
98
+ httpCode: 451,
99
+ },
100
+ AI_MODULE_DELETE_ERROR: {
101
+ code: 'A029',
102
+ message: 'Модель искусственного интеллекта не была удалена',
103
+ httpCode: 500,
104
+ },
105
+ AI_MODULE_CREATE_ERROR: {
106
+ code: 'A030',
107
+ message: 'Модель искусственного интеллекта не была создана',
108
+ httpCode: 500,
109
+ },
110
+ AI_MODULE_FIND_ERROR: {
111
+ code: 'A031',
112
+ message: 'Модель искусственного интеллекта не найдена',
113
+ httpCode: 404,
114
+ },
115
+ AI_MODULES_FIND_ERROR: {
116
+ code: 'A032',
117
+ message: 'Модели искусственного интеллекта не найдены',
118
+ httpCode: 404,
119
+ },
120
+ AI_MODULE_UPDATE_ERROR: {
121
+ code: 'A033',
122
+ message: 'Модель искусственного интеллекта не была обновлена',
123
+ httpCode: 500,
124
+ },
125
+ AI_MODULE_NOT_FOUND_BY_UUID: {
126
+ code: 'A034',
127
+ message: 'Модель искусственного интеллекта с таким uuid не найдена',
128
+ httpCode: 404,
129
+ },
130
+ CHAT_DELETE_ERROR: {
131
+ code: 'A035',
132
+ message: 'Чат не был удалён',
133
+ httpCode: 500,
134
+ },
135
+ CHAT_CREATE_ERROR: {
136
+ code: 'A036',
137
+ message: 'Чат не был создан',
138
+ httpCode: 500,
139
+ },
140
+ CHAT_FIND_ERROR: {
141
+ code: 'A037',
142
+ message: 'Чат не найден',
143
+ httpCode: 404,
144
+ },
145
+ CHATS_FIND_ERROR: {
146
+ code: 'A038',
147
+ message: 'Чаты не найдены',
148
+ httpCode: 404,
149
+ },
150
+ CHAT_UPDATE_ERROR: {
151
+ code: 'A039',
152
+ message: 'Чат не был обновлен',
153
+ httpCode: 500,
154
+ },
155
+ CHAT_NOT_FOUND_BY_UUID: {
156
+ code: 'A040',
157
+ message: 'Чат с таким uuid не найден',
158
+ httpCode: 404,
159
+ },
160
+ MESSAGE_CREATE_ERROR: {
161
+ code: 'A041',
162
+ message: 'Сообщение не было создано',
163
+ httpCode: 500,
164
+ },
165
+ FORBIDDEN_ROLE_ERROR: {
166
+ code: 'E000',
167
+ message: 'Forbidden',
168
+ httpCode: 403,
169
+ },
170
+ FORBIDDEN_CHAT_LIMIT_ERROR: {
171
+ code: 'E000',
172
+ message: 'Forbidden',
173
+ httpCode: 403,
174
+ },
175
+ FORBIDDEN_MESSAGES_LIMIT_ERROR: {
176
+ code: 'E000',
177
+ message: 'Forbidden',
178
+ httpCode: 403,
179
+ },
180
+ MESSAGE_UPDATE_ERROR: {
181
+ code: 'A042',
182
+ message: 'Сообщение не было создано',
183
+ httpCode: 500,
184
+ },
185
+ };