@purpleschool/gptbot 0.8.3 → 0.8.6
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/http/index.ts +1 -0
- package/api/controllers/http/user-profile.ts +8 -0
- package/api/routes.ts +6 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/controllers/http/user-profile.js +10 -0
- package/build/api/routes.js +6 -0
- package/build/commands/index.js +1 -0
- package/build/commands/user-profile/delete-avatar.command.js +12 -0
- package/build/commands/user-profile/get-user-profile-by-user-id.command.js +14 -0
- package/build/commands/user-profile/index.js +20 -0
- package/build/commands/user-profile/update-profile.command.js +14 -0
- package/build/commands/user-profile/upload-avatar.command.js +12 -0
- package/build/commands/webmaster-click/get-webmaster-clicks-overview.command.js +3 -5
- package/build/constants/errors/errors.js +15 -4
- package/build/constants/index.js +1 -0
- package/build/constants/user-profile/index.js +17 -0
- package/build/constants/user-profile/user-profile.constant.js +10 -0
- package/build/models/index.js +1 -0
- package/build/models/user-profile.schema.js +16 -0
- package/commands/index.ts +1 -0
- package/commands/user-profile/delete-avatar.command.ts +14 -0
- package/commands/user-profile/get-user-profile-by-user-id.command.ts +16 -0
- package/commands/user-profile/index.ts +4 -0
- package/commands/user-profile/update-profile.command.ts +16 -0
- package/commands/user-profile/upload-avatar.command.ts +14 -0
- package/commands/webmaster-click/get-webmaster-clicks-overview.command.ts +3 -7
- package/constants/errors/errors.ts +15 -4
- package/constants/index.ts +1 -0
- package/constants/user-profile/index.ts +1 -0
- package/constants/user-profile/user-profile.constant.ts +14 -0
- package/models/index.ts +1 -0
- package/models/user-profile.schema.ts +15 -0
- package/package.json +1 -1
package/api/routes.ts
CHANGED
|
@@ -796,4 +796,10 @@ export const REST_API = {
|
|
|
796
796
|
CLOUD_PAYMENTS: {
|
|
797
797
|
CALLBACK: `${ROOT}/${CONTROLLERS.CLOUD_PAYMENTS_CONTROLLER}/${CONTROLLERS.CLOUD_PAYMENTS_ROUTES.CALLBACK}`,
|
|
798
798
|
},
|
|
799
|
+
USER_PROFILE: {
|
|
800
|
+
GET_PROFILE_INFO: `${ROOT}/${CONTROLLERS.USER_PROFILE_CONTROLLER}/${CONTROLLERS.USER_PROFILE_ROUTES.GET_PROFILE_INFO}`,
|
|
801
|
+
UPLOAD_AVATAR: `${ROOT}/${CONTROLLERS.USER_PROFILE_CONTROLLER}/${CONTROLLERS.USER_PROFILE_ROUTES.UPLOAD_AVATAR}`,
|
|
802
|
+
UPDATE_PROFILE: `${ROOT}/${CONTROLLERS.USER_PROFILE_CONTROLLER}/${CONTROLLERS.USER_PROFILE_ROUTES.UPDATE_PROFILE}`,
|
|
803
|
+
DELETE_AVATAR: `${ROOT}/${CONTROLLERS.USER_PROFILE_CONTROLLER}/${CONTROLLERS.USER_PROFILE_ROUTES.DELETE_AVATAR}`,
|
|
804
|
+
},
|
|
799
805
|
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USER_PROFILE_ROUTES = exports.USER_PROFILE_CONTROLLER = void 0;
|
|
4
|
+
exports.USER_PROFILE_CONTROLLER = 'user-profile';
|
|
5
|
+
exports.USER_PROFILE_ROUTES = {
|
|
6
|
+
GET_PROFILE_INFO: 'profile',
|
|
7
|
+
UPDATE_PROFILE: 'profile',
|
|
8
|
+
UPLOAD_AVATAR: 'upload-avatar',
|
|
9
|
+
DELETE_AVATAR: 'avatar',
|
|
10
|
+
};
|
package/build/api/routes.js
CHANGED
|
@@ -625,4 +625,10 @@ exports.REST_API = {
|
|
|
625
625
|
CLOUD_PAYMENTS: {
|
|
626
626
|
CALLBACK: `${exports.ROOT}/${CONTROLLERS.CLOUD_PAYMENTS_CONTROLLER}/${CONTROLLERS.CLOUD_PAYMENTS_ROUTES.CALLBACK}`,
|
|
627
627
|
},
|
|
628
|
+
USER_PROFILE: {
|
|
629
|
+
GET_PROFILE_INFO: `${exports.ROOT}/${CONTROLLERS.USER_PROFILE_CONTROLLER}/${CONTROLLERS.USER_PROFILE_ROUTES.GET_PROFILE_INFO}`,
|
|
630
|
+
UPLOAD_AVATAR: `${exports.ROOT}/${CONTROLLERS.USER_PROFILE_CONTROLLER}/${CONTROLLERS.USER_PROFILE_ROUTES.UPLOAD_AVATAR}`,
|
|
631
|
+
UPDATE_PROFILE: `${exports.ROOT}/${CONTROLLERS.USER_PROFILE_CONTROLLER}/${CONTROLLERS.USER_PROFILE_ROUTES.UPDATE_PROFILE}`,
|
|
632
|
+
DELETE_AVATAR: `${exports.ROOT}/${CONTROLLERS.USER_PROFILE_CONTROLLER}/${CONTROLLERS.USER_PROFILE_ROUTES.DELETE_AVATAR}`,
|
|
633
|
+
},
|
|
628
634
|
};
|
package/build/commands/index.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteAvatarCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var DeleteAvatarCommand;
|
|
7
|
+
(function (DeleteAvatarCommand) {
|
|
8
|
+
DeleteAvatarCommand.RequestSchema = zod_1.z.object({});
|
|
9
|
+
DeleteAvatarCommand.ResponseSchema = zod_1.z.object({
|
|
10
|
+
data: models_1.UserProfileResponseSchema,
|
|
11
|
+
});
|
|
12
|
+
})(DeleteAvatarCommand || (exports.DeleteAvatarCommand = DeleteAvatarCommand = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUserProfileByUserIdCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var GetUserProfileByUserIdCommand;
|
|
7
|
+
(function (GetUserProfileByUserIdCommand) {
|
|
8
|
+
GetUserProfileByUserIdCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
userId: zod_1.z.string().uuid(),
|
|
10
|
+
});
|
|
11
|
+
GetUserProfileByUserIdCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: models_1.UserProfileResponseSchema,
|
|
13
|
+
});
|
|
14
|
+
})(GetUserProfileByUserIdCommand || (exports.GetUserProfileByUserIdCommand = GetUserProfileByUserIdCommand = {}));
|
|
@@ -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("./get-user-profile-by-user-id.command"), exports);
|
|
18
|
+
__exportStar(require("./upload-avatar.command"), exports);
|
|
19
|
+
__exportStar(require("./update-profile.command"), exports);
|
|
20
|
+
__exportStar(require("./delete-avatar.command"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateProfileCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var UpdateProfileCommand;
|
|
7
|
+
(function (UpdateProfileCommand) {
|
|
8
|
+
UpdateProfileCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
name: zod_1.z.string().min(1).max(100).optional(),
|
|
10
|
+
});
|
|
11
|
+
UpdateProfileCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: models_1.UserProfileResponseSchema,
|
|
13
|
+
});
|
|
14
|
+
})(UpdateProfileCommand || (exports.UpdateProfileCommand = UpdateProfileCommand = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UploadAvatarCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var UploadAvatarCommand;
|
|
7
|
+
(function (UploadAvatarCommand) {
|
|
8
|
+
UploadAvatarCommand.RequestSchema = zod_1.z.object({});
|
|
9
|
+
UploadAvatarCommand.ResponseSchema = zod_1.z.object({
|
|
10
|
+
data: models_1.UserProfileResponseSchema,
|
|
11
|
+
});
|
|
12
|
+
})(UploadAvatarCommand || (exports.UploadAvatarCommand = UploadAvatarCommand = {}));
|
|
@@ -15,11 +15,9 @@ var GetWebmasterClicksOverviewCommand;
|
|
|
15
15
|
groupBy: zod_1.z.nativeEnum(constants_1.GROUP_BY).default(constants_1.GROUP_BY.DAY),
|
|
16
16
|
});
|
|
17
17
|
GetWebmasterClicksOverviewCommand.WebmasterClickOverviewResponseSchema = zod_1.z.object({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
clicks: zod_1.z.number(),
|
|
22
|
-
})),
|
|
18
|
+
startDate: zod_1.z.string(),
|
|
19
|
+
endDate: zod_1.z.string(),
|
|
20
|
+
clicks: zod_1.z.number(),
|
|
23
21
|
});
|
|
24
22
|
GetWebmasterClicksOverviewCommand.ResponseSchema = zod_1.z.object({
|
|
25
23
|
data: zod_1.z.array(GetWebmasterClicksOverviewCommand.WebmasterClickOverviewResponseSchema),
|
|
@@ -9,18 +9,16 @@ exports.ERRORS = {
|
|
|
9
9
|
message: 'Произошла ошибка при создании пользователя',
|
|
10
10
|
httpCode: 500,
|
|
11
11
|
},
|
|
12
|
-
LOGIN_ERROR: { code: 'U02', message: 'Неверный логин или пароль', httpCode: 401 },
|
|
13
12
|
RESTORE_PASSWORD: {
|
|
14
13
|
code: 'U03',
|
|
15
14
|
message: 'Возникла ошибка при восстановлении пароля',
|
|
16
15
|
httpCode: 401,
|
|
17
16
|
},
|
|
18
|
-
|
|
17
|
+
AUTH_ERROR: {
|
|
19
18
|
code: 'U02',
|
|
20
|
-
message: 'Неверный пароль',
|
|
19
|
+
message: 'Неверный логин или пароль',
|
|
21
20
|
httpCode: 401,
|
|
22
21
|
},
|
|
23
|
-
REGISTER_ERROR: { code: 'U01', message: 'Произошла ошибка при регистрации', httpCode: 500 },
|
|
24
22
|
REGISTER_CONFLICT: { code: 'U04', message: 'Пользователь уже зарегистрирован', httpCode: 409 },
|
|
25
23
|
USER_NOT_FOUND: { code: 'A002', message: 'Пользователь не найден', httpCode: 404 },
|
|
26
24
|
USER_CONFLICT: {
|
|
@@ -1222,6 +1220,7 @@ exports.ERRORS = {
|
|
|
1222
1220
|
TTS_MAX_SYMBOLS_EXCEEDED: {
|
|
1223
1221
|
code: 'A259',
|
|
1224
1222
|
message: 'Превышена максимальная количество символов',
|
|
1223
|
+
httpCode: 400,
|
|
1225
1224
|
},
|
|
1226
1225
|
TTS_SET_REACTION_ERROR: {
|
|
1227
1226
|
code: 'A260',
|
|
@@ -1531,6 +1530,7 @@ exports.ERRORS = {
|
|
|
1531
1530
|
VIDEO_MAX_SYMBOLS_EXCEEDED: {
|
|
1532
1531
|
code: 'A319',
|
|
1533
1532
|
message: 'Превышена максимальная количество символов',
|
|
1533
|
+
httpCode: 400,
|
|
1534
1534
|
},
|
|
1535
1535
|
VIDEO_SET_REACTION_ERROR: {
|
|
1536
1536
|
code: 'A320',
|
|
@@ -1675,6 +1675,7 @@ exports.ERRORS = {
|
|
|
1675
1675
|
IMAGE_EDITOR_MAX_SYMBOLS_EXCEEDED: {
|
|
1676
1676
|
code: 'A348',
|
|
1677
1677
|
message: 'Превышена максимальная количество символов',
|
|
1678
|
+
httpCode: 400,
|
|
1678
1679
|
},
|
|
1679
1680
|
IMAGE_EDITOR_SET_REACTION_ERROR: {
|
|
1680
1681
|
code: 'A349',
|
|
@@ -2356,4 +2357,14 @@ exports.ERRORS = {
|
|
|
2356
2357
|
message: 'Ошибка при обновлении записи о переходе по ссылке вебмастера',
|
|
2357
2358
|
httpCode: 500,
|
|
2358
2359
|
},
|
|
2360
|
+
USER_PROFILE_NOT_FOUND: {
|
|
2361
|
+
code: 'A482',
|
|
2362
|
+
message: 'Профиль пользователя не найден или пуст',
|
|
2363
|
+
httpCode: 404,
|
|
2364
|
+
},
|
|
2365
|
+
USER_PROFILE_UPSERT_ERROR: {
|
|
2366
|
+
code: 'A483',
|
|
2367
|
+
message: 'Ошибка при обновлении профиля пользователя',
|
|
2368
|
+
httpCode: 500,
|
|
2369
|
+
},
|
|
2359
2370
|
};
|
package/build/constants/index.js
CHANGED
|
@@ -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("./user-profile.constant"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUPPORTED_AVATAR_FILES = void 0;
|
|
4
|
+
const file_1 = require("../file");
|
|
5
|
+
const enums_1 = require("../file/enums");
|
|
6
|
+
exports.SUPPORTED_AVATAR_FILES = new Map([
|
|
7
|
+
['image/jpeg', { type: enums_1.FILE_TYPE.IMAGE, size: file_1.MAX_IMAGE_UPLOAD_SIZE }],
|
|
8
|
+
['image/png', { type: enums_1.FILE_TYPE.IMAGE, size: file_1.MAX_IMAGE_UPLOAD_SIZE }],
|
|
9
|
+
['image/webp', { type: enums_1.FILE_TYPE.IMAGE, size: file_1.MAX_IMAGE_UPLOAD_SIZE }],
|
|
10
|
+
]);
|
package/build/models/index.js
CHANGED
|
@@ -70,3 +70,4 @@ __exportStar(require("./webmaster.schema"), exports);
|
|
|
70
70
|
__exportStar(require("./webmaster-balance.schema"), exports);
|
|
71
71
|
__exportStar(require("./user-referrals.schema"), exports);
|
|
72
72
|
__exportStar(require("./webmaster-click.schema"), exports);
|
|
73
|
+
__exportStar(require("./user-profile.schema"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserProfileResponseSchema = exports.UserProfileSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UserProfileSchema = zod_1.z.object({
|
|
6
|
+
userId: zod_1.z.string().uuid(),
|
|
7
|
+
name: zod_1.z.string().nullable(),
|
|
8
|
+
avatarUrl: zod_1.z.string().url().nullable(),
|
|
9
|
+
avatarKey: zod_1.z.string().nullable(),
|
|
10
|
+
createdAt: zod_1.z.date(),
|
|
11
|
+
updatedAt: zod_1.z.date(),
|
|
12
|
+
});
|
|
13
|
+
exports.UserProfileResponseSchema = exports.UserProfileSchema.omit({
|
|
14
|
+
createdAt: true,
|
|
15
|
+
updatedAt: true,
|
|
16
|
+
});
|
package/commands/index.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserProfileResponseSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteAvatarCommand {
|
|
5
|
+
export const RequestSchema = z.object({});
|
|
6
|
+
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: UserProfileResponseSchema,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserProfileResponseSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetUserProfileByUserIdCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: UserProfileResponseSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserProfileResponseSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateProfileCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
name: z.string().min(1).max(100).optional(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: UserProfileResponseSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserProfileResponseSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UploadAvatarCommand {
|
|
5
|
+
export const RequestSchema = z.object({});
|
|
6
|
+
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: UserProfileResponseSchema,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -15,13 +15,9 @@ export namespace GetWebmasterClicksOverviewCommand {
|
|
|
15
15
|
export type Request = z.infer<typeof RequestSchema>;
|
|
16
16
|
|
|
17
17
|
export const WebmasterClickOverviewResponseSchema = z.object({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
endDate: z.string(),
|
|
22
|
-
clicks: z.number(),
|
|
23
|
-
}),
|
|
24
|
-
),
|
|
18
|
+
startDate: z.string(),
|
|
19
|
+
endDate: z.string(),
|
|
20
|
+
clicks: z.number(),
|
|
25
21
|
});
|
|
26
22
|
|
|
27
23
|
export const ResponseSchema = z.object({
|
|
@@ -6,18 +6,16 @@ export const ERRORS = {
|
|
|
6
6
|
message: 'Произошла ошибка при создании пользователя',
|
|
7
7
|
httpCode: 500,
|
|
8
8
|
},
|
|
9
|
-
LOGIN_ERROR: { code: 'U02', message: 'Неверный логин или пароль', httpCode: 401 },
|
|
10
9
|
RESTORE_PASSWORD: {
|
|
11
10
|
code: 'U03',
|
|
12
11
|
message: 'Возникла ошибка при восстановлении пароля',
|
|
13
12
|
httpCode: 401,
|
|
14
13
|
},
|
|
15
|
-
|
|
14
|
+
AUTH_ERROR: {
|
|
16
15
|
code: 'U02',
|
|
17
|
-
message: 'Неверный пароль',
|
|
16
|
+
message: 'Неверный логин или пароль',
|
|
18
17
|
httpCode: 401,
|
|
19
18
|
},
|
|
20
|
-
REGISTER_ERROR: { code: 'U01', message: 'Произошла ошибка при регистрации', httpCode: 500 },
|
|
21
19
|
REGISTER_CONFLICT: { code: 'U04', message: 'Пользователь уже зарегистрирован', httpCode: 409 },
|
|
22
20
|
USER_NOT_FOUND: { code: 'A002', message: 'Пользователь не найден', httpCode: 404 },
|
|
23
21
|
USER_CONFLICT: {
|
|
@@ -1226,6 +1224,7 @@ export const ERRORS = {
|
|
|
1226
1224
|
TTS_MAX_SYMBOLS_EXCEEDED: {
|
|
1227
1225
|
code: 'A259',
|
|
1228
1226
|
message: 'Превышена максимальная количество символов',
|
|
1227
|
+
httpCode: 400,
|
|
1229
1228
|
},
|
|
1230
1229
|
TTS_SET_REACTION_ERROR: {
|
|
1231
1230
|
code: 'A260',
|
|
@@ -1536,6 +1535,7 @@ export const ERRORS = {
|
|
|
1536
1535
|
VIDEO_MAX_SYMBOLS_EXCEEDED: {
|
|
1537
1536
|
code: 'A319',
|
|
1538
1537
|
message: 'Превышена максимальная количество символов',
|
|
1538
|
+
httpCode: 400,
|
|
1539
1539
|
},
|
|
1540
1540
|
VIDEO_SET_REACTION_ERROR: {
|
|
1541
1541
|
code: 'A320',
|
|
@@ -1681,6 +1681,7 @@ export const ERRORS = {
|
|
|
1681
1681
|
IMAGE_EDITOR_MAX_SYMBOLS_EXCEEDED: {
|
|
1682
1682
|
code: 'A348',
|
|
1683
1683
|
message: 'Превышена максимальная количество символов',
|
|
1684
|
+
httpCode: 400,
|
|
1684
1685
|
},
|
|
1685
1686
|
IMAGE_EDITOR_SET_REACTION_ERROR: {
|
|
1686
1687
|
code: 'A349',
|
|
@@ -2364,4 +2365,14 @@ export const ERRORS = {
|
|
|
2364
2365
|
message: 'Ошибка при обновлении записи о переходе по ссылке вебмастера',
|
|
2365
2366
|
httpCode: 500,
|
|
2366
2367
|
},
|
|
2368
|
+
USER_PROFILE_NOT_FOUND: {
|
|
2369
|
+
code: 'A482',
|
|
2370
|
+
message: 'Профиль пользователя не найден или пуст',
|
|
2371
|
+
httpCode: 404,
|
|
2372
|
+
},
|
|
2373
|
+
USER_PROFILE_UPSERT_ERROR: {
|
|
2374
|
+
code: 'A483',
|
|
2375
|
+
message: 'Ошибка при обновлении профиля пользователя',
|
|
2376
|
+
httpCode: 500,
|
|
2377
|
+
},
|
|
2367
2378
|
};
|
package/constants/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './user-profile.constant';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MAX_IMAGE_UPLOAD_SIZE } from '../file';
|
|
2
|
+
import { FILE_TYPE } from '../file/enums';
|
|
3
|
+
|
|
4
|
+
export const SUPPORTED_AVATAR_FILES = new Map<
|
|
5
|
+
string,
|
|
6
|
+
{
|
|
7
|
+
type: FILE_TYPE;
|
|
8
|
+
size: number;
|
|
9
|
+
}
|
|
10
|
+
>([
|
|
11
|
+
['image/jpeg', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
12
|
+
['image/png', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
13
|
+
['image/webp', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
14
|
+
]);
|
package/models/index.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const UserProfileSchema = z.object({
|
|
4
|
+
userId: z.string().uuid(),
|
|
5
|
+
name: z.string().nullable(),
|
|
6
|
+
avatarUrl: z.string().url().nullable(),
|
|
7
|
+
avatarKey: z.string().nullable(),
|
|
8
|
+
createdAt: z.date(),
|
|
9
|
+
updatedAt: z.date(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const UserProfileResponseSchema = UserProfileSchema.omit({
|
|
13
|
+
createdAt: true,
|
|
14
|
+
updatedAt: true,
|
|
15
|
+
});
|