@purpleschool/gptbot 0.1.3 → 0.1.5
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/blog.ts +8 -0
- package/api/controllers/chat-private.ts +3 -2
- package/api/controllers/chat-public.ts +1 -2
- package/api/controllers/files.ts +6 -0
- package/api/controllers/index.ts +2 -0
- package/api/controllers/user.ts +1 -0
- package/api/routes.ts +28 -11
- package/build/api/controllers/blog.js +10 -0
- package/build/api/controllers/chat-private.js +3 -2
- package/build/api/controllers/chat-public.js +2 -2
- package/build/api/controllers/files.js +8 -0
- package/build/api/controllers/index.js +2 -0
- package/build/api/controllers/user.js +1 -0
- package/build/api/routes.js +19 -8
- package/build/commands/blog/create-post.command.js +17 -0
- package/build/commands/blog/delete-post.command.js +14 -0
- package/build/commands/blog/find-post-by-alias.command.js +17 -0
- package/build/commands/blog/find-post-by-uuid.command.js +14 -0
- package/build/commands/blog/find-post.command.js +19 -0
- package/build/commands/blog/index.js +22 -0
- package/build/commands/blog/update-post.command.js +20 -0
- package/build/commands/chat/create-chat.command.js +4 -2
- package/build/commands/chat/delete-chat.command.js +1 -0
- package/build/commands/chat/find-chat.command.js +6 -1
- package/build/commands/chat/get-my-last-active-chat.command.js +6 -1
- package/build/commands/chat/update-chat.command.js +3 -1
- package/build/commands/index.js +1 -0
- package/build/commands/message/create-message.command.js +1 -0
- package/build/commands/user/index.js +1 -0
- package/build/commands/user/up-token-bonus-balance.command.js +18 -0
- package/build/constants/errors/errors.js +125 -0
- package/build/constants/index.js +2 -0
- package/build/constants/product/enums/index.js +17 -0
- package/build/constants/product/enums/product-status.enum.js +8 -0
- package/build/constants/product/index.js +17 -0
- package/build/constants/subscription/enums/index.js +17 -0
- package/build/constants/subscription/enums/subscription-status.enum.js +9 -0
- package/build/constants/subscription/index.js +17 -0
- package/build/constants/transaction/enums/index.js +1 -0
- package/build/constants/transaction/enums/transaction-status.enum.js +11 -0
- package/build/constants/transaction/enums/user-balance-status.enum.js +9 -0
- package/build/models/category.schema.js +1 -0
- package/build/models/index.js +1 -0
- package/build/models/post.schema.js +18 -0
- package/build/models/user.schema.js +1 -1
- package/commands/blog/create-post.command.ts +18 -0
- package/commands/blog/delete-post.command.ts +15 -0
- package/commands/blog/find-post-by-alias.command.ts +20 -0
- package/commands/blog/find-post-by-uuid.command.ts +14 -0
- package/commands/blog/find-post.command.ts +21 -0
- package/commands/blog/index.ts +6 -0
- package/commands/blog/update-post.command.ts +25 -0
- package/commands/chat/create-chat.command.ts +6 -4
- package/commands/chat/delete-chat.command.ts +1 -0
- package/commands/chat/find-chat.command.ts +10 -2
- package/commands/chat/get-my-last-active-chat.command.ts +10 -2
- package/commands/chat/update-chat.command.ts +4 -2
- package/commands/index.ts +1 -0
- package/commands/message/create-message.command.ts +1 -0
- package/commands/user/index.ts +1 -0
- package/commands/user/up-token-bonus-balance.command.ts +23 -0
- package/constants/errors/errors.ts +125 -0
- package/constants/index.ts +2 -0
- package/constants/product/enums/index.ts +1 -0
- package/constants/product/enums/product-status.enum.ts +4 -0
- package/constants/product/index.ts +1 -0
- package/constants/subscription/enums/index.ts +1 -0
- package/constants/subscription/enums/subscription-status.enum.ts +5 -0
- package/constants/subscription/index.ts +1 -0
- package/constants/transaction/enums/index.ts +0 -0
- package/constants/transaction/enums/transaction-status.enum.ts +7 -0
- package/constants/transaction/enums/user-balance-status.enum.ts +5 -0
- package/models/category.schema.ts +1 -0
- package/models/index.ts +1 -0
- package/models/post.schema.ts +17 -0
- package/models/user.schema.ts +1 -1
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -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("./subscription-status.enum"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUBSCRIPTION_STATUS = void 0;
|
|
4
|
+
var SUBSCRIPTION_STATUS;
|
|
5
|
+
(function (SUBSCRIPTION_STATUS) {
|
|
6
|
+
SUBSCRIPTION_STATUS["active"] = "active";
|
|
7
|
+
SUBSCRIPTION_STATUS["canceled"] = "canceled";
|
|
8
|
+
SUBSCRIPTION_STATUS["expired"] = "expired";
|
|
9
|
+
})(SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = SUBSCRIPTION_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);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TRANSACTION_STATUS = void 0;
|
|
4
|
+
var TRANSACTION_STATUS;
|
|
5
|
+
(function (TRANSACTION_STATUS) {
|
|
6
|
+
TRANSACTION_STATUS["success"] = "success";
|
|
7
|
+
TRANSACTION_STATUS["processing"] = "processing";
|
|
8
|
+
TRANSACTION_STATUS["new"] = "new";
|
|
9
|
+
TRANSACTION_STATUS["error"] = "error";
|
|
10
|
+
TRANSACTION_STATUS["waiting_for_payment"] = "waiting_for_payment";
|
|
11
|
+
})(TRANSACTION_STATUS || (exports.TRANSACTION_STATUS = TRANSACTION_STATUS = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USER_BALANCE_STATUS = void 0;
|
|
4
|
+
var USER_BALANCE_STATUS;
|
|
5
|
+
(function (USER_BALANCE_STATUS) {
|
|
6
|
+
USER_BALANCE_STATUS["bonus_balance"] = "bonus_balance";
|
|
7
|
+
USER_BALANCE_STATUS["subscription_balance"] = "subscription_balance";
|
|
8
|
+
USER_BALANCE_STATUS["product_balance"] = "product_balance";
|
|
9
|
+
})(USER_BALANCE_STATUS || (exports.USER_BALANCE_STATUS = USER_BALANCE_STATUS = {}));
|
|
@@ -8,6 +8,7 @@ exports.CategorySchema = zod_1.z.object({
|
|
|
8
8
|
name: zod_1.z.string().min(3).max(16384),
|
|
9
9
|
prompt: zod_1.z.string().min(3).max(16384),
|
|
10
10
|
placeholder: zod_1.z.nullable(zod_1.z.string()),
|
|
11
|
+
seoName: zod_1.z.string().min(3).max(16384),
|
|
11
12
|
createdAt: zod_1.z.date(),
|
|
12
13
|
updatedAt: zod_1.z.date(),
|
|
13
14
|
});
|
package/build/models/index.js
CHANGED
|
@@ -25,3 +25,4 @@ __exportStar(require("./ai-model.schema"), exports);
|
|
|
25
25
|
__exportStar(require("./product.schema"), exports);
|
|
26
26
|
__exportStar(require("./subscription.schema"), exports);
|
|
27
27
|
__exportStar(require("./order.schema"), exports);
|
|
28
|
+
__exportStar(require("./post.schema"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.PostSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
title: zod_1.z.string(),
|
|
8
|
+
alias: zod_1.z.string(),
|
|
9
|
+
image: zod_1.z.string(),
|
|
10
|
+
content: zod_1.z.string(),
|
|
11
|
+
author: zod_1.z.string(),
|
|
12
|
+
contentPreview: zod_1.z.nullable(zod_1.z.string()),
|
|
13
|
+
metaTitle: zod_1.z.nullable(zod_1.z.string()),
|
|
14
|
+
metaDescription: zod_1.z.nullable(zod_1.z.string()),
|
|
15
|
+
views: zod_1.z.number(),
|
|
16
|
+
createdAt: zod_1.z.date(),
|
|
17
|
+
updatedAt: zod_1.z.date(),
|
|
18
|
+
});
|
|
@@ -9,7 +9,7 @@ exports.UserSchema = zod_1.z.object({
|
|
|
9
9
|
password: zod_1.z.string(),
|
|
10
10
|
passwordHash: zod_1.z.string(),
|
|
11
11
|
restoreTokenHash: zod_1.z.string(),
|
|
12
|
-
tokenBonusBalance: zod_1.z.
|
|
12
|
+
tokenBonusBalance: zod_1.z.number(),
|
|
13
13
|
role: zod_1.z.string(),
|
|
14
14
|
createdAt: zod_1.z.date(),
|
|
15
15
|
updatedAt: zod_1.z.date(),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PostSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace CreatePostCommand {
|
|
5
|
+
export const RequestSchema = PostSchema.omit({
|
|
6
|
+
uuid: true,
|
|
7
|
+
views: true,
|
|
8
|
+
createdAt: true,
|
|
9
|
+
updatedAt: true,
|
|
10
|
+
});
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: PostSchema,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PostSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DeletePostCommand {
|
|
5
|
+
export const RequestSchema = PostSchema.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,20 @@
|
|
|
1
|
+
import { PostSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindPostByAliasCommand {
|
|
5
|
+
export const RequestSchema = PostSchema.pick({
|
|
6
|
+
alias: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(PostSchema),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseByAliasSchema = z.object({
|
|
18
|
+
data: PostSchema,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PostSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindPostByUUIDCommand {
|
|
5
|
+
export const RequestSchema = PostSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseByUUIDSchema = z.object({
|
|
12
|
+
data: PostSchema,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PostSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
const FindPostRequestSchema = z.object({
|
|
5
|
+
limit: z.string().transform((val) => parseInt(val, 10)),
|
|
6
|
+
offset: z.string().transform((val) => parseInt(val, 10)),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const FindPostResponseSchema = z.object({
|
|
10
|
+
posts: z.array(PostSchema),
|
|
11
|
+
totalPage: z.number(),
|
|
12
|
+
page: z.number(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export namespace FindPostCommand {
|
|
16
|
+
export const RequestSchema = FindPostRequestSchema;
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = FindPostResponseSchema;
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PostSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace UpdatePostCommand {
|
|
5
|
+
export const RequestSchema = PostSchema.omit({
|
|
6
|
+
createdAt: true,
|
|
7
|
+
updatedAt: true,
|
|
8
|
+
views: true,
|
|
9
|
+
uuid: true,
|
|
10
|
+
}).partial();
|
|
11
|
+
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const RequestParamSchema = z.object({
|
|
15
|
+
uuid: z.string().uuid(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
19
|
+
|
|
20
|
+
export const ResponseSchema = z.object({
|
|
21
|
+
data: PostSchema,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
25
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { ChatSchema } from '../../models';
|
|
1
|
+
import { ChatSchema, MessageSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace CreateChatCommand {
|
|
5
|
-
export const
|
|
5
|
+
export const RequestSchemaByParam = ChatSchema.pick({
|
|
6
6
|
categoryId: true,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
export type
|
|
9
|
+
export type RequestByParam = z.infer<typeof RequestSchemaByParam>;
|
|
10
10
|
|
|
11
11
|
export const ResponseSchema = z.object({
|
|
12
|
-
data: ChatSchema
|
|
12
|
+
data: ChatSchema.extend({
|
|
13
|
+
messages: z.array(MessageSchema),
|
|
14
|
+
}),
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatSchema } from '../../models';
|
|
1
|
+
import { ChatSchema, MessageSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace FindChatCommand {
|
|
@@ -6,6 +6,10 @@ export namespace FindChatCommand {
|
|
|
6
6
|
uuid: true,
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
+
export const RequestSchemaByParam = ChatSchema.pick({
|
|
10
|
+
categoryId: true,
|
|
11
|
+
});
|
|
12
|
+
|
|
9
13
|
export type Request = z.infer<typeof RequestSchema>;
|
|
10
14
|
|
|
11
15
|
export const RequestSchemaByQuery = z.object({
|
|
@@ -17,7 +21,11 @@ export namespace FindChatCommand {
|
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
export const ResponseSchema = z.object({
|
|
20
|
-
data: z.array(
|
|
24
|
+
data: z.array(
|
|
25
|
+
ChatSchema.extend({
|
|
26
|
+
messages: z.array(MessageSchema),
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
21
29
|
count: z.number(),
|
|
22
30
|
});
|
|
23
31
|
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { ChatSchema } from '../../models';
|
|
1
|
+
import { ChatSchema, MessageSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace GetLastActiveChatCommand {
|
|
5
|
+
export const RequestByParamSchema = ChatSchema.pick({
|
|
6
|
+
categoryId: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RequestByQuery = z.infer<typeof RequestByParamSchema>;
|
|
10
|
+
|
|
5
11
|
export const Response = z.object({
|
|
6
|
-
data:
|
|
12
|
+
data: ChatSchema.extend({
|
|
13
|
+
messages: z.array(MessageSchema),
|
|
14
|
+
}),
|
|
7
15
|
});
|
|
8
16
|
|
|
9
17
|
export type Response = z.infer<typeof Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatSchema } from '../../models';
|
|
1
|
+
import { ChatSchema, MessageSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace UpdateChatCommand {
|
|
@@ -18,7 +18,9 @@ export namespace UpdateChatCommand {
|
|
|
18
18
|
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
19
19
|
|
|
20
20
|
export const ResponseSchema = z.object({
|
|
21
|
-
data: ChatSchema
|
|
21
|
+
data: ChatSchema.extend({
|
|
22
|
+
messages: z.array(MessageSchema),
|
|
23
|
+
}),
|
|
22
24
|
});
|
|
23
25
|
|
|
24
26
|
export type Response = z.infer<typeof ResponseSchema>;
|
package/commands/index.ts
CHANGED
package/commands/user/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UserSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace UpTokenBonusBalanceCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
10
|
+
|
|
11
|
+
export const RequestSchema = z.object({
|
|
12
|
+
tokenBonusBalance: z.number(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = UserSchema.omit({
|
|
18
|
+
password: true,
|
|
19
|
+
passwordHash: true,
|
|
20
|
+
}).partial();
|
|
21
|
+
|
|
22
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
23
|
+
}
|
|
@@ -264,4 +264,129 @@ export const ERRORS = {
|
|
|
264
264
|
message: 'Произошла ошибка при обработке запроса',
|
|
265
265
|
httpCode: 500,
|
|
266
266
|
},
|
|
267
|
+
S3_CREATE_OBJECT_ERROR: {
|
|
268
|
+
code: 'A069',
|
|
269
|
+
message: 'Ошибка создания объекта в S3-хранилище',
|
|
270
|
+
httpCode: 500,
|
|
271
|
+
},
|
|
272
|
+
FILE_NOT_FOUND: {
|
|
273
|
+
code: 'A070',
|
|
274
|
+
message: 'Файл не найден',
|
|
275
|
+
httpCode: 404,
|
|
276
|
+
},
|
|
277
|
+
FILE_NOT_UPLOADED: {
|
|
278
|
+
code: 'A071',
|
|
279
|
+
message: 'Файл не загружен',
|
|
280
|
+
httpCode: 404,
|
|
281
|
+
},
|
|
282
|
+
FOLDER_NOT_FOUND: {
|
|
283
|
+
code: 'A072',
|
|
284
|
+
message: 'Директория не найдена',
|
|
285
|
+
httpCode: 404,
|
|
286
|
+
},
|
|
287
|
+
POST_CREATE_ERROR: {
|
|
288
|
+
code: 'A073',
|
|
289
|
+
message: 'Пост не был создан',
|
|
290
|
+
httpCode: 500,
|
|
291
|
+
},
|
|
292
|
+
POST_CREATE_ALIAS_CONFLICT: {
|
|
293
|
+
code: 'A074',
|
|
294
|
+
message: 'alias должен быть уникальный',
|
|
295
|
+
httpCode: 409,
|
|
296
|
+
},
|
|
297
|
+
POST_NOT_FOUND_BY_UUID: {
|
|
298
|
+
code: 'A075',
|
|
299
|
+
message: 'Пост с таким uuid не найден',
|
|
300
|
+
httpCode: 404,
|
|
301
|
+
},
|
|
302
|
+
POST_UPDATE_ERROR: {
|
|
303
|
+
code: 'A076',
|
|
304
|
+
message: 'Пост не был обновлен',
|
|
305
|
+
httpCode: 500,
|
|
306
|
+
},
|
|
307
|
+
POST_DELETE_ERROR: {
|
|
308
|
+
code: 'A077',
|
|
309
|
+
message: 'Пост не был удален',
|
|
310
|
+
httpCode: 500,
|
|
311
|
+
},
|
|
312
|
+
POST_NOT_FOUND_BY_ALIAS: {
|
|
313
|
+
code: 'A078',
|
|
314
|
+
message: 'Пост с таким alias не найден',
|
|
315
|
+
httpCode: 404,
|
|
316
|
+
},
|
|
317
|
+
POSTS_FIND_ERROR: {
|
|
318
|
+
code: 'A079',
|
|
319
|
+
message: 'Страницы не найдены',
|
|
320
|
+
httpCode: 500,
|
|
321
|
+
},
|
|
322
|
+
ADD_USER_TO_SUBSCRIPTION_ERROR: {
|
|
323
|
+
code: 'A080',
|
|
324
|
+
message: 'Не удалось добавить подписку пользователю',
|
|
325
|
+
httpCode: 500,
|
|
326
|
+
},
|
|
327
|
+
UPDATE_USER_TO_SUBSCRIPTION_ERROR: {
|
|
328
|
+
code: 'A081',
|
|
329
|
+
message: 'Не удалось обновить подписку пользователю',
|
|
330
|
+
httpCode: 500,
|
|
331
|
+
},
|
|
332
|
+
DELETE_USER_TO_SUBSCRIPTION_ERROR: {
|
|
333
|
+
code: 'A082',
|
|
334
|
+
message: 'Не удалось удалить подписку у пользователя',
|
|
335
|
+
httpCode: 500,
|
|
336
|
+
},
|
|
337
|
+
USER_TO_SUBSCRIPTION_FIND_ERROR: {
|
|
338
|
+
code: 'A083',
|
|
339
|
+
message: 'Подписка у пользователя не найдена',
|
|
340
|
+
httpCode: 404,
|
|
341
|
+
},
|
|
342
|
+
USER_TO_PRODUCT_FIND_ERROR: {
|
|
343
|
+
code: 'A085',
|
|
344
|
+
message: 'Не удалось получить продукт у пользователя',
|
|
345
|
+
httpCode: 404,
|
|
346
|
+
},
|
|
347
|
+
ADD_USER_TO_PRODUCT_ERROR: {
|
|
348
|
+
code: 'A086',
|
|
349
|
+
message: 'Не удалось добавить продукт пользователю',
|
|
350
|
+
httpCode: 500,
|
|
351
|
+
},
|
|
352
|
+
DELETE_USER_TO_PRODUCT_ERROR: {
|
|
353
|
+
code: 'A087',
|
|
354
|
+
message: 'Не удалось удалить продукт у пользователя',
|
|
355
|
+
httpCode: 500,
|
|
356
|
+
},
|
|
357
|
+
UPDATE_USER_TO_PRODUCT_ERROR: {
|
|
358
|
+
code: 'A088',
|
|
359
|
+
message: 'Не удалось обновить продукт пользователю',
|
|
360
|
+
httpCode: 500,
|
|
361
|
+
},
|
|
362
|
+
TOKEN_BALANCE_FIND_ERROR: {
|
|
363
|
+
code: 'A089',
|
|
364
|
+
message: 'Ошибка при поиске балансов пользователя ',
|
|
365
|
+
httpCode: 500,
|
|
366
|
+
},
|
|
367
|
+
TRANSACTION_CREATE_ERROR: {
|
|
368
|
+
code: 'A090',
|
|
369
|
+
message: 'Транзакция не была создана',
|
|
370
|
+
httpCode: 500,
|
|
371
|
+
},
|
|
372
|
+
TRANSACTION_UPDATE_ERROR: {
|
|
373
|
+
code: 'A091',
|
|
374
|
+
message: 'Транзакция не была обновлена',
|
|
375
|
+
httpCode: 500,
|
|
376
|
+
},
|
|
377
|
+
TRANSACTION_CHUNK_CREATE_ERROR: {
|
|
378
|
+
code: 'A92',
|
|
379
|
+
message: 'Не удалось создать чанк транзакции',
|
|
380
|
+
httpCode: 500,
|
|
381
|
+
},
|
|
382
|
+
TRANSACTION_FIND_ERROR: {
|
|
383
|
+
code: 'A093',
|
|
384
|
+
message: 'Транзакция не была найдена',
|
|
385
|
+
httpCode: 404,
|
|
386
|
+
},
|
|
387
|
+
USER_UPDATE_ERROR: {
|
|
388
|
+
code: 'A094',
|
|
389
|
+
message: 'Пользователь не был обновлен',
|
|
390
|
+
httpCode: 500,
|
|
391
|
+
},
|
|
267
392
|
};
|
package/constants/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './product-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './subscription-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
File without changes
|
package/models/index.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const PostSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
title: z.string(),
|
|
6
|
+
alias: z.string(),
|
|
7
|
+
image: z.string(),
|
|
8
|
+
content: z.string(),
|
|
9
|
+
author: z.string(),
|
|
10
|
+
contentPreview: z.nullable(z.string()),
|
|
11
|
+
metaTitle: z.nullable(z.string()),
|
|
12
|
+
metaDescription: z.nullable(z.string()),
|
|
13
|
+
views: z.number(),
|
|
14
|
+
|
|
15
|
+
createdAt: z.date(),
|
|
16
|
+
updatedAt: z.date(),
|
|
17
|
+
});
|
package/models/user.schema.ts
CHANGED