@purpleschool/gptbot-tools 0.0.83 → 0.0.85
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/build/common/errors/errors.js +15 -0
- package/build/music/models/music-track.schema.js +1 -0
- 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 +17 -0
- package/build/paraphrase/commands/update-paraphrase-job-title.command.js +16 -0
- package/build/paraphrase/models/paraphrase-job.schema.js +4 -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/common/errors/errors.ts +15 -0
- package/music/models/music-track.schema.ts +1 -0
- 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 +17 -0
- package/paraphrase/commands/update-paraphrase-job-title.command.ts +16 -0
- package/paraphrase/models/paraphrase-job.schema.ts +4 -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
|
@@ -102,6 +102,21 @@ exports.ERRORS = {
|
|
|
102
102
|
message: 'Задание на перефразирование не найдено',
|
|
103
103
|
httpCode: 404,
|
|
104
104
|
},
|
|
105
|
+
DELETE_ERROR: {
|
|
106
|
+
code: 'PARAPHRASE_JOB.DELETE_ERROR',
|
|
107
|
+
message: 'Произошла ошибка при удалении задания на перефразирование',
|
|
108
|
+
httpCode: 500,
|
|
109
|
+
},
|
|
110
|
+
NOT_AN_OWNER: {
|
|
111
|
+
code: 'PARAPHRASE_JOB.NOT_AN_OWNER',
|
|
112
|
+
message: 'Пользователь не является владельцем задания на перефразирование',
|
|
113
|
+
httpCode: 403,
|
|
114
|
+
},
|
|
115
|
+
NOT_IN_FAILED_STATE_TO_RETRY: {
|
|
116
|
+
code: 'PARAPHRASE_JOB.NOT_IN_FAILED_STATE_TO_RETRY',
|
|
117
|
+
message: 'Задание на перефразирование не в состоянии "failed". Невозможно повторить',
|
|
118
|
+
httpCode: 400,
|
|
119
|
+
},
|
|
105
120
|
},
|
|
106
121
|
S3: {
|
|
107
122
|
GET_FILE_STREAM_ERROR: {
|
|
@@ -8,6 +8,7 @@ exports.MusicTrackSchema = zod_1.z.object({
|
|
|
8
8
|
audioId: zod_1.z.string(),
|
|
9
9
|
audioUrl: zod_1.z.string(),
|
|
10
10
|
coverUrl: zod_1.z.string(),
|
|
11
|
+
prompt: zod_1.z.string().nullable(),
|
|
11
12
|
tags: zod_1.z.string(),
|
|
12
13
|
duration: zod_1.z.number(),
|
|
13
14
|
genJobId: zod_1.z.string().nullable().optional(),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteAllParaphraseJobsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
var DeleteAllParaphraseJobsCommand;
|
|
7
|
+
(function (DeleteAllParaphraseJobsCommand) {
|
|
8
|
+
DeleteAllParaphraseJobsCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
11
|
+
});
|
|
12
|
+
DeleteAllParaphraseJobsCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.boolean());
|
|
13
|
+
})(DeleteAllParaphraseJobsCommand || (exports.DeleteAllParaphraseJobsCommand = DeleteAllParaphraseJobsCommand = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteParaphraseJobByUuidCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
var DeleteParaphraseJobByUuidCommand;
|
|
7
|
+
(function (DeleteParaphraseJobByUuidCommand) {
|
|
8
|
+
DeleteParaphraseJobByUuidCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
11
|
+
uuid: zod_1.z.string(),
|
|
12
|
+
});
|
|
13
|
+
DeleteParaphraseJobByUuidCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.boolean());
|
|
14
|
+
})(DeleteParaphraseJobByUuidCommand || (exports.DeleteParaphraseJobByUuidCommand = DeleteParaphraseJobByUuidCommand = {}));
|
|
@@ -15,3 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./paraphrase.command"), exports);
|
|
18
|
+
__exportStar(require("./delete-paraphrase-job-by-uuid.command"), exports);
|
|
19
|
+
__exportStar(require("./delete-all-paraphrase-jobs.command"), exports);
|
|
20
|
+
__exportStar(require("./set-reaction-to-paraphrase-job.command"), exports);
|
|
21
|
+
__exportStar(require("./update-paraphrase-job-title.command"), exports);
|
|
22
|
+
__exportStar(require("./retry-paraphrase-job.command"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RetryParaphraseJobCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const paraphrase_job_schema_1 = require("../models/paraphrase-job.schema");
|
|
7
|
+
var RetryParaphraseJobCommand;
|
|
8
|
+
(function (RetryParaphraseJobCommand) {
|
|
9
|
+
RetryParaphraseJobCommand.RequestSchema = zod_1.z.object({
|
|
10
|
+
uuid: zod_1.z.string().uuid(),
|
|
11
|
+
userBalance: zod_1.z.number(),
|
|
12
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
14
|
+
});
|
|
15
|
+
RetryParaphraseJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(paraphrase_job_schema_1.ParaphraseJobSchema);
|
|
16
|
+
})(RetryParaphraseJobCommand || (exports.RetryParaphraseJobCommand = RetryParaphraseJobCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetReactionToParaphraseJobCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const paraphrase_job_schema_1 = require("../models/paraphrase-job.schema");
|
|
7
|
+
const common_1 = require("../../common");
|
|
8
|
+
var SetReactionToParaphraseJobCommand;
|
|
9
|
+
(function (SetReactionToParaphraseJobCommand) {
|
|
10
|
+
SetReactionToParaphraseJobCommand.RequestSchema = zod_1.z.object({
|
|
11
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
|
+
uuid: zod_1.z.string(),
|
|
14
|
+
reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
|
|
15
|
+
});
|
|
16
|
+
SetReactionToParaphraseJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(paraphrase_job_schema_1.ParaphraseJobSchema);
|
|
17
|
+
})(SetReactionToParaphraseJobCommand || (exports.SetReactionToParaphraseJobCommand = SetReactionToParaphraseJobCommand = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateParaphraseJobTitleCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const paraphrase_job_schema_1 = require("../models/paraphrase-job.schema");
|
|
7
|
+
var UpdateParaphraseJobTitleCommand;
|
|
8
|
+
(function (UpdateParaphraseJobTitleCommand) {
|
|
9
|
+
UpdateParaphraseJobTitleCommand.RequestSchema = zod_1.z.object({
|
|
10
|
+
uuid: zod_1.z.string().uuid(),
|
|
11
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
|
+
title: zod_1.z.string().min(1).max(40),
|
|
14
|
+
});
|
|
15
|
+
UpdateParaphraseJobTitleCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(paraphrase_job_schema_1.ParaphraseJobSchema);
|
|
16
|
+
})(UpdateParaphraseJobTitleCommand || (exports.UpdateParaphraseJobTitleCommand = UpdateParaphraseJobTitleCommand = {}));
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ParaphraseJobSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const tools_1 = require("../../tools");
|
|
6
|
+
const common_1 = require("../../common");
|
|
6
7
|
exports.ParaphraseJobSchema = zod_1.z.object({
|
|
7
8
|
uuid: zod_1.z.string(),
|
|
8
9
|
userId: zod_1.z.string().nullable(),
|
|
@@ -12,6 +13,9 @@ exports.ParaphraseJobSchema = zod_1.z.object({
|
|
|
12
13
|
aiTokenUsage: zod_1.z.number().nullable(),
|
|
13
14
|
price: zod_1.z.number(),
|
|
14
15
|
status: zod_1.z.nativeEnum(tools_1.JOB_STATUS),
|
|
16
|
+
title: zod_1.z.string(),
|
|
17
|
+
error: zod_1.z.string().nullable(),
|
|
18
|
+
reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
|
|
15
19
|
typeId: zod_1.z.string(),
|
|
16
20
|
styleId: zod_1.z.string(),
|
|
17
21
|
createdAt: zod_1.z.date(),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindParaphraseJobsQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const paraphrase_job_schema_1 = require("../models/paraphrase-job.schema");
|
|
7
|
+
var FindParaphraseJobsQuery;
|
|
8
|
+
(function (FindParaphraseJobsQuery) {
|
|
9
|
+
FindParaphraseJobsQuery.RequestSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
userId: zod_1.z.string().uuid().optional(),
|
|
12
|
+
unregisteredUserId: zod_1.z.string().uuid().optional(),
|
|
13
|
+
title: zod_1.z.string().optional(),
|
|
14
|
+
limit: zod_1.z.coerce.number().min(1).optional(),
|
|
15
|
+
offset: zod_1.z.coerce.number().min(0).default(0).optional(),
|
|
16
|
+
})
|
|
17
|
+
.refine((data) => {
|
|
18
|
+
return Boolean(data.userId) !== Boolean(data.unregisteredUserId);
|
|
19
|
+
}, {
|
|
20
|
+
message: 'At least userId or unregisteredUserId must be present',
|
|
21
|
+
path: ['userId', 'unregisteredUserId'],
|
|
22
|
+
});
|
|
23
|
+
FindParaphraseJobsQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.object({
|
|
24
|
+
data: zod_1.z.array(paraphrase_job_schema_1.ParaphraseJobSchema),
|
|
25
|
+
page: zod_1.z.number(),
|
|
26
|
+
totalPages: zod_1.z.number(),
|
|
27
|
+
}));
|
|
28
|
+
})(FindParaphraseJobsQuery || (exports.FindParaphraseJobsQuery = FindParaphraseJobsQuery = {}));
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./find-paraphrase-job-by-uuid.query"), exports);
|
|
18
18
|
__exportStar(require("./get-paraphrase-tool-config.query"), exports);
|
|
19
|
+
__exportStar(require("./find-paraphrase-jobs.query"), exports);
|
|
@@ -5,4 +5,10 @@ exports.PARAPHRASE_AMQP_ROUTES = {
|
|
|
5
5
|
EXECUTE: 'tools.paraphrase.execute.rpc',
|
|
6
6
|
CONFIG: 'tools.paraphrase.config.rpc',
|
|
7
7
|
GET_JOB: 'tools.paraphrase.jobs.get.rpc',
|
|
8
|
+
LIST_JOBS: 'tools.paraphrase.jobs.list.rpc',
|
|
9
|
+
SET_REACTION: 'tools.paraphrase.jobs.set-reaction.rpc',
|
|
10
|
+
UPDATE_TITLE: 'tools.paraphrase.jobs.update-title.rpc',
|
|
11
|
+
SOFT_DELETE: 'tools.paraphrase.jobs.soft-delete.rpc',
|
|
12
|
+
SOFT_DELETE_ALL: 'tools.paraphrase.jobs.soft-delete-all.rpc',
|
|
13
|
+
RETRY: 'tools.paraphrase.jobs.retry.rpc',
|
|
8
14
|
};
|
package/common/errors/errors.ts
CHANGED
|
@@ -101,6 +101,21 @@ export const ERRORS = {
|
|
|
101
101
|
message: 'Задание на перефразирование не найдено',
|
|
102
102
|
httpCode: 404,
|
|
103
103
|
},
|
|
104
|
+
DELETE_ERROR: {
|
|
105
|
+
code: 'PARAPHRASE_JOB.DELETE_ERROR',
|
|
106
|
+
message: 'Произошла ошибка при удалении задания на перефразирование',
|
|
107
|
+
httpCode: 500,
|
|
108
|
+
},
|
|
109
|
+
NOT_AN_OWNER: {
|
|
110
|
+
code: 'PARAPHRASE_JOB.NOT_AN_OWNER',
|
|
111
|
+
message: 'Пользователь не является владельцем задания на перефразирование',
|
|
112
|
+
httpCode: 403,
|
|
113
|
+
},
|
|
114
|
+
NOT_IN_FAILED_STATE_TO_RETRY: {
|
|
115
|
+
code: 'PARAPHRASE_JOB.NOT_IN_FAILED_STATE_TO_RETRY',
|
|
116
|
+
message: 'Задание на перефразирование не в состоянии "failed". Невозможно повторить',
|
|
117
|
+
httpCode: 400,
|
|
118
|
+
},
|
|
104
119
|
},
|
|
105
120
|
S3: {
|
|
106
121
|
GET_FILE_STREAM_ERROR: {
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteAllParaphraseJobsCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid().nullable().optional(),
|
|
7
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
+
});
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = ICommandResponseSchema(z.boolean());
|
|
12
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
|
|
4
|
+
export namespace DeleteParaphraseJobByUuidCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid().nullable().optional(),
|
|
7
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
+
uuid: z.string(),
|
|
9
|
+
});
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = ICommandResponseSchema(z.boolean());
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -1 +1,6 @@
|
|
|
1
1
|
export * from './paraphrase.command';
|
|
2
|
+
export * from './delete-paraphrase-job-by-uuid.command';
|
|
3
|
+
export * from './delete-all-paraphrase-jobs.command';
|
|
4
|
+
export * from './set-reaction-to-paraphrase-job.command';
|
|
5
|
+
export * from './update-paraphrase-job-title.command';
|
|
6
|
+
export * from './retry-paraphrase-job.command';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
|
|
4
|
+
|
|
5
|
+
export namespace RetryParaphraseJobCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
userBalance: z.number(),
|
|
9
|
+
userId: z.string().uuid().nullable().optional(),
|
|
10
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
+
});
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = ICommandResponseSchema(ParaphraseJobSchema);
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
|
|
4
|
+
import { USER_REACTION } from '../../common';
|
|
5
|
+
|
|
6
|
+
export namespace SetReactionToParaphraseJobCommand {
|
|
7
|
+
export const RequestSchema = z.object({
|
|
8
|
+
userId: z.string().uuid().nullable().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
+
uuid: z.string(),
|
|
11
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = ICommandResponseSchema(ParaphraseJobSchema);
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateParaphraseJobTitleCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
userId: z.string().uuid().nullable().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
+
title: z.string().min(1).max(40),
|
|
11
|
+
});
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = ICommandResponseSchema(ParaphraseJobSchema);
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { JOB_STATUS } from '../../tools';
|
|
3
|
+
import { USER_REACTION } from '../../common';
|
|
3
4
|
|
|
4
5
|
export const ParaphraseJobSchema = z.object({
|
|
5
6
|
uuid: z.string(),
|
|
@@ -10,6 +11,9 @@ export const ParaphraseJobSchema = z.object({
|
|
|
10
11
|
aiTokenUsage: z.number().nullable(),
|
|
11
12
|
price: z.number(),
|
|
12
13
|
status: z.nativeEnum(JOB_STATUS),
|
|
14
|
+
title: z.string(),
|
|
15
|
+
error: z.string().nullable(),
|
|
16
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
13
17
|
typeId: z.string(),
|
|
14
18
|
styleId: z.string(),
|
|
15
19
|
createdAt: z.date(),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
|
|
4
|
+
|
|
5
|
+
export namespace FindParaphraseJobsQuery {
|
|
6
|
+
export const RequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
userId: z.string().uuid().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().optional(),
|
|
10
|
+
title: z.string().optional(),
|
|
11
|
+
limit: z.coerce.number().min(1).optional(),
|
|
12
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
13
|
+
})
|
|
14
|
+
.refine(
|
|
15
|
+
(data) => {
|
|
16
|
+
return Boolean(data.userId) !== Boolean(data.unregisteredUserId);
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
message: 'At least userId or unregisteredUserId must be present',
|
|
20
|
+
path: ['userId', 'unregisteredUserId'],
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
24
|
+
|
|
25
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
26
|
+
z.object({
|
|
27
|
+
data: z.array(ParaphraseJobSchema),
|
|
28
|
+
page: z.number(),
|
|
29
|
+
totalPages: z.number(),
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
33
|
+
}
|
|
@@ -2,4 +2,10 @@ export const PARAPHRASE_AMQP_ROUTES = {
|
|
|
2
2
|
EXECUTE: 'tools.paraphrase.execute.rpc',
|
|
3
3
|
CONFIG: 'tools.paraphrase.config.rpc',
|
|
4
4
|
GET_JOB: 'tools.paraphrase.jobs.get.rpc',
|
|
5
|
+
LIST_JOBS: 'tools.paraphrase.jobs.list.rpc',
|
|
6
|
+
SET_REACTION: 'tools.paraphrase.jobs.set-reaction.rpc',
|
|
7
|
+
UPDATE_TITLE: 'tools.paraphrase.jobs.update-title.rpc',
|
|
8
|
+
SOFT_DELETE: 'tools.paraphrase.jobs.soft-delete.rpc',
|
|
9
|
+
SOFT_DELETE_ALL: 'tools.paraphrase.jobs.soft-delete-all.rpc',
|
|
10
|
+
RETRY: 'tools.paraphrase.jobs.retry.rpc',
|
|
5
11
|
} as const;
|