@common_ch/common 1.0.311 → 1.0.312
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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PromptTypeEnum = void 0;
|
|
4
|
+
var PromptTypeEnum;
|
|
5
|
+
(function (PromptTypeEnum) {
|
|
6
|
+
PromptTypeEnum["personal"] = "personal";
|
|
7
|
+
PromptTypeEnum["init"] = "init";
|
|
8
|
+
PromptTypeEnum["requestType"] = "request-type";
|
|
9
|
+
PromptTypeEnum["summary"] = "summary";
|
|
10
|
+
})(PromptTypeEnum || (exports.PromptTypeEnum = PromptTypeEnum = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { UserDoc } from './user';
|
|
3
|
+
import { PromptTypeEnum } from '../../enums/prompt';
|
|
4
|
+
import { AiDoc } from './ai';
|
|
5
|
+
export interface PromptAttrs {
|
|
6
|
+
_id?: string;
|
|
7
|
+
prompt: string;
|
|
8
|
+
userId?: string | UserDoc;
|
|
9
|
+
promptType: PromptTypeEnum;
|
|
10
|
+
aiId: string | AiDoc;
|
|
11
|
+
description?: string;
|
|
12
|
+
version?: number;
|
|
13
|
+
createdAt?: string;
|
|
14
|
+
updatedAt?: string;
|
|
15
|
+
}
|
|
16
|
+
interface PromptModel extends mongoose.Model<PromptDoc> {
|
|
17
|
+
build(attrs: PromptAttrs): PromptDoc;
|
|
18
|
+
}
|
|
19
|
+
export interface PromptDoc extends mongoose.Document {
|
|
20
|
+
_id: string;
|
|
21
|
+
prompt: string;
|
|
22
|
+
userId?: string | UserDoc;
|
|
23
|
+
promptType: PromptTypeEnum;
|
|
24
|
+
aiId: string | AiDoc;
|
|
25
|
+
description?: string;
|
|
26
|
+
version?: number;
|
|
27
|
+
createdAt?: string;
|
|
28
|
+
updatedAt?: string;
|
|
29
|
+
}
|
|
30
|
+
declare const Prompt: PromptModel;
|
|
31
|
+
export { Prompt };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Prompt = void 0;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
+
const prompt_1 = require("../../enums/prompt");
|
|
10
|
+
const promptSchema = new mongoose_1.default.Schema({
|
|
11
|
+
prompt: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
description: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: false,
|
|
18
|
+
},
|
|
19
|
+
promptType: {
|
|
20
|
+
type: String,
|
|
21
|
+
enum: prompt_1.PromptTypeEnum,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
userId: {
|
|
25
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
26
|
+
ref: 'User',
|
|
27
|
+
required: false,
|
|
28
|
+
},
|
|
29
|
+
aiId: {
|
|
30
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
31
|
+
ref: 'Ai',
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
createdAt: {
|
|
35
|
+
type: mongoose_1.default.Schema.Types.Date,
|
|
36
|
+
},
|
|
37
|
+
updatedAt: {
|
|
38
|
+
type: mongoose_1.default.Schema.Types.Date,
|
|
39
|
+
},
|
|
40
|
+
}, {
|
|
41
|
+
timestamps: true,
|
|
42
|
+
});
|
|
43
|
+
promptSchema.set('versionKey', 'version');
|
|
44
|
+
promptSchema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
|
|
45
|
+
promptSchema.index({ userId: 1 });
|
|
46
|
+
promptSchema.index({ aiId: 1 });
|
|
47
|
+
promptSchema.index({ promptType: 1 });
|
|
48
|
+
promptSchema.statics.build = (attrs) => {
|
|
49
|
+
return new Prompt(attrs);
|
|
50
|
+
};
|
|
51
|
+
const Prompt = mongoose_1.default.model('Prompt', promptSchema);
|
|
52
|
+
exports.Prompt = Prompt;
|