gemcap-be-common 1.5.128 → 1.5.129
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/models/AiJob.model.d.ts +3 -0
- package/models/AiJob.model.js +17 -1
- package/models/AiJob.model.ts +22 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/models/AiJob.model.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ import mongoose from 'mongoose';
|
|
|
31
31
|
import { TModelName } from './_models';
|
|
32
32
|
import { TTaskStatus } from '../interfaces/task.interface';
|
|
33
33
|
export declare const AI_JOBS_FOLDER = "AI_jobs";
|
|
34
|
+
export declare const AI_JOB_TYPES: readonly ["loan-memo-excel", "approval-memo", "email-summary"];
|
|
35
|
+
export type TAIJobType = (typeof AI_JOB_TYPES)[number];
|
|
34
36
|
export interface IAIJobResponseChunk {
|
|
35
37
|
type: 'text' | 'thinking' | 'tool' | 'status';
|
|
36
38
|
timestamp: Date;
|
|
@@ -68,6 +70,7 @@ export interface IAIJobTarget {
|
|
|
68
70
|
export interface IAIJob {
|
|
69
71
|
taskId: string;
|
|
70
72
|
userId: string;
|
|
73
|
+
taskType: TAIJobType;
|
|
71
74
|
status: TTaskStatus;
|
|
72
75
|
target: IAIJobTarget;
|
|
73
76
|
context: unknown;
|
package/models/AiJob.model.js
CHANGED
|
@@ -3,10 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AIJob = exports.AIJobSchema = exports.AI_JOBS_FOLDER = void 0;
|
|
6
|
+
exports.AIJob = exports.AIJobSchema = exports.AI_JOB_TYPES = exports.AI_JOBS_FOLDER = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const _models_1 = require("./_models");
|
|
9
9
|
exports.AI_JOBS_FOLDER = 'AI_jobs';
|
|
10
|
+
exports.AI_JOB_TYPES = [
|
|
11
|
+
'loan-memo-excel',
|
|
12
|
+
'approval-memo',
|
|
13
|
+
'email-summary',
|
|
14
|
+
];
|
|
10
15
|
exports.AIJobSchema = new mongoose_1.default.Schema({
|
|
11
16
|
taskId: {
|
|
12
17
|
type: String,
|
|
@@ -16,6 +21,12 @@ exports.AIJobSchema = new mongoose_1.default.Schema({
|
|
|
16
21
|
type: 'String',
|
|
17
22
|
required: true,
|
|
18
23
|
},
|
|
24
|
+
taskType: {
|
|
25
|
+
type: String,
|
|
26
|
+
enum: exports.AI_JOB_TYPES,
|
|
27
|
+
required: true,
|
|
28
|
+
index: true,
|
|
29
|
+
},
|
|
19
30
|
status: {
|
|
20
31
|
type: String,
|
|
21
32
|
required: true,
|
|
@@ -119,5 +130,10 @@ exports.AIJobSchema = new mongoose_1.default.Schema({
|
|
|
119
130
|
timestamps: { createdAt: true, updatedAt: true },
|
|
120
131
|
versionKey: false,
|
|
121
132
|
});
|
|
133
|
+
exports.AIJobSchema.index({
|
|
134
|
+
userId: 1,
|
|
135
|
+
taskType: 1,
|
|
136
|
+
createdAt: -1,
|
|
137
|
+
});
|
|
122
138
|
exports.AIJobSchema.index({ taskId: 1, userId: 1, status: 1 }, { unique: true });
|
|
123
139
|
exports.AIJob = mongoose_1.default.model(_models_1.MODEL_NAMES.AIJobs, exports.AIJobSchema);
|
package/models/AiJob.model.ts
CHANGED
|
@@ -5,6 +5,14 @@ import { TTaskStatus } from '../interfaces/task.interface';
|
|
|
5
5
|
|
|
6
6
|
export const AI_JOBS_FOLDER = 'AI_jobs';
|
|
7
7
|
|
|
8
|
+
export const AI_JOB_TYPES = [
|
|
9
|
+
'loan-memo-excel',
|
|
10
|
+
'approval-memo',
|
|
11
|
+
'email-summary',
|
|
12
|
+
] as const;
|
|
13
|
+
|
|
14
|
+
export type TAIJobType = (typeof AI_JOB_TYPES)[number];
|
|
15
|
+
|
|
8
16
|
export interface IAIJobResponseChunk {
|
|
9
17
|
type: 'text' | 'thinking' | 'tool' | 'status';
|
|
10
18
|
timestamp: Date;
|
|
@@ -51,6 +59,8 @@ export interface IAIJob {
|
|
|
51
59
|
taskId: string;
|
|
52
60
|
userId: string;
|
|
53
61
|
|
|
62
|
+
taskType: TAIJobType;
|
|
63
|
+
|
|
54
64
|
status: TTaskStatus;
|
|
55
65
|
|
|
56
66
|
target: IAIJobTarget;
|
|
@@ -109,6 +119,12 @@ export const AIJobSchema = new mongoose.Schema<IAIJob, TAIJobModel>(
|
|
|
109
119
|
type: 'String',
|
|
110
120
|
required: true,
|
|
111
121
|
},
|
|
122
|
+
taskType: {
|
|
123
|
+
type: String,
|
|
124
|
+
enum: AI_JOB_TYPES,
|
|
125
|
+
required: true,
|
|
126
|
+
index: true,
|
|
127
|
+
},
|
|
112
128
|
status: {
|
|
113
129
|
type: String,
|
|
114
130
|
required: true,
|
|
@@ -221,6 +237,12 @@ export const AIJobSchema = new mongoose.Schema<IAIJob, TAIJobModel>(
|
|
|
221
237
|
},
|
|
222
238
|
);
|
|
223
239
|
|
|
240
|
+
AIJobSchema.index({
|
|
241
|
+
userId: 1,
|
|
242
|
+
taskType: 1,
|
|
243
|
+
createdAt: -1,
|
|
244
|
+
});
|
|
245
|
+
|
|
224
246
|
AIJobSchema.index(
|
|
225
247
|
{ taskId: 1, userId: 1, status: 1 },
|
|
226
248
|
{ unique: true },
|