forked from Prompt-Hash-Stellar/prompt-hash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPromptVersion.ts
More file actions
38 lines (34 loc) · 732 Bytes
/
Copy pathPromptVersion.ts
File metadata and controls
38 lines (34 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import mongoose from "mongoose";
const promptVersionSchema = new mongoose.Schema(
{
promptId: {
type: String,
required: true,
index: true,
},
versionIndex: {
type: Number,
required: true,
},
content: {
type: String,
required: true,
},
changeNote: {
type: String,
default: "",
trim: true,
},
createdBy: {
type: String,
required: true,
lowercase: true,
},
},
{ timestamps: true },
);
promptVersionSchema.index({ promptId: 1, versionIndex: 1 }, { unique: true });
const PromptVersion =
mongoose.models.PromptVersion ||
mongoose.model("PromptVersion", promptVersionSchema);
export default PromptVersion;