@purpleschool/gptbot 0.7.62 → 0.7.65

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 (113) hide show
  1. package/api/controllers/http/index.ts +2 -0
  2. package/api/controllers/http/promocode.ts +1 -0
  3. package/api/controllers/http/video-editor.ts +14 -0
  4. package/api/controllers/http/webmaster.ts +10 -0
  5. package/api/routes.ts +6 -0
  6. package/build/api/controllers/http/index.js +2 -0
  7. package/build/api/controllers/http/promocode.js +1 -0
  8. package/build/api/controllers/http/video-editor.js +16 -0
  9. package/build/api/controllers/http/webmaster.js +12 -0
  10. package/build/api/routes.js +5 -0
  11. package/build/commands/index.js +1 -0
  12. package/build/commands/promocode/get-webmaster-promocode.command.js +17 -0
  13. package/build/commands/promocode/index.js +1 -0
  14. package/build/commands/telegram-profile/bot-was-blocked-by-user.command.js +11 -0
  15. package/build/commands/telegram-profile/index.js +2 -0
  16. package/build/commands/telegram-profile/user-joined-telegram.command.js +11 -0
  17. package/build/commands/tools/index.js +1 -0
  18. package/build/commands/tools/video-editor/delete-all-video-editor-jobs.command.js +11 -0
  19. package/build/commands/tools/video-editor/delete-video-editor-job-by-uuid.command.js +14 -0
  20. package/build/commands/tools/video-editor/edit-video.command.js +16 -0
  21. package/build/commands/tools/video-editor/find-video-editor-job-by-id.command.js +14 -0
  22. package/build/commands/tools/video-editor/find-video-editor-jobs.command.js +18 -0
  23. package/build/commands/tools/video-editor/get-video-editor-config.command.js +14 -0
  24. package/build/commands/tools/video-editor/index.js +25 -0
  25. package/build/commands/tools/video-editor/retry-video-editor-job.command.js +14 -0
  26. package/build/commands/tools/video-editor/set-reaction-to-video-editor-job.command.js +18 -0
  27. package/build/commands/tools/video-editor/update-video-editor-job-title.command.js +17 -0
  28. package/build/commands/webmaster/confirm-withdrawal.command.js +14 -0
  29. package/build/commands/webmaster/create-webmaster.command.js +16 -0
  30. package/build/commands/webmaster/create-withdrawal-request.command.js +16 -0
  31. package/build/commands/webmaster/get-my-webmaster.command.js +11 -0
  32. package/build/commands/webmaster/get-webmaster-balance-overview.command.js +26 -0
  33. package/build/commands/webmaster/index.js +22 -0
  34. package/build/commands/webmaster/update-webmaster.command.js +13 -0
  35. package/build/constants/errors/errors.js +155 -0
  36. package/build/constants/file/enums/file-type.enum.js +1 -0
  37. package/build/constants/file/file.constants.js +4 -1
  38. package/build/constants/index.js +3 -0
  39. package/build/constants/promocode/enums/promocode-promotion.enum.js +1 -0
  40. package/build/constants/tool-video-editor/enums/index.js +17 -0
  41. package/build/constants/tool-video-editor/enums/video-editor-model-strategy.enum.js +7 -0
  42. package/build/constants/tool-video-editor/index.js +17 -0
  43. package/build/constants/webmaster/enums/index.js +17 -0
  44. package/build/constants/webmaster/enums/organization-type.enum.js +9 -0
  45. package/build/constants/webmaster/index.js +17 -0
  46. package/build/constants/webmaster-balance/enums/index.js +18 -0
  47. package/build/constants/webmaster-balance/enums/webmaster-balance-status.enum.js +10 -0
  48. package/build/constants/webmaster-balance/enums/webmaster-balance-type.enum.js +8 -0
  49. package/build/constants/webmaster-balance/index.js +17 -0
  50. package/build/helpers/index.js +1 -0
  51. package/build/helpers/video-editor/calculate-video-editing-price.helper.js +6 -0
  52. package/build/helpers/video-editor/index.js +17 -0
  53. package/build/models/index.js +2 -0
  54. package/build/models/promocode.schema.js +1 -0
  55. package/build/models/tools/index.js +1 -0
  56. package/build/models/tools/video-editor/index.js +19 -0
  57. package/build/models/tools/video-editor/video-editor-config.schema.js +8 -0
  58. package/build/models/tools/video-editor/video-editor-job.schema.js +14 -0
  59. package/build/models/tools/video-editor/video-editor-model.schema.js +25 -0
  60. package/build/models/webmaster-balance.schema.js +20 -0
  61. package/build/models/webmaster.schema.js +21 -0
  62. package/commands/index.ts +1 -0
  63. package/commands/promocode/get-webmaster-promocode.command.ts +19 -0
  64. package/commands/promocode/index.ts +1 -0
  65. package/commands/telegram-profile/bot-was-blocked-by-user.command.ts +13 -0
  66. package/commands/telegram-profile/index.ts +2 -0
  67. package/commands/telegram-profile/user-joined-telegram.command.ts +13 -0
  68. package/commands/tools/index.ts +1 -0
  69. package/commands/tools/video-editor/delete-all-video-editor-jobs.command.ts +13 -0
  70. package/commands/tools/video-editor/delete-video-editor-job-by-uuid.command.ts +16 -0
  71. package/commands/tools/video-editor/edit-video.command.ts +18 -0
  72. package/commands/tools/video-editor/find-video-editor-job-by-id.command.ts +16 -0
  73. package/commands/tools/video-editor/find-video-editor-jobs.command.ts +18 -0
  74. package/commands/tools/video-editor/get-video-editor-config.command.ts +16 -0
  75. package/commands/tools/video-editor/index.ts +9 -0
  76. package/commands/tools/video-editor/retry-video-editor-job.command.ts +16 -0
  77. package/commands/tools/video-editor/set-reaction-to-video-editor-job.command.ts +21 -0
  78. package/commands/tools/video-editor/update-video-editor-job-title.command.ts +20 -0
  79. package/commands/webmaster/confirm-withdrawal.command.ts +16 -0
  80. package/commands/webmaster/create-webmaster.command.ts +18 -0
  81. package/commands/webmaster/create-withdrawal-request.command.ts +18 -0
  82. package/commands/webmaster/get-my-webmaster.command.ts +12 -0
  83. package/commands/webmaster/get-webmaster-balance-overview.command.ts +29 -0
  84. package/commands/webmaster/index.ts +6 -0
  85. package/commands/webmaster/update-webmaster.command.ts +18 -0
  86. package/constants/errors/errors.ts +155 -0
  87. package/constants/file/enums/file-type.enum.ts +1 -0
  88. package/constants/file/file.constants.ts +4 -0
  89. package/constants/index.ts +3 -0
  90. package/constants/promocode/enums/promocode-promotion.enum.ts +1 -0
  91. package/constants/tool-video-editor/enums/index.ts +1 -0
  92. package/constants/tool-video-editor/enums/video-editor-model-strategy.enum.ts +3 -0
  93. package/constants/tool-video-editor/index.ts +1 -0
  94. package/constants/webmaster/enums/index.ts +1 -0
  95. package/constants/webmaster/enums/organization-type.enum.ts +5 -0
  96. package/constants/webmaster/index.ts +1 -0
  97. package/constants/webmaster-balance/enums/index.ts +2 -0
  98. package/constants/webmaster-balance/enums/webmaster-balance-status.enum.ts +6 -0
  99. package/constants/webmaster-balance/enums/webmaster-balance-type.enum.ts +4 -0
  100. package/constants/webmaster-balance/index.ts +1 -0
  101. package/helpers/index.ts +1 -0
  102. package/helpers/video-editor/calculate-video-editing-price.helper.ts +9 -0
  103. package/helpers/video-editor/index.ts +1 -0
  104. package/models/index.ts +2 -0
  105. package/models/promocode.schema.ts +1 -0
  106. package/models/tools/index.ts +1 -0
  107. package/models/tools/video-editor/index.ts +3 -0
  108. package/models/tools/video-editor/video-editor-config.schema.ts +6 -0
  109. package/models/tools/video-editor/video-editor-job.schema.ts +14 -0
  110. package/models/tools/video-editor/video-editor-model.schema.ts +24 -0
  111. package/models/webmaster-balance.schema.ts +16 -0
  112. package/models/webmaster.schema.ts +18 -0
  113. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { VideoEditorJobSchema } from '../../../models';
3
+
4
+ export namespace EditVideoCommand {
5
+ export const RequestSchema = z.object({
6
+ modelId: z.string().uuid(),
7
+ prompt: z.string(),
8
+ fileId: z.string().uuid(),
9
+ });
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: VideoEditorJobSchema,
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { VideoEditorJobSchema, ToolJobSchema } from '../../../models';
3
+
4
+ export namespace FindVideoEditorJobByIdCommand {
5
+ export const RequestParamsSchema = ToolJobSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: VideoEditorJobSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { VideoEditorJobSchema } from '../../../models';
3
+
4
+ export namespace FindVideoEditorJobsCommand {
5
+ export const RequestQuerySchema = z.object({
6
+ limit: z.coerce.number().min(1).optional(),
7
+ offset: z.coerce.number().min(0).default(0).optional(),
8
+ title: z.string().optional(),
9
+ });
10
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: z.array(VideoEditorJobSchema),
14
+ totalPages: z.number(),
15
+ page: z.number(),
16
+ });
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { VideoEditorModelSchema } from '../../../models';
3
+
4
+ export namespace GetVideoEditorConfigCommand {
5
+ export const RequestSchema = z.object({});
6
+
7
+ export type Request = z.infer<typeof RequestSchema>;
8
+
9
+ export const ResponseSchema = z.object({
10
+ data: z.object({
11
+ models: z.array(VideoEditorModelSchema),
12
+ }),
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,9 @@
1
+ export * from './delete-all-video-editor-jobs.command';
2
+ export * from './delete-video-editor-job-by-uuid.command';
3
+ export * from './edit-video.command';
4
+ export * from './find-video-editor-job-by-id.command';
5
+ export * from './find-video-editor-jobs.command';
6
+ export * from './get-video-editor-config.command';
7
+ export * from './retry-video-editor-job.command';
8
+ export * from './set-reaction-to-video-editor-job.command';
9
+ export * from './update-video-editor-job-title.command';
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { VideoEditorJobSchema, ToolJobSchema } from '../../../models';
3
+
4
+ export namespace RetryVideoEditorJobCommand {
5
+ export const RequestParamsSchema = ToolJobSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: VideoEditorJobSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { VideoEditorJobSchema } from '../../../models';
3
+ import { USER_REACTION } from '../../../constants';
4
+
5
+ export namespace SetReactionToVideoEditorJobCommand {
6
+ export const RequestSchema = z.object({
7
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
8
+ });
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const RequestParamsSchema = z.object({
12
+ uuid: z.string().uuid(),
13
+ });
14
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
15
+
16
+ export const ResponseSchema = z.object({
17
+ data: VideoEditorJobSchema,
18
+ });
19
+
20
+ export type Response = z.infer<typeof ResponseSchema>;
21
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { VideoEditorJobSchema } from '../../../models';
3
+
4
+ export namespace UpdateVideoEditorJobTitleCommand {
5
+ export const RequestSchema = z.object({
6
+ title: z.string(),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const RequestParamsSchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ });
13
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: VideoEditorJobSchema,
17
+ });
18
+
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { WebmasterBalanceSchema } from '../../models';
3
+
4
+ export namespace ConfirmWithdrawalCommand {
5
+ export const RequestSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: WebmasterBalanceSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { WebmasterSchema } from '../../models';
3
+
4
+ export namespace CreateWebmasterCommand {
5
+ export const RequestSchema = WebmasterSchema.pick({
6
+ organization: true,
7
+ organizationType: true,
8
+ tin: true,
9
+ });
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: WebmasterSchema,
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace CreateWithdrawalRequestCommand {
4
+ export const RequestSchema = z.object({
5
+ amount: z.number().positive(),
6
+ tgProfile: z.string(),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.object({
13
+ isSuccess: z.boolean(),
14
+ }),
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { WebmasterWithBalanceSchema } from '../../models';
3
+
4
+ export namespace GetMyWebmasterCommand {
5
+ export type Request = void;
6
+
7
+ export const ResponseSchema = z.object({
8
+ data: WebmasterWithBalanceSchema,
9
+ });
10
+
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { GROUP_BY } from '../../constants';
3
+
4
+ export namespace GetWebmasterBalanceOverviewCommand {
5
+ export const RequestSchema = z.object({
6
+ startDate: z.string().refine((v) => !isNaN(Date.parse(v)), {
7
+ message: 'from must be a valid date string',
8
+ }),
9
+ endDate: z.string().refine((v) => !isNaN(Date.parse(v)), {
10
+ message: 'to must be a valid date string',
11
+ }),
12
+ groupBy: z.nativeEnum(GROUP_BY).default(GROUP_BY.DAY),
13
+ });
14
+
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const WebmasterBalanceOverviewResponseSchema = z.object({
18
+ startDate: z.string(),
19
+ endDate: z.string(),
20
+ total_deposited: z.number(),
21
+ total_withdrawn: z.number(),
22
+ });
23
+
24
+ export const ResponseSchema = z.object({
25
+ data: z.array(WebmasterBalanceOverviewResponseSchema),
26
+ });
27
+
28
+ export type Response = z.infer<typeof ResponseSchema>;
29
+ }
@@ -0,0 +1,6 @@
1
+ export * from './create-webmaster.command';
2
+ export * from './update-webmaster.command';
3
+ export * from './get-my-webmaster.command';
4
+ export * from './get-webmaster-balance-overview.command';
5
+ export * from './create-withdrawal-request.command';
6
+ export * from './confirm-withdrawal.command';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { WebmasterSchema } from '../../models';
3
+
4
+ export namespace UpdateWebmasterCommand {
5
+ export const RequestParamSchema = WebmasterSchema.pick({ uuid: true });
6
+
7
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
8
+
9
+ export const RequestSchema = WebmasterSchema.partial();
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: WebmasterSchema,
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -2024,4 +2024,159 @@ export const ERRORS = {
2024
2024
  message: 'Ошибка при получении всех тулов',
2025
2025
  httpCode: 500,
2026
2026
  },
2027
+ VIDEO_EDITOR_CONFIG_ERROR: {
2028
+ code: 'A414',
2029
+ message: 'Произошла ошибка при получении конфигурации инструмента для редактирования видео',
2030
+ httpCode: 500,
2031
+ },
2032
+ VIDEO_EDITOR_SEND_REQUEST_ERROR: {
2033
+ code: 'A415',
2034
+ message: 'Произошла ошибка при отправке запроса на редактирование видео',
2035
+ httpCode: 500,
2036
+ },
2037
+ VIDEO_EDITOR_FIND_JOBS_ERROR: {
2038
+ code: 'A416',
2039
+ message: 'Произошла ошибка при получении списка заданий на редактирование видео',
2040
+ httpCode: 500,
2041
+ },
2042
+ VIDEO_EDITOR_FIND_JOB_ERROR: {
2043
+ code: 'A417',
2044
+ message: 'Произошла ошибка при получении задания на редактирование видео',
2045
+ httpCode: 500,
2046
+ },
2047
+ VIDEO_EDITOR_RETRY_JOB_ERROR: {
2048
+ code: 'A418',
2049
+ message: 'Произошла ошибка при повторном запросе на редактирование видео',
2050
+ httpCode: 500,
2051
+ },
2052
+ VIDEO_EDITOR_SET_REACTION_ERROR: {
2053
+ code: 'A419',
2054
+ message: 'Произошла ошибка при установке оценки задания на редактирование видео',
2055
+ httpCode: 500,
2056
+ },
2057
+ VIDEO_EDITOR_UPDATE_TITLE_ERROR: {
2058
+ code: 'A420',
2059
+ message: 'Произошла ошибка при обновлении названия задания на редактирование видео',
2060
+ httpCode: 500,
2061
+ },
2062
+ VIDEO_EDITOR_DELETE_JOB_ERROR: {
2063
+ code: 'A421',
2064
+ message: 'Произошла ошибка при удалении задания на редактирование видео',
2065
+ httpCode: 500,
2066
+ },
2067
+ VIDEO_EDITOR_DELETE_ALL_JOBS_ERROR: {
2068
+ code: 'A422',
2069
+ message: 'Произошла ошибка при удалении всех заданий на редактирование видео',
2070
+ httpCode: 500,
2071
+ },
2072
+ VIDEO_EDITOR_MODEL_NOT_FOUND: {
2073
+ code: 'A423',
2074
+ message: 'Не удалось найти указанную модель для редактирования видео',
2075
+ httpCode: 400,
2076
+ },
2077
+ VIDEO_EDITOR_MODEL_INACTIVE: {
2078
+ code: 'A424',
2079
+ message: 'Модель для редактирования видео неактивна',
2080
+ httpCode: 400,
2081
+ },
2082
+ VIDEO_EDITOR_MODEL_NOT_AVAILABLE: {
2083
+ code: 'A425',
2084
+ message: 'Модель для редактирования видео недоступна для данного пользователя',
2085
+ httpCode: 403,
2086
+ },
2087
+ VIDEO_EDITOR_FILE_SIZE_EXCEEDED: {
2088
+ code: 'A426',
2089
+ message: 'Размер файла превышает допустимый лимит для выбранной модели',
2090
+ httpCode: 400,
2091
+ },
2092
+ VIDEO_EDITOR_UNSUPPORTED_FORMAT: {
2093
+ code: 'A427',
2094
+ message: 'Формат файла не поддерживается выбранной моделью',
2095
+ httpCode: 400,
2096
+ },
2097
+ FILE_ACCESS_DENIED: {
2098
+ code: 'A428',
2099
+ message: 'Доступ к файлу запрещен',
2100
+ httpCode: 403,
2101
+ },
2102
+ VIDEO_EDITOR_FILE_DURATION_EXCEEDED: {
2103
+ code: 'A429',
2104
+ message: 'Продолжительность файла превышает допустимый лимит для выбранной модели',
2105
+ httpCode: 400,
2106
+ },
2107
+ WEBMASTER_CREATE_ERROR: {
2108
+ code: 'A430',
2109
+ message: 'Ошибка при создании вебмастера',
2110
+ httpCode: 500,
2111
+ },
2112
+ WEBMASTER_FIND_ERROR: {
2113
+ code: 'A431',
2114
+ message: 'Ошибка при получении вебмастера',
2115
+ httpCode: 500,
2116
+ },
2117
+ WEBMASTER_UPDATE_ERROR: {
2118
+ code: 'A432',
2119
+ message: 'Ошибка при обновлении вебмастера',
2120
+ httpCode: 500,
2121
+ },
2122
+ WEBMASTER_ALIAS_CONFLICT_ERROR: {
2123
+ code: 'A433',
2124
+ message: 'Выбранный alias уже занят',
2125
+ httpCode: 409,
2126
+ },
2127
+ WEBMASTER_NOT_FOUND_ERROR: {
2128
+ code: 'A434',
2129
+ message: 'Запрашиваемый вебмастер не найден',
2130
+ httpCode: 404,
2131
+ },
2132
+ WEBMASTER_OWNERSHIP_ERROR: {
2133
+ code: 'A435',
2134
+ message: 'Кабинет вебмастер не принадлежит юзеру, сделавшему запрос',
2135
+ httpCode: 401,
2136
+ },
2137
+ WEBMASTER_BALANCE_CREATE_ERROR: {
2138
+ code: 'A436',
2139
+ message: 'Ошибка при создании записи баланса вебмастера',
2140
+ httpCode: 500,
2141
+ },
2142
+ WEBMASTER_BALANCE_GET_ERROR: {
2143
+ code: 'A437',
2144
+ message: 'Ошибка при получении баланса вебмастера',
2145
+ httpCode: 500,
2146
+ },
2147
+ WEBMASTER_BALANCE_GET_OVERVIEW_ERROR: {
2148
+ code: 'A438',
2149
+ message: 'Не удалось получить историю баланса вебмастера',
2150
+ httpCode: 500,
2151
+ },
2152
+ WEBMASTER_INSUFFICIENT_BALANCE_ERROR: {
2153
+ code: 'A439',
2154
+ message: 'На балансе недостатчно средств для вывода',
2155
+ httpCode: 400,
2156
+ },
2157
+ WEBMASTER_SEND_WITHDRAWAL_REQUEST_ERROR: {
2158
+ code: 'A440',
2159
+ message: 'Произошла ошибка при отправке запроса на вывод средств в Telegram для вебмастера',
2160
+ httpCode: 500,
2161
+ },
2162
+ WEBMASTER_BALANCE_UPDATE_ERROR: {
2163
+ code: 'A441',
2164
+ message: 'Ошибка при обновлении записи баланса вебмастера',
2165
+ httpCode: 500,
2166
+ },
2167
+ WEBMASTER_PROMOCODE_CONFLICT_ERROR: {
2168
+ code: 'A442',
2169
+ message: 'Вебмастер не может создать промокод для самого себя',
2170
+ httpCode: 409,
2171
+ },
2172
+ WEBMASTER_CREATE_WITHDRAWAL_REQUEST_ERROR: {
2173
+ code: 'A443',
2174
+ message: 'Произошла ошибка при создании запроса на вывод средств для вебмастера',
2175
+ httpCode: 500,
2176
+ },
2177
+ TELEGRAM_SEND_TO_CHANNEL_ERROR: {
2178
+ code: 'A444',
2179
+ message: 'Произошла ошибка при отправке сообщения в телеграм канал',
2180
+ httpCode: 500,
2181
+ },
2027
2182
  };
@@ -3,5 +3,6 @@ export enum FILE_TYPE {
3
3
  AUDIO = 'audio',
4
4
  TEXT = 'text',
5
5
  DOCUMENT = 'document',
6
+ VIDEO = 'video',
6
7
  OTHER = 'other',
7
8
  }
@@ -4,6 +4,7 @@ export const MAX_IMAGE_UPLOAD_SIZE = 5 * 1024 * 1024; // 5 MB
4
4
  export const MAX_AUDIO_UPLOAD_SIZE = 500 * 1024 * 1024; // 500 MB
5
5
  export const MAX_TEXT_UPLOAD_SIZE = 10 * 1024 * 1024; // 10 MB
6
6
  export const MAX_DOC_UPLOAD_SIZE = 20 * 1024 * 1024; // 20 MB
7
+ export const MAX_VIDEO_UPLOAD_SIZE = 500 * 1024 * 1024; // 500 MB
7
8
 
8
9
  export const SUPPORTED_FILES = new Map<
9
10
  string,
@@ -60,6 +61,9 @@ export const SUPPORTED_FILES = new Map<
60
61
  ], //.xlsx
61
62
 
62
63
  ['application/pdf', { type: FILE_TYPE.DOCUMENT, size: MAX_DOC_UPLOAD_SIZE }],
64
+
65
+ // Video formats
66
+ ['video/mp4', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE }],
63
67
  ]);
64
68
 
65
69
  export const DELETE_UNUSED_FILES_AFTER_HOURS = 12;
@@ -31,8 +31,11 @@ export * from './promocode';
31
31
  export * from './ui-notification';
32
32
  export * from './review';
33
33
  export * from './tool-video';
34
+ export * from './tool-video-editor';
34
35
  export * from './writer';
35
36
  export * from './tool-image-editor';
36
37
  export * from './feedback';
37
38
  export * from './daily-streak';
38
39
  export * from './cabinet';
40
+ export * from './webmaster';
41
+ export * from './webmaster-balance';
@@ -2,4 +2,5 @@ export enum PROMOCODE_PROMOTION {
2
2
  BONUS = 'bonus',
3
3
  CHAT_UPSELL = 'chat_upsell',
4
4
  DAILY_STREAK = 'daily_streak',
5
+ WEBMASTER = 'webmaster',
5
6
  }
@@ -0,0 +1 @@
1
+ export * from './video-editor-model-strategy.enum';
@@ -0,0 +1,3 @@
1
+ export enum VIDEO_EDITOR_MODEL_STRATEGY {
2
+ LUMA_MODIFY_POLLING = 'LUMA_MODIFY_POLLING',
3
+ }
@@ -0,0 +1 @@
1
+ export * from './enums';
@@ -0,0 +1 @@
1
+ export * from './organization-type.enum';
@@ -0,0 +1,5 @@
1
+ export enum ORGANIZATION_TYPE {
2
+ INDIVIDUAL_ENTREPRENEUR = 'ИП',
3
+ LEGAL_ENTITY = 'Юридическое лицо',
4
+ SELF_EMPLOYED = 'Самозанятый',
5
+ }
@@ -0,0 +1 @@
1
+ export * from './enums';
@@ -0,0 +1,2 @@
1
+ export * from './webmaster-balance-type.enum';
2
+ export * from './webmaster-balance-status.enum';
@@ -0,0 +1,6 @@
1
+ export enum WEBMASTER_BALANCE_STATUS {
2
+ SUCCESS = 'success',
3
+ AWAITING_CONFIRMATION = 'awaiting_confirmation',
4
+ CANCELLED = 'cancelled',
5
+ TELEGRAM_ERROR = 'telegram_error',
6
+ }
@@ -0,0 +1,4 @@
1
+ export enum WEBMASTER_BALANCE_TYPE {
2
+ DEPOSIT = 'deposit',
3
+ WITHDRAWAL = 'withdrawal',
4
+ }
@@ -0,0 +1 @@
1
+ export * from './enums';
package/helpers/index.ts CHANGED
@@ -3,4 +3,5 @@ export * from './stt';
3
3
  export * from './subscription';
4
4
  export * from './tts';
5
5
  export * from './video';
6
+ export * from './video-editor';
6
7
  export * from './writer';
@@ -0,0 +1,9 @@
1
+ export function calculateVideoEditingPrice({
2
+ duration,
3
+ pricePerSecond,
4
+ }: {
5
+ duration: number;
6
+ pricePerSecond: number;
7
+ }): number {
8
+ return Math.ceil(duration * pricePerSecond);
9
+ }
@@ -0,0 +1 @@
1
+ export * from './calculate-video-editing-price.helper';
package/models/index.ts CHANGED
@@ -50,3 +50,5 @@ export * from './folder.schema';
50
50
  export * from './filters.schema';
51
51
  export * from './users-filter-notification.schema';
52
52
  export * from './daily-streak';
53
+ export * from './webmaster.schema';
54
+ export * from './webmaster-balance.schema';
@@ -13,6 +13,7 @@ export const PromocodeSchema = z.object({
13
13
  endDate: z.date().nullable(),
14
14
  userId: z.string().uuid().nullable(),
15
15
  unregisteredUserId: z.string().uuid().nullable(),
16
+ webmasterId: z.string().uuid().nullable(),
16
17
 
17
18
  createdAt: z.date(),
18
19
  updatedAt: z.date(),
@@ -5,3 +5,4 @@ export * from './tts';
5
5
  export * from './video';
6
6
  export * from './writer';
7
7
  export * from './image-editor';
8
+ export * from './video-editor';
@@ -0,0 +1,3 @@
1
+ export * from './video-editor-config.schema';
2
+ export * from './video-editor-job.schema';
3
+ export * from './video-editor-model.schema';
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ import { VideoEditorModelSchema } from './video-editor-model.schema';
3
+
4
+ export const VideoEditorConfigSchema = z.object({
5
+ models: z.array(VideoEditorModelSchema),
6
+ });
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { ToolJobSchema } from '../../tool-job.schema';
3
+ import { USER_REACTION } from '../../../constants';
4
+
5
+ export const VideoEditorJobSchema = ToolJobSchema.extend({
6
+ title: z.string(),
7
+ prompt: z.string(),
8
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
9
+ inputVideoUrl: z.string(),
10
+ outputVideoUrl: z.string().nullable(),
11
+ modelId: z.string(),
12
+ });
13
+
14
+ export type VideoEditorJob = z.infer<typeof VideoEditorJobSchema>;
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema } from '../../icon-variants.schema';
3
+ import { UnlockedBySchema } from '../../unlocked-by-subscription.schema';
4
+
5
+ export const VideoEditorModelParamsSchema = z.object({
6
+ supportedFormats: z.array(z.string()),
7
+ });
8
+
9
+ export const VideoEditorModelSchema = z.object({
10
+ uuid: z.string(),
11
+ title: z.string(),
12
+ description: z.string(),
13
+ aiModel: z.string(),
14
+ pricePerSecond: z.number(),
15
+ order: z.number(),
16
+ icons: IconVariantsSchema,
17
+ maxPromptLength: z.number(),
18
+ maxInputVideoSizeBytes: z.number(),
19
+ supportedFormats: z.array(z.string()),
20
+ createdAt: z.date(),
21
+ updatedAt: z.date(),
22
+ unlockedBy: UnlockedBySchema.nullable(),
23
+ canUse: z.boolean(),
24
+ });
@@ -0,0 +1,16 @@
1
+ import z from 'zod';
2
+ import { WEBMASTER_BALANCE_STATUS, WEBMASTER_BALANCE_TYPE } from '../constants';
3
+
4
+ export const WebmasterBalanceSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ webmasterId: z.string().uuid(),
7
+ orderId: z.string().uuid().nullable(),
8
+ promocodeId: z.string().uuid().nullable(),
9
+ sourceUserId: z.string().uuid().nullable(),
10
+ amount: z.number(),
11
+ type: z.nativeEnum(WEBMASTER_BALANCE_TYPE),
12
+ status: z.nativeEnum(WEBMASTER_BALANCE_STATUS),
13
+
14
+ createdAt: z.date(),
15
+ updatedAt: z.date(),
16
+ });