@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.
- package/api/controllers/ai-model.ts +6 -0
- package/api/controllers/auth.ts +9 -0
- package/api/controllers/category.ts +6 -0
- package/api/controllers/chat-private.ts +8 -0
- package/api/controllers/chat-public.ts +8 -0
- package/api/controllers/index.ts +9 -0
- package/api/controllers/page.ts +6 -0
- package/api/controllers/question.ts +5 -0
- package/api/controllers/unregistered-user.ts +1 -0
- package/api/controllers/user.ts +5 -0
- package/api/index.ts +2 -0
- package/api/routes.ts +71 -0
- package/build/api/controllers/ai-model.js +8 -0
- package/build/api/controllers/auth.js +11 -0
- package/build/api/controllers/category.js +8 -0
- package/build/api/controllers/chat-private.js +10 -0
- package/build/api/controllers/chat-public.js +10 -0
- package/build/api/controllers/index.js +25 -0
- package/build/api/controllers/page.js +8 -0
- package/build/api/controllers/question.js +8 -0
- package/build/api/controllers/unregistered-user.js +4 -0
- package/build/api/controllers/user.js +7 -0
- package/build/api/index.js +18 -0
- package/build/api/routes.js +87 -0
- package/build/commands/ai-model/create-ai-model.command.js +16 -0
- package/build/commands/ai-model/delete-ai-model.command.js +14 -0
- package/build/commands/ai-model/find-ai-model.command.js +17 -0
- package/build/commands/ai-model/index.js +20 -0
- package/build/commands/ai-model/update-ai-model.command.js +19 -0
- package/build/commands/auth/create-user.command.js +16 -0
- package/build/commands/auth/index.js +21 -0
- package/build/commands/auth/login.command.js +17 -0
- package/build/commands/auth/register-user.command.js +17 -0
- package/build/commands/auth/reset-paasword.command.js +19 -0
- package/build/commands/auth/restore-password.command.js +16 -0
- package/build/commands/category/create-category.command.js +16 -0
- package/build/commands/category/delete-category.command.js +14 -0
- package/build/commands/category/find-category.command.js +17 -0
- package/build/commands/category/index.js +20 -0
- package/build/commands/category/update-category.command.js +19 -0
- package/build/commands/chat/create-chat.command.js +15 -0
- package/build/commands/chat/delete-chat.command.js +14 -0
- package/build/commands/chat/find-chat.command.js +25 -0
- package/build/commands/chat/get-my-last-active-chat.command.js +11 -0
- package/build/commands/chat/index.js +21 -0
- package/build/commands/chat/update-chat.command.js +19 -0
- package/build/commands/index.js +25 -0
- package/build/commands/message/create-message.command.js +17 -0
- package/build/commands/message/index.js +17 -0
- package/build/commands/page/create-page.command.js +16 -0
- package/build/commands/page/delete-page.command.js +14 -0
- package/build/commands/page/find-page.command.js +17 -0
- package/build/commands/page/index.js +20 -0
- package/build/commands/page/update-page.command.js +19 -0
- package/build/commands/question/create-question.command.js +16 -0
- package/build/commands/question/delete-question.command.js +14 -0
- package/build/commands/question/find-question.command.js +17 -0
- package/build/commands/question/index.js +20 -0
- package/build/commands/question/update-question.command.js +19 -0
- package/build/commands/unregistered-user/create-unregistered-user.command.js +12 -0
- package/build/commands/unregistered-user/index.js +17 -0
- package/build/commands/user/find-user.command.js +14 -0
- package/build/commands/user/index.js +17 -0
- package/build/constants/errors/errors.js +185 -0
- package/build/constants/errors/index.js +18 -0
- package/build/constants/errors/verbose.js +9 -0
- package/build/constants/index.js +18 -0
- package/build/constants/roles/index.js +17 -0
- package/build/constants/roles/role.js +7 -0
- package/build/index.js +17 -0
- package/build/models/ai-model.schema.js +13 -0
- package/build/models/category.schema.js +12 -0
- package/build/models/chat.schema.js +13 -0
- package/build/models/index.js +24 -0
- package/build/models/message.schema.js +13 -0
- package/build/models/page.schema.js +16 -0
- package/build/models/question.schema.js +12 -0
- package/build/models/unregistered-user.schema.js +10 -0
- package/build/models/user.schema.js +16 -0
- package/commands/ai-model/create-ai-model.command.ts +18 -0
- package/commands/ai-model/delete-ai-model.command.ts +15 -0
- package/commands/ai-model/find-ai-model.command.ts +22 -0
- package/commands/ai-model/index.ts +4 -0
- package/commands/ai-model/update-ai-model.command.ts +24 -0
- package/commands/auth/create-user.command.ts +17 -0
- package/commands/auth/index.ts +5 -0
- package/commands/auth/login.command.ts +18 -0
- package/commands/auth/register-user.command.ts +18 -0
- package/commands/auth/reset-paasword.command.ts +20 -0
- package/commands/auth/restore-password.command.ts +16 -0
- package/commands/category/create-category.command.ts +18 -0
- package/commands/category/delete-category.command.ts +15 -0
- package/commands/category/find-category.command.ts +22 -0
- package/commands/category/index.ts +4 -0
- package/commands/category/update-category.command.ts +24 -0
- package/commands/chat/create-chat.command.ts +17 -0
- package/commands/chat/delete-chat.command.ts +15 -0
- package/commands/chat/find-chat.command.ts +31 -0
- package/commands/chat/get-my-last-active-chat.command.ts +10 -0
- package/commands/chat/index.ts +5 -0
- package/commands/chat/update-chat.command.ts +24 -0
- package/commands/index.ts +9 -0
- package/commands/message/create-message.command.ts +20 -0
- package/commands/message/index.ts +1 -0
- package/commands/page/create-page.command.ts +18 -0
- package/commands/page/delete-page.command.ts +15 -0
- package/commands/page/find-page.command.ts +22 -0
- package/commands/page/index.ts +4 -0
- package/commands/page/update-page.command.ts +24 -0
- package/commands/question/create-question.command.ts +18 -0
- package/commands/question/delete-question.command.ts +15 -0
- package/commands/question/find-question.command.ts +22 -0
- package/commands/question/index.ts +4 -0
- package/commands/question/update-question.command.ts +24 -0
- package/commands/unregistered-user/create-unregistered-user.command.ts +10 -0
- package/commands/unregistered-user/index.ts +1 -0
- package/commands/user/find-user.command.ts +16 -0
- package/commands/user/index.ts +1 -0
- package/constants/errors/errors.ts +183 -0
- package/constants/errors/index.ts +2 -0
- package/constants/errors/verbose.ts +7 -0
- package/constants/index.ts +2 -0
- package/constants/roles/index.ts +1 -0
- package/constants/roles/role.ts +7 -0
- package/index.ts +1 -0
- package/models/ai-model.schema.ts +12 -0
- package/models/category.schema.ts +11 -0
- package/models/chat.schema.ts +12 -0
- package/models/index.ts +8 -0
- package/models/message.schema.ts +12 -0
- package/models/page.schema.ts +15 -0
- package/models/question.schema.ts +11 -0
- package/models/unregistered-user.schema.ts +9 -0
- package/models/user.schema.ts +15 -0
- package/package.json +16 -0
- package/tsconfig.json +103 -0
|
@@ -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("./errors"), exports);
|
|
18
|
+
__exportStar(require("./verbose"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VERBOSE = void 0;
|
|
4
|
+
exports.VERBOSE = {
|
|
5
|
+
PASSWORD_SUCCESSFULLY_RESTORED: {
|
|
6
|
+
code: 'SM005',
|
|
7
|
+
message: 'Вам на почту выслано письмо с подтверждением сброса пароля. Проверьте свой почтовый ящик!',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
@@ -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("./errors"), exports);
|
|
18
|
+
__exportStar(require("./roles"), 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("./role"), exports);
|
package/build/index.js
ADDED
|
@@ -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("./constants"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiModelSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.AiModelSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
title: zod_1.z.string(),
|
|
8
|
+
description: zod_1.z.nullable(zod_1.z.string()),
|
|
9
|
+
model: zod_1.z.string(),
|
|
10
|
+
tokenMultiplicator: zod_1.z.number(),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CategorySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.CategorySchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
mainCategory: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
8
|
+
name: zod_1.z.string().min(3).max(16384),
|
|
9
|
+
prompt: zod_1.z.string().min(3).max(16384),
|
|
10
|
+
createdAt: zod_1.z.date(),
|
|
11
|
+
updatedAt: zod_1.z.date(),
|
|
12
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.ChatSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
userId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
8
|
+
unregisteredUserId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
9
|
+
categoryId: zod_1.z.string().uuid(),
|
|
10
|
+
aIModelId: zod_1.z.string().uuid(),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
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("./user.schema"), exports);
|
|
18
|
+
__exportStar(require("./page.schema"), exports);
|
|
19
|
+
__exportStar(require("./category.schema"), exports);
|
|
20
|
+
__exportStar(require("./question.schema"), exports);
|
|
21
|
+
__exportStar(require("./unregistered-user.schema"), exports);
|
|
22
|
+
__exportStar(require("./chat.schema"), exports);
|
|
23
|
+
__exportStar(require("./message.schema"), exports);
|
|
24
|
+
__exportStar(require("./ai-model.schema"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.MessageSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
text: zod_1.z.string(),
|
|
8
|
+
chatId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
9
|
+
role: zod_1.z.string(),
|
|
10
|
+
tokenUsage: zod_1.z.number(),
|
|
11
|
+
createdAt: zod_1.z.date(),
|
|
12
|
+
updatedAt: zod_1.z.date(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.PageSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
metaTitle: zod_1.z.string().min(3).max(16384),
|
|
8
|
+
metaDescription: zod_1.z.string().min(3).max(16384),
|
|
9
|
+
title: zod_1.z.string().min(3).max(16384),
|
|
10
|
+
subTitle: zod_1.z.string().min(3).max(16384),
|
|
11
|
+
seoTextMd: zod_1.z.string().min(3).max(16384),
|
|
12
|
+
alias: zod_1.z.string().min(3).max(16384),
|
|
13
|
+
categoryId: zod_1.z.string().uuid(),
|
|
14
|
+
createdAt: zod_1.z.date(),
|
|
15
|
+
updatedAt: zod_1.z.date(),
|
|
16
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuestionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.QuestionSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
question: zod_1.z.string().min(3).max(16384),
|
|
8
|
+
answer: zod_1.z.string().min(3).max(16384),
|
|
9
|
+
pageId: zod_1.z.string().uuid(),
|
|
10
|
+
createdAt: zod_1.z.date(),
|
|
11
|
+
updatedAt: zod_1.z.date(),
|
|
12
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnregisteredUserSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UnregisteredUserSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
ip: zod_1.z.string(),
|
|
8
|
+
createdAt: zod_1.z.date(),
|
|
9
|
+
updatedAt: zod_1.z.date(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UserSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
email: zod_1.z.string().email(),
|
|
8
|
+
ip: zod_1.z.string(),
|
|
9
|
+
password: zod_1.z.string(),
|
|
10
|
+
passwordHash: zod_1.z.string(),
|
|
11
|
+
restoreTokenHash: zod_1.z.string(),
|
|
12
|
+
tokenBonusBalance: zod_1.z.string(),
|
|
13
|
+
role: zod_1.z.string(),
|
|
14
|
+
createdAt: zod_1.z.date(),
|
|
15
|
+
updatedAt: zod_1.z.date(),
|
|
16
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AiModelSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace CreateAIModelCommand {
|
|
5
|
+
export const RequestSchema = AiModelSchema.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: AiModelSchema,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AiModelSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteAIModelCommand {
|
|
5
|
+
export const RequestSchema = AiModelSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
isDeleted: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AiModelSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindAIModelCommand {
|
|
5
|
+
export const RequestSchema = AiModelSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(AiModelSchema),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseByUUIDSchema = z.object({
|
|
18
|
+
data: AiModelSchema,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type ResponseByUUID = z.infer<typeof ResponseByUUIDSchema>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AiModelSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateAIModelCommand {
|
|
5
|
+
export const RequestSchema = AiModelSchema.omit({
|
|
6
|
+
createdAt: true,
|
|
7
|
+
updatedAt: true,
|
|
8
|
+
uuid: 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: AiModelSchema,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UserSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace CreateUserCommand {
|
|
5
|
+
export const RequestSchema = UserSchema.pick({
|
|
6
|
+
email: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: UserSchema.pick({
|
|
13
|
+
uuid: true,
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UserSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace LoginCommand {
|
|
5
|
+
export const RequestSchema = UserSchema.pick({
|
|
6
|
+
email: true,
|
|
7
|
+
password: true,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: z.object({
|
|
14
|
+
accessToken: z.string(),
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UserSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace RegisterUserCommand {
|
|
5
|
+
export const RequestSchema = UserSchema.pick({
|
|
6
|
+
email: true,
|
|
7
|
+
password: true,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: z.object({
|
|
14
|
+
accessToken: z.string(),
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace ResetPasswordCommand {
|
|
5
|
+
export const RequestSchema = UserSchema.pick({
|
|
6
|
+
restoreTokenHash: true,
|
|
7
|
+
}).extend({
|
|
8
|
+
newPassword: z.string(),
|
|
9
|
+
userId: z.string(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.object({
|
|
16
|
+
isSuccess: z.boolean(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace RestorePasswordCommand {
|
|
5
|
+
export const RequestSchema = UserSchema.pick({
|
|
6
|
+
email: true,
|
|
7
|
+
});
|
|
8
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: z.object({
|
|
12
|
+
message: z.string(),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CategorySchema } from '../../models/category.schema';
|
|
3
|
+
|
|
4
|
+
export namespace CreateCategoryCommand {
|
|
5
|
+
export const RequestSchema = CategorySchema.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: CategorySchema,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CategorySchema } from '../../models/category.schema';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteCategoryCommand {
|
|
5
|
+
export const RequestSchema = CategorySchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
isDeleted: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CategorySchema } from '../../models/category.schema';
|
|
3
|
+
|
|
4
|
+
export namespace FindCategoryCommand {
|
|
5
|
+
export const RequestSchema = CategorySchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(CategorySchema),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseByUUIDSchema = z.object({
|
|
18
|
+
data: CategorySchema,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type ResponseByUUID = z.infer<typeof ResponseByUUIDSchema>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CategorySchema } from '../../models/category.schema';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateCategoryCommand {
|
|
5
|
+
export const RequestSchema = CategorySchema.omit({
|
|
6
|
+
createdAt: true,
|
|
7
|
+
updatedAt: true,
|
|
8
|
+
uuid: 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: CategorySchema,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChatSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace CreateChatCommand {
|
|
5
|
+
export const RequestSchema = ChatSchema.pick({
|
|
6
|
+
categoryId: true,
|
|
7
|
+
aIModelId: true,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: ChatSchema,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ChatSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteChatCommand {
|
|
5
|
+
export const RequestSchema = ChatSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
isDeleted: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ChatSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindChatCommand {
|
|
5
|
+
export const RequestSchema = ChatSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const RequestSchemaByQuery = z.object({
|
|
12
|
+
limit: z.string().regex(/^\d+$/, { message: 'Limit должен быть числом' }).transform(Number),
|
|
13
|
+
offset: z
|
|
14
|
+
.string()
|
|
15
|
+
.regex(/^\d+$/, { message: 'Offset должен быть числом' })
|
|
16
|
+
.transform(Number),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z.object({
|
|
20
|
+
data: z.array(ChatSchema),
|
|
21
|
+
count: z.number(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
25
|
+
|
|
26
|
+
export const ResponseByUUIDSchema = z.object({
|
|
27
|
+
data: ChatSchema,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type ResponseByUUID = z.infer<typeof ResponseByUUIDSchema>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ChatSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateChatCommand {
|
|
5
|
+
export const RequestSchema = ChatSchema.omit({
|
|
6
|
+
createdAt: true,
|
|
7
|
+
updatedAt: true,
|
|
8
|
+
uuid: 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: ChatSchema,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
24
|
+
}
|