@purpleschool/student-works 1.0.0 → 1.2.0
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/controller/http/index.ts +1 -0
- package/api/controller/http/tools.ts +7 -0
- package/api/routes.ts +8 -0
- package/build/api/controller/http/index.js +1 -0
- package/build/api/controller/http/tools.js +9 -0
- package/build/api/routes.js +8 -0
- package/build/common/enums/tool-type.enum.js +2 -1
- package/build/constants/errors/errors.js +5 -0
- package/build/constants/page/enums/page-type.enum.js +2 -1
- package/build/models/index.js +1 -0
- package/build/models/page.schema.js +8 -5
- package/build/models/tools/index.js +17 -0
- package/build/models/tools/unified-tool-job.schema.js +17 -0
- package/build/queries/index.js +1 -1
- package/build/queries/tools/find-unified-tool-job-history-full.query.js +19 -0
- package/build/queries/tools/find-unified-tool-job-history.query.js +18 -0
- package/build/queries/tools/index.js +18 -0
- package/common/enums/tool-type.enum.ts +2 -1
- package/constants/errors/errors.ts +5 -0
- package/constants/page/enums/page-type.enum.ts +2 -1
- package/models/index.ts +1 -0
- package/models/page.schema.ts +8 -4
- package/models/tools/index.ts +1 -0
- package/models/tools/unified-tool-job.schema.ts +17 -0
- package/package.json +1 -1
- package/queries/index.ts +1 -1
- package/queries/tools/find-unified-tool-job-history-full.query.ts +21 -0
- package/queries/tools/find-unified-tool-job-history.query.ts +20 -0
- package/queries/tools/index.ts +2 -0
package/api/routes.ts
CHANGED
|
@@ -239,4 +239,12 @@ export const REST_API = {
|
|
|
239
239
|
RETRY: (uuid: string) =>
|
|
240
240
|
`${ROOT}/${CONTROLLERS.SOLVING_EDU_TASK_CONTROLLER_PUBLIC}/${CONTROLLERS.SOLVING_EDU_TASK_ROUTES.RETRY(uuid)}`,
|
|
241
241
|
},
|
|
242
|
+
TOOLS_PRIVATE: {
|
|
243
|
+
HISTORY: `${ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PRIVATE}/${CONTROLLERS.TOOLS_ROUTES.HISTORY}`,
|
|
244
|
+
HISTORY_FULL: `${ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PRIVATE}/${CONTROLLERS.TOOLS_ROUTES.HISTORY_FULL}`,
|
|
245
|
+
},
|
|
246
|
+
TOOLS_PUBLIC: {
|
|
247
|
+
HISTORY: `${ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PUBLIC}/${CONTROLLERS.TOOLS_ROUTES.HISTORY}`,
|
|
248
|
+
HISTORY_FULL: `${ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PUBLIC}/${CONTROLLERS.TOOLS_ROUTES.HISTORY_FULL}`,
|
|
249
|
+
},
|
|
242
250
|
} as const;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOLS_ROUTES = exports.TOOLS_CONTROLLER_PUBLIC = exports.TOOLS_CONTROLLER_PRIVATE = void 0;
|
|
4
|
+
exports.TOOLS_CONTROLLER_PRIVATE = 'private/tools';
|
|
5
|
+
exports.TOOLS_CONTROLLER_PUBLIC = 'public/tools';
|
|
6
|
+
exports.TOOLS_ROUTES = {
|
|
7
|
+
HISTORY: 'history',
|
|
8
|
+
HISTORY_FULL: 'history/full',
|
|
9
|
+
};
|
package/build/api/routes.js
CHANGED
|
@@ -201,4 +201,12 @@ exports.REST_API = {
|
|
|
201
201
|
DELETE_ALL: `${exports.ROOT}/${CONTROLLERS.SOLVING_EDU_TASK_CONTROLLER_PUBLIC}/${CONTROLLERS.SOLVING_EDU_TASK_ROUTES.DELETE_ALL}`,
|
|
202
202
|
RETRY: (uuid) => `${exports.ROOT}/${CONTROLLERS.SOLVING_EDU_TASK_CONTROLLER_PUBLIC}/${CONTROLLERS.SOLVING_EDU_TASK_ROUTES.RETRY(uuid)}`,
|
|
203
203
|
},
|
|
204
|
+
TOOLS_PRIVATE: {
|
|
205
|
+
HISTORY: `${exports.ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PRIVATE}/${CONTROLLERS.TOOLS_ROUTES.HISTORY}`,
|
|
206
|
+
HISTORY_FULL: `${exports.ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PRIVATE}/${CONTROLLERS.TOOLS_ROUTES.HISTORY_FULL}`,
|
|
207
|
+
},
|
|
208
|
+
TOOLS_PUBLIC: {
|
|
209
|
+
HISTORY: `${exports.ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PUBLIC}/${CONTROLLERS.TOOLS_ROUTES.HISTORY}`,
|
|
210
|
+
HISTORY_FULL: `${exports.ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PUBLIC}/${CONTROLLERS.TOOLS_ROUTES.HISTORY_FULL}`,
|
|
211
|
+
},
|
|
204
212
|
};
|
|
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TOOL_TYPE = void 0;
|
|
4
4
|
var TOOL_TYPE;
|
|
5
5
|
(function (TOOL_TYPE) {
|
|
6
|
-
TOOL_TYPE["WRITER"] = "
|
|
6
|
+
TOOL_TYPE["WRITER"] = "writer";
|
|
7
|
+
TOOL_TYPE["SOLVING_EDU_TASK"] = "solving-edu-task";
|
|
7
8
|
})(TOOL_TYPE || (exports.TOOL_TYPE = TOOL_TYPE = {}));
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PageType = void 0;
|
|
4
4
|
var PageType;
|
|
5
5
|
(function (PageType) {
|
|
6
|
-
PageType["
|
|
6
|
+
PageType["WRITER_TOOL"] = "WRITER_TOOL";
|
|
7
|
+
PageType["EDU_TASK_SOLVING_TOOL"] = "EDU_TASK_SOLVING_TOOL";
|
|
7
8
|
PageType["WRITER_DOCUMENT_TYPE"] = "WRITER_DOCUMENT_TYPE";
|
|
8
9
|
})(PageType || (exports.PageType = PageType = {}));
|
package/build/models/index.js
CHANGED
|
@@ -38,3 +38,4 @@ __exportStar(require("./referral-bonus.schema"), exports);
|
|
|
38
38
|
__exportStar(require("./user-referrals.schema"), exports);
|
|
39
39
|
__exportStar(require("./file.schema"), exports);
|
|
40
40
|
__exportStar(require("./solving-edu-task"), exports);
|
|
41
|
+
__exportStar(require("./tools"), exports);
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PageWithQuestionsSchema = exports.PageSchema = exports.PageMetadataSchema = exports.WriterDocumentTypePageMetadataSchema = exports.
|
|
3
|
+
exports.PageWithQuestionsSchema = exports.PageSchema = exports.PageMetadataSchema = exports.WriterDocumentTypePageMetadataSchema = exports.EduTaskSolvingToolPageMetadataSchema = exports.WriterToolPageMetadataSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const page_question_schema_1 = require("./page-question.schema");
|
|
7
|
-
exports.
|
|
8
|
-
type: zod_1.z.literal(constants_1.PageType.
|
|
9
|
-
|
|
7
|
+
exports.WriterToolPageMetadataSchema = zod_1.z.object({
|
|
8
|
+
type: zod_1.z.literal(constants_1.PageType.WRITER_TOOL),
|
|
9
|
+
});
|
|
10
|
+
exports.EduTaskSolvingToolPageMetadataSchema = zod_1.z.object({
|
|
11
|
+
type: zod_1.z.literal(constants_1.PageType.EDU_TASK_SOLVING_TOOL),
|
|
10
12
|
});
|
|
11
13
|
exports.WriterDocumentTypePageMetadataSchema = zod_1.z.object({
|
|
12
14
|
type: zod_1.z.literal(constants_1.PageType.WRITER_DOCUMENT_TYPE),
|
|
13
15
|
writerDocumentTypeId: zod_1.z.string().uuid(),
|
|
14
16
|
});
|
|
15
17
|
exports.PageMetadataSchema = zod_1.z.discriminatedUnion('type', [
|
|
16
|
-
exports.
|
|
18
|
+
exports.WriterToolPageMetadataSchema,
|
|
19
|
+
exports.EduTaskSolvingToolPageMetadataSchema,
|
|
17
20
|
exports.WriterDocumentTypePageMetadataSchema,
|
|
18
21
|
]);
|
|
19
22
|
exports.PageSchema = zod_1.z.object({
|
|
@@ -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("./unified-tool-job.schema"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnifiedToolJobSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
const constants_2 = require("../../constants");
|
|
8
|
+
exports.UnifiedToolJobSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
title: zod_1.z.string(),
|
|
11
|
+
type: zod_1.z.nativeEnum(common_1.TOOL_TYPE),
|
|
12
|
+
status: zod_1.z.nativeEnum(constants_1.JOB_STATUS).optional().nullable(),
|
|
13
|
+
stage: zod_1.z.nativeEnum(constants_2.WRITER_DOCUMENT_STAGE).optional().nullable(),
|
|
14
|
+
documentTypeId: zod_1.z.string().uuid().optional().nullable(),
|
|
15
|
+
createdAt: zod_1.z.date().or(zod_1.z.string()),
|
|
16
|
+
updatedAt: zod_1.z.date().or(zod_1.z.string()),
|
|
17
|
+
});
|
package/build/queries/index.js
CHANGED
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./tools"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindUnifiedToolJobHistoryFullQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const writer_1 = require("../../models/writer");
|
|
6
|
+
const solving_edu_task_1 = require("../../models/solving-edu-task");
|
|
7
|
+
var FindUnifiedToolJobHistoryFullQuery;
|
|
8
|
+
(function (FindUnifiedToolJobHistoryFullQuery) {
|
|
9
|
+
FindUnifiedToolJobHistoryFullQuery.RequestSchema = zod_1.z.object({
|
|
10
|
+
limit: zod_1.z.coerce.number().min(1).optional(),
|
|
11
|
+
offset: zod_1.z.coerce.number().min(0).default(0).optional(),
|
|
12
|
+
title: zod_1.z.string().optional(),
|
|
13
|
+
});
|
|
14
|
+
FindUnifiedToolJobHistoryFullQuery.ResponseSchema = zod_1.z.object({
|
|
15
|
+
data: zod_1.z.array(zod_1.z.union([writer_1.WriterDocumentSchema, solving_edu_task_1.SolvingEduTaskJobSchema])),
|
|
16
|
+
page: zod_1.z.number().int(),
|
|
17
|
+
totalPages: zod_1.z.number().int(),
|
|
18
|
+
});
|
|
19
|
+
})(FindUnifiedToolJobHistoryFullQuery || (exports.FindUnifiedToolJobHistoryFullQuery = FindUnifiedToolJobHistoryFullQuery = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindUnifiedToolJobHistoryQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tools_1 = require("../../models/tools");
|
|
6
|
+
var FindUnifiedToolJobHistoryQuery;
|
|
7
|
+
(function (FindUnifiedToolJobHistoryQuery) {
|
|
8
|
+
FindUnifiedToolJobHistoryQuery.RequestSchema = zod_1.z.object({
|
|
9
|
+
limit: zod_1.z.coerce.number().min(1).optional(),
|
|
10
|
+
offset: zod_1.z.coerce.number().min(0).default(0).optional(),
|
|
11
|
+
title: zod_1.z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
FindUnifiedToolJobHistoryQuery.ResponseSchema = zod_1.z.object({
|
|
14
|
+
data: zod_1.z.array(tools_1.UnifiedToolJobSchema),
|
|
15
|
+
page: zod_1.z.number().int(),
|
|
16
|
+
totalPages: zod_1.z.number().int(),
|
|
17
|
+
});
|
|
18
|
+
})(FindUnifiedToolJobHistoryQuery || (exports.FindUnifiedToolJobHistoryQuery = FindUnifiedToolJobHistoryQuery = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./find-unified-tool-job-history.query"), exports);
|
|
18
|
+
__exportStar(require("./find-unified-tool-job-history-full.query"), exports);
|
package/models/index.ts
CHANGED
package/models/page.schema.ts
CHANGED
|
@@ -2,9 +2,12 @@ import { z } from 'zod';
|
|
|
2
2
|
import { PageType } from '../constants';
|
|
3
3
|
import { PageQuestionSchema } from './page-question.schema';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
type: z.literal(PageType.
|
|
7
|
-
|
|
5
|
+
export const WriterToolPageMetadataSchema = z.object({
|
|
6
|
+
type: z.literal(PageType.WRITER_TOOL),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const EduTaskSolvingToolPageMetadataSchema = z.object({
|
|
10
|
+
type: z.literal(PageType.EDU_TASK_SOLVING_TOOL),
|
|
8
11
|
});
|
|
9
12
|
|
|
10
13
|
export const WriterDocumentTypePageMetadataSchema = z.object({
|
|
@@ -13,7 +16,8 @@ export const WriterDocumentTypePageMetadataSchema = z.object({
|
|
|
13
16
|
});
|
|
14
17
|
|
|
15
18
|
export const PageMetadataSchema = z.discriminatedUnion('type', [
|
|
16
|
-
|
|
19
|
+
WriterToolPageMetadataSchema,
|
|
20
|
+
EduTaskSolvingToolPageMetadataSchema,
|
|
17
21
|
WriterDocumentTypePageMetadataSchema,
|
|
18
22
|
]);
|
|
19
23
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './unified-tool-job.schema';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL_TYPE } from '../../common';
|
|
3
|
+
import { JOB_STATUS } from '../../constants';
|
|
4
|
+
import { WRITER_DOCUMENT_STAGE } from '../../constants';
|
|
5
|
+
|
|
6
|
+
export const UnifiedToolJobSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
title: z.string(),
|
|
9
|
+
type: z.nativeEnum(TOOL_TYPE),
|
|
10
|
+
status: z.nativeEnum(JOB_STATUS).optional().nullable(),
|
|
11
|
+
stage: z.nativeEnum(WRITER_DOCUMENT_STAGE).optional().nullable(),
|
|
12
|
+
documentTypeId: z.string().uuid().optional().nullable(),
|
|
13
|
+
createdAt: z.date().or(z.string()),
|
|
14
|
+
updatedAt: z.date().or(z.string()),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type UnifiedToolJob = z.infer<typeof UnifiedToolJobSchema>;
|
package/package.json
CHANGED
package/queries/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './tools';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WriterDocumentSchema } from '../../models/writer';
|
|
3
|
+
import { SolvingEduTaskJobSchema } from '../../models/solving-edu-task';
|
|
4
|
+
|
|
5
|
+
export namespace FindUnifiedToolJobHistoryFullQuery {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
limit: z.coerce.number().min(1).optional(),
|
|
8
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
9
|
+
title: z.string().optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.array(z.union([WriterDocumentSchema, SolvingEduTaskJobSchema])),
|
|
16
|
+
page: z.number().int(),
|
|
17
|
+
totalPages: z.number().int(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UnifiedToolJobSchema } from '../../models/tools';
|
|
3
|
+
|
|
4
|
+
export namespace FindUnifiedToolJobHistoryQuery {
|
|
5
|
+
export const RequestSchema = 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
|
+
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: z.array(UnifiedToolJobSchema),
|
|
15
|
+
page: z.number().int(),
|
|
16
|
+
totalPages: z.number().int(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|