@purpleschool/gptbot-tools 0.0.78 → 0.0.79-ai-proxy
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/ai-proxy/index.ts +1 -0
- package/ai-proxy/routes/ai-proxy.routes.ts +8 -0
- package/ai-proxy/routes/index.ts +1 -0
- package/ai-vendor/index.ts +1 -0
- package/ai-vendor/models/ai-vendor.schema.ts +13 -0
- package/ai-vendor/models/index.ts +1 -0
- package/build/ai-proxy/index.js +17 -0
- package/build/ai-proxy/routes/ai-proxy.routes.js +10 -0
- package/build/ai-proxy/routes/index.js +17 -0
- package/build/ai-vendor/index.js +17 -0
- package/build/ai-vendor/models/ai-vendor.schema.js +13 -0
- package/build/ai-vendor/models/index.js +17 -0
- package/build/common/errors/errors.js +158 -0
- package/build/common/models/attached-file.schema.js +13 -0
- package/build/common/models/index.js +1 -0
- package/build/image-editor/commands/image-editor.command.js +3 -1
- package/build/image-editor/commands/retry-image-editor-job.command.js +4 -0
- package/build/image-editor/commands/set-reaction-to-image-editor-job.command.js +12 -2
- package/build/image-editor/enums/image-editor-model-type.enum.js +2 -0
- package/build/image-editor/enums/image-editor-strategy.enum.js +4 -0
- package/build/image-editor/models/image-editor-config.schema.js +1 -0
- package/build/image-editor/models/image-editor-job.schema.js +2 -0
- package/build/image-editor/models/image-editor-model.schema.js +9 -1
- package/build/image-editor/routes/image-editor.http.routes.js +1 -0
- package/build/image-generation/commands/execute-image-generation.command.js +20 -0
- package/build/image-generation/commands/forward-image-generation-job.command.js +32 -0
- package/build/image-generation/commands/index.js +23 -0
- package/build/image-generation/commands/save-image-generation-job.command.js +17 -0
- package/build/image-generation/commands/set-reaction-to-image-generation-job.command.js +27 -0
- package/build/image-generation/commands/soft-delete-image-generation-job-by-uuid.command.js +14 -0
- package/build/image-generation/commands/soft-delete-image-generation-jobs-by-criteria.command.js +13 -0
- package/build/image-generation/commands/update-image-generation-job-title.command.js +16 -0
- package/build/image-generation/enums/image-generation-model-strategy.enum.js +23 -0
- package/build/image-generation/enums/image-generation-models.enum.js +8 -0
- package/build/image-generation/enums/image-generation-resolution.enum.js +9 -0
- package/build/image-generation/enums/index.js +19 -0
- package/build/image-generation/index.js +21 -0
- package/build/image-generation/models/image-generation-config.schema.js +12 -0
- package/build/image-generation/models/image-generation-job.schema.js +35 -0
- package/build/image-generation/models/image-generation-model.schema.js +51 -0
- package/build/image-generation/models/image-generation-preset.schema.js +13 -0
- package/build/image-generation/models/index.js +20 -0
- package/build/image-generation/queries/find-image-generation-job-by-id.query.js +19 -0
- package/build/image-generation/queries/find-image-generation-jobs.query.js +28 -0
- package/build/image-generation/queries/get-image-generation-config.query.js +11 -0
- package/build/image-generation/queries/index.js +19 -0
- package/build/image-generation/routes/image-generation.amqp.routes.js +14 -0
- package/build/image-generation/routes/image-generation.http.routes.js +9 -0
- package/build/image-generation/routes/index.js +18 -0
- package/build/index.js +7 -0
- package/build/music/commands/retry-music-job.command.js +2 -0
- package/build/music/commands/set-reaction-to-music-job.command.js +12 -2
- package/build/music/models/music-job.schema.js +1 -0
- package/build/music/models/music-track.schema.js +1 -0
- package/build/music/routes/music.http.routes.js +1 -4
- package/build/paraphrase/commands/delete-all-paraphrase-jobs.command.js +13 -0
- package/build/paraphrase/commands/delete-paraphrase-job-by-uuid.command.js +14 -0
- package/build/paraphrase/commands/index.js +5 -0
- package/build/paraphrase/commands/retry-paraphrase-job.command.js +16 -0
- package/build/paraphrase/commands/set-reaction-to-paraphrase-job.command.js +27 -0
- package/build/paraphrase/commands/update-paraphrase-job-title.command.js +16 -0
- package/build/paraphrase/models/paraphrase-job.schema.js +7 -0
- package/build/paraphrase/queries/find-paraphrase-jobs.query.js +28 -0
- package/build/paraphrase/queries/index.js +1 -0
- package/build/paraphrase/routes/paraphrase.amqp.routes.js +6 -0
- package/build/presentation/commands/index.js +1 -0
- package/build/presentation/commands/set-reaction-to-presentation.command.js +26 -0
- package/build/presentation/models/pptx-export-payload.js +19 -1
- package/build/presentation/models/presentation.schema.js +3 -0
- package/build/presentation/models/slide-content.schema.js +7 -3
- package/build/presentation/routes/presentation.routes.js +1 -0
- package/build/stt/commands/set-reaction-to-stt-job.command.js +12 -2
- package/build/stt/models/stt-job.schema.js +2 -0
- package/build/tools/enums/tool-content-type.enum.js +1 -0
- package/build/tools/enums/tool-type.enum.js +1 -0
- package/build/tools/models/global-tools-config.schema.js +2 -0
- package/build/tools/models/tools-with-configs.schema.js +5 -0
- package/build/tts/commands/set-reaction-to-tts-job.command.js +12 -2
- package/build/tts/models/tts-job.schema.js +2 -0
- package/build/video/commands/retry-video-job.command.js +4 -0
- package/build/video/commands/set-reaction-to-video-job.command.js +12 -2
- package/build/video/models/video-job.schema.js +3 -0
- package/build/video/models/video-model.schema.js +1 -0
- package/build/video-editor/commands/edit-video.command.js +2 -1
- package/build/video-editor/commands/retry-video-editor-job.command.js +5 -0
- package/build/video-editor/commands/set-reaction-to-video-editor-job.command.js +12 -2
- package/build/video-editor/models/video-editor-job.schema.js +3 -0
- package/build/writer/commands/set-reaction-writer-document.command.js +11 -1
- package/build/writer/models/writer-document.schema.js +1 -0
- package/common/errors/errors.ts +158 -0
- package/common/models/attached-file.schema.ts +11 -0
- package/common/models/index.ts +1 -0
- package/image-editor/commands/image-editor.command.ts +3 -1
- package/image-editor/commands/retry-image-editor-job.command.ts +5 -1
- package/image-editor/commands/set-reaction-to-image-editor-job.command.ts +19 -6
- package/image-editor/enums/image-editor-model-type.enum.ts +2 -0
- package/image-editor/enums/image-editor-strategy.enum.ts +4 -0
- package/image-editor/models/image-editor-config.schema.ts +1 -0
- package/image-editor/models/image-editor-job.schema.ts +3 -1
- package/image-editor/models/image-editor-model.schema.ts +16 -0
- package/image-editor/routes/image-editor.http.routes.ts +1 -0
- package/image-generation/commands/execute-image-generation.command.ts +20 -0
- package/image-generation/commands/forward-image-generation-job.command.ts +32 -0
- package/image-generation/commands/index.ts +7 -0
- package/image-generation/commands/save-image-generation-job.command.ts +17 -0
- package/image-generation/commands/set-reaction-to-image-generation-job.command.ts +30 -0
- package/image-generation/commands/soft-delete-image-generation-job-by-uuid.command.ts +14 -0
- package/image-generation/commands/soft-delete-image-generation-jobs-by-criteria.command.ts +13 -0
- package/image-generation/commands/update-image-generation-job-title.command.ts +16 -0
- package/image-generation/enums/image-generation-model-strategy.enum.ts +24 -0
- package/image-generation/enums/image-generation-models.enum.ts +4 -0
- package/image-generation/enums/image-generation-resolution.enum.ts +5 -0
- package/image-generation/enums/index.ts +3 -0
- package/image-generation/index.ts +5 -0
- package/image-generation/models/image-generation-config.schema.ts +11 -0
- package/image-generation/models/image-generation-job.schema.ts +37 -0
- package/image-generation/models/image-generation-model.schema.ts +64 -0
- package/image-generation/models/image-generation-preset.schema.ts +13 -0
- package/image-generation/models/index.ts +4 -0
- package/image-generation/queries/find-image-generation-job-by-id.query.ts +19 -0
- package/image-generation/queries/find-image-generation-jobs.query.ts +33 -0
- package/image-generation/queries/get-image-generation-config.query.ts +11 -0
- package/image-generation/queries/index.ts +3 -0
- package/image-generation/routes/image-generation.amqp.routes.ts +11 -0
- package/image-generation/routes/image-generation.http.routes.ts +7 -0
- package/image-generation/routes/index.ts +2 -0
- package/index.ts +7 -0
- package/music/commands/retry-music-job.command.ts +3 -1
- package/music/commands/set-reaction-to-music-job.command.ts +19 -6
- package/music/models/music-job.schema.ts +1 -0
- package/music/models/music-track.schema.ts +1 -0
- package/music/routes/music.http.routes.ts +0 -4
- package/package.json +1 -1
- package/paraphrase/commands/delete-all-paraphrase-jobs.command.ts +13 -0
- package/paraphrase/commands/delete-paraphrase-job-by-uuid.command.ts +14 -0
- package/paraphrase/commands/index.ts +5 -0
- package/paraphrase/commands/retry-paraphrase-job.command.ts +16 -0
- package/paraphrase/commands/set-reaction-to-paraphrase-job.command.ts +30 -0
- package/paraphrase/commands/update-paraphrase-job-title.command.ts +16 -0
- package/paraphrase/models/paraphrase-job.schema.ts +7 -0
- package/paraphrase/queries/find-paraphrase-jobs.query.ts +33 -0
- package/paraphrase/queries/index.ts +1 -0
- package/paraphrase/routes/paraphrase.amqp.routes.ts +6 -0
- package/presentation/commands/index.ts +1 -0
- package/presentation/commands/set-reaction-to-presentation.command.ts +29 -0
- package/presentation/models/pptx-export-payload.ts +20 -0
- package/presentation/models/presentation.schema.ts +3 -0
- package/presentation/models/slide-content.schema.ts +9 -3
- package/presentation/routes/presentation.routes.ts +1 -0
- package/stt/commands/set-reaction-to-stt-job.command.ts +19 -6
- package/stt/models/stt-job.schema.ts +2 -0
- package/tools/enums/tool-content-type.enum.ts +1 -0
- package/tools/enums/tool-type.enum.ts +1 -0
- package/tools/models/global-tools-config.schema.ts +2 -0
- package/tools/models/tools-with-configs.schema.ts +7 -0
- package/tts/commands/set-reaction-to-tts-job.command.ts +19 -6
- package/tts/models/tts-job.schema.ts +2 -0
- package/video/commands/retry-video-job.command.ts +4 -0
- package/video/commands/set-reaction-to-video-job.command.ts +19 -6
- package/video/models/video-job.schema.ts +3 -0
- package/video/models/video-model.schema.ts +1 -0
- package/video-editor/commands/edit-video.command.ts +2 -1
- package/video-editor/commands/retry-video-editor-job.command.ts +5 -0
- package/video-editor/commands/set-reaction-to-video-editor-job.command.ts +19 -6
- package/video-editor/models/video-editor-job.schema.ts +3 -0
- package/writer/commands/set-reaction-writer-document.command.ts +19 -6
- package/writer/models/writer-document.schema.ts +1 -0
|
@@ -12,7 +12,9 @@ export const STTJobSchema = z.object({
|
|
|
12
12
|
fileUrl: z.string(),
|
|
13
13
|
aiResponse: STTResponseSchema.nullable(),
|
|
14
14
|
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
15
|
+
dislikeReason: z.string().nullable(),
|
|
15
16
|
status: z.nativeEnum(JOB_STATUS),
|
|
17
|
+
duration: z.number(),
|
|
16
18
|
error: z.string().nullable(),
|
|
17
19
|
userId: z.string().nullable(),
|
|
18
20
|
unregisteredUserId: z.string().nullable(),
|
|
@@ -4,6 +4,7 @@ import { VideoConfigSchema } from '../../video';
|
|
|
4
4
|
import { MusicConfigSchema } from '../../music';
|
|
5
5
|
import { WriterConfigSchema } from '../../writer';
|
|
6
6
|
import { ImageEditorConfigSchema } from '../../image-editor';
|
|
7
|
+
import { ImageGenerationConfigSchema } from '../../image-generation';
|
|
7
8
|
import { ParaphraseToolConfigSchema } from '../../paraphrase';
|
|
8
9
|
import { PresentationConfigSchema } from '../../presentation';
|
|
9
10
|
import { VideoEditorConfigSchema } from '../../video-editor';
|
|
@@ -15,6 +16,7 @@ export const GlobalToolsConfigSchema = z.object({
|
|
|
15
16
|
[TOOL_CONTENT_TYPE.MUSIC]: MusicConfigSchema,
|
|
16
17
|
[TOOL_CONTENT_TYPE.WRITER]: WriterConfigSchema,
|
|
17
18
|
[TOOL_CONTENT_TYPE.IMAGE_EDITOR]: ImageEditorConfigSchema,
|
|
19
|
+
[TOOL_CONTENT_TYPE.IMAGE_GENERATION]: ImageGenerationConfigSchema,
|
|
18
20
|
[TOOL_CONTENT_TYPE.REPHRASE]: ParaphraseToolConfigSchema,
|
|
19
21
|
[TOOL_CONTENT_TYPE.PRESENTATION]: PresentationConfigSchema,
|
|
20
22
|
[TOOL_CONTENT_TYPE.VIDEO_EDITOR]: VideoEditorConfigSchema,
|
|
@@ -4,6 +4,7 @@ import { VideoConfigSchema } from '../../video';
|
|
|
4
4
|
import { MusicConfigSchema } from '../../music';
|
|
5
5
|
import { WriterConfigSchema } from '../../writer';
|
|
6
6
|
import { ImageEditorConfigSchema } from '../../image-editor';
|
|
7
|
+
import { ImageGenerationConfigSchema } from '../../image-generation';
|
|
7
8
|
import { ParaphraseToolConfigSchema } from '../../paraphrase';
|
|
8
9
|
import { PresentationConfigSchema } from '../../presentation';
|
|
9
10
|
import { VideoEditorConfigSchema } from '../../video-editor';
|
|
@@ -37,6 +38,12 @@ export const ToolWithConfigSchema = z.discriminatedUnion('contentType', [
|
|
|
37
38
|
config: ImageEditorConfigSchema,
|
|
38
39
|
}),
|
|
39
40
|
),
|
|
41
|
+
ToolSchema.merge(
|
|
42
|
+
z.object({
|
|
43
|
+
contentType: z.literal(TOOL_CONTENT_TYPE.IMAGE_GENERATION),
|
|
44
|
+
config: ImageGenerationConfigSchema,
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
40
47
|
ToolSchema.merge(
|
|
41
48
|
z.object({
|
|
42
49
|
contentType: z.literal(TOOL_CONTENT_TYPE.REPHRASE),
|
|
@@ -4,12 +4,25 @@ import { TTSJobSchema } from '../models/tts-job.schema';
|
|
|
4
4
|
import { USER_REACTION } from '../../common';
|
|
5
5
|
|
|
6
6
|
export namespace SetReactionToTTSJobCommand {
|
|
7
|
-
export const RequestSchema = z
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export const RequestSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
userId: z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
uuid: z.string().uuid(),
|
|
12
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
13
|
+
dislikeReason: z.string().nullable().default(null),
|
|
14
|
+
})
|
|
15
|
+
.refine(
|
|
16
|
+
(data) => {
|
|
17
|
+
if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
message: 'Dislike reason is not allowed when reaction is not disliked',
|
|
24
|
+
},
|
|
25
|
+
);
|
|
13
26
|
export type Request = z.infer<typeof RequestSchema>;
|
|
14
27
|
|
|
15
28
|
export const ResponseSchema = ICommandResponseSchema(TTSJobSchema);
|
|
@@ -15,12 +15,14 @@ export const TTSJobSchema = z.object({
|
|
|
15
15
|
userInput: z.string(),
|
|
16
16
|
aiResponse: z.string().nullable(),
|
|
17
17
|
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
18
|
+
dislikeReason: z.string().nullable(),
|
|
18
19
|
title: z.string(),
|
|
19
20
|
status: z.nativeEnum(JOB_STATUS),
|
|
20
21
|
error: z.string().nullable(),
|
|
21
22
|
modelId: z.string(),
|
|
22
23
|
voiceId: z.string(),
|
|
23
24
|
price: z.number(),
|
|
25
|
+
duration: z.number(),
|
|
24
26
|
userId: z.string().nullable(),
|
|
25
27
|
unregisteredUserId: z.string().nullable(),
|
|
26
28
|
isDeleted: z.boolean(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
3
|
import { VideoJobSchema } from '../models/video-job.schema';
|
|
4
|
+
import { VideoGenerationRequestParamsSchema } from '../models';
|
|
4
5
|
|
|
5
6
|
export namespace RetryVideoJobCommand {
|
|
6
7
|
export const RequestSchema = z.object({
|
|
@@ -8,6 +9,9 @@ export namespace RetryVideoJobCommand {
|
|
|
8
9
|
userBalance: z.number(),
|
|
9
10
|
userId: z.string().uuid().nullable().optional(),
|
|
10
11
|
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
12
|
+
prompt: z.string().optional(),
|
|
13
|
+
modelId: z.string().uuid().optional(),
|
|
14
|
+
params: VideoGenerationRequestParamsSchema.optional(),
|
|
11
15
|
});
|
|
12
16
|
export type Request = z.infer<typeof RequestSchema>;
|
|
13
17
|
|
|
@@ -4,12 +4,25 @@ import { VideoJobSchema } from '../models/video-job.schema';
|
|
|
4
4
|
import { USER_REACTION } from '../../common';
|
|
5
5
|
|
|
6
6
|
export namespace SetReactionToVideoJobCommand {
|
|
7
|
-
export const RequestSchema = z
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export const RequestSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
userId: z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
uuid: z.string().uuid(),
|
|
12
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
13
|
+
dislikeReason: z.string().nullable().default(null),
|
|
14
|
+
})
|
|
15
|
+
.refine(
|
|
16
|
+
(data) => {
|
|
17
|
+
if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
message: 'Dislike reason is not allowed when reaction is not disliked',
|
|
24
|
+
},
|
|
25
|
+
);
|
|
13
26
|
export type Request = z.infer<typeof RequestSchema>;
|
|
14
27
|
|
|
15
28
|
export const ResponseSchema = ICommandResponseSchema(VideoJobSchema);
|
|
@@ -4,8 +4,10 @@ import { USER_REACTION } from '../../common';
|
|
|
4
4
|
|
|
5
5
|
export const VideoJobParamsSchema = z.object({
|
|
6
6
|
imageUrls: z.string().array().optional(),
|
|
7
|
+
imageIds: z.array(z.string()).optional(),
|
|
7
8
|
duration: z.number().optional(),
|
|
8
9
|
aspectRatio: z.string().optional(),
|
|
10
|
+
resolution: z.string().optional(),
|
|
9
11
|
});
|
|
10
12
|
|
|
11
13
|
export type VideoJobParams = z.infer<typeof VideoJobParamsSchema>;
|
|
@@ -14,6 +16,7 @@ export const VideoJobSchema = z.object({
|
|
|
14
16
|
uuid: z.string(),
|
|
15
17
|
prompt: z.string(),
|
|
16
18
|
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
19
|
+
dislikeReason: z.string().nullable(),
|
|
17
20
|
externalId: z.string().nullable(),
|
|
18
21
|
title: z.string(),
|
|
19
22
|
status: z.nativeEnum(JOB_STATUS),
|
|
@@ -31,6 +31,7 @@ export type VideoModelParams = z.infer<typeof VideoModelParamsSchema>;
|
|
|
31
31
|
|
|
32
32
|
export const VideoGenerationRequestParamsSchema = z.object({
|
|
33
33
|
imageUrls: z.string().array().optional(),
|
|
34
|
+
imageIds: z.array(z.string()).optional(),
|
|
34
35
|
duration: z.number(),
|
|
35
36
|
aspectRatio: z.string().optional(),
|
|
36
37
|
quality: z.string().optional(),
|
|
@@ -7,10 +7,11 @@ export namespace EditVideoCommand {
|
|
|
7
7
|
userId: z.string().uuid().nullable().optional(),
|
|
8
8
|
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
9
|
prompt: z.string(),
|
|
10
|
+
inputVideoId: z.string().uuid(),
|
|
10
11
|
inputVideoUrl: z.string(),
|
|
11
12
|
duration: z.number(),
|
|
12
13
|
userBalance: z.number(),
|
|
13
|
-
modelId: z.string(),
|
|
14
|
+
modelId: z.string().uuid(),
|
|
14
15
|
});
|
|
15
16
|
export type Request = z.infer<typeof RequestSchema>;
|
|
16
17
|
|
|
@@ -8,6 +8,11 @@ export namespace RetryVideoEditorJobCommand {
|
|
|
8
8
|
userBalance: z.number(),
|
|
9
9
|
userId: z.string().uuid().nullable().optional(),
|
|
10
10
|
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
prompt: z.string().optional(),
|
|
12
|
+
inputVideoId: z.string().uuid().optional(),
|
|
13
|
+
inputVideoUrl: z.string().optional(),
|
|
14
|
+
duration: z.number().optional(),
|
|
15
|
+
modelId: z.string().uuid().optional(),
|
|
11
16
|
});
|
|
12
17
|
export type Request = z.infer<typeof RequestSchema>;
|
|
13
18
|
|
|
@@ -4,12 +4,25 @@ import { VideoEditorJobSchema } from '../models/video-editor-job.schema';
|
|
|
4
4
|
import { USER_REACTION } from '../../common';
|
|
5
5
|
|
|
6
6
|
export namespace SetReactionToVideoEditorJobCommand {
|
|
7
|
-
export const RequestSchema = z
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export const RequestSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
userId: z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
uuid: z.string().uuid(),
|
|
12
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
13
|
+
dislikeReason: z.string().nullable().default(null),
|
|
14
|
+
})
|
|
15
|
+
.refine(
|
|
16
|
+
(data) => {
|
|
17
|
+
if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
message: 'Dislike reason is not allowed when reaction is not disliked',
|
|
24
|
+
},
|
|
25
|
+
);
|
|
13
26
|
export type Request = z.infer<typeof RequestSchema>;
|
|
14
27
|
|
|
15
28
|
export const ResponseSchema = ICommandResponseSchema(VideoEditorJobSchema);
|
|
@@ -10,10 +10,13 @@ export const VideoEditorJobSchema = z.object({
|
|
|
10
10
|
error: z.string().nullable(),
|
|
11
11
|
price: z.number(),
|
|
12
12
|
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
13
|
+
dislikeReason: z.string().nullable(),
|
|
13
14
|
externalId: z.string().nullable(),
|
|
14
15
|
modelId: z.string(),
|
|
15
16
|
inputVideoUrl: z.string(),
|
|
17
|
+
inputVideoId: z.string().nullable(),
|
|
16
18
|
outputVideoUrl: z.string().nullable(),
|
|
19
|
+
outputVideoId: z.string().nullable(),
|
|
17
20
|
duration: z.number(),
|
|
18
21
|
attempts: z.array(z.any()),
|
|
19
22
|
userId: z.string().nullable().optional(),
|
|
@@ -3,12 +3,25 @@ import { ICommandResponseSchema, USER_REACTION } from '../../common';
|
|
|
3
3
|
import { WriterDocumentSchema } from '../models';
|
|
4
4
|
|
|
5
5
|
export namespace SetReactionToWriterDocumentCommand {
|
|
6
|
-
export const RequestSchema = z
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export const RequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
userId: z.string().uuid().nullable().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
+
documentId: z.string().uuid(),
|
|
11
|
+
reaction: z.nativeEnum(USER_REACTION),
|
|
12
|
+
dislikeReason: z.string().nullable().default(null),
|
|
13
|
+
})
|
|
14
|
+
.refine(
|
|
15
|
+
(data) => {
|
|
16
|
+
if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
message: 'Dislike reason is not allowed when reaction is not disliked',
|
|
23
|
+
},
|
|
24
|
+
);
|
|
12
25
|
export type Request = z.infer<typeof RequestSchema>;
|
|
13
26
|
|
|
14
27
|
export const ResponseSchema = ICommandResponseSchema(WriterDocumentSchema);
|
|
@@ -16,6 +16,7 @@ export const WriterDocumentSchema = z.object({
|
|
|
16
16
|
unregisteredUserId: z.string().nullable(),
|
|
17
17
|
modelId: z.string().nullable(),
|
|
18
18
|
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
19
|
+
dislikeReason: z.string().nullable(),
|
|
19
20
|
pages: z.number(),
|
|
20
21
|
isDeleted: z.boolean(),
|
|
21
22
|
createdAt: z.date(),
|