codebase-models 2.0.4 → 2.0.6
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/dist/index.d.ts +4 -1
- package/dist/index.js +8 -1
- package/dist/src/constant.d.ts +7 -0
- package/dist/src/constant.js +17 -0
- package/dist/src/models/Announcement.d.ts +1 -0
- package/dist/src/models/Announcement.js +31 -0
- package/dist/src/models/Audience.d.ts +1 -0
- package/dist/src/models/Audience.js +31 -0
- package/dist/src/models/BqPreCompiledData.d.ts +1 -0
- package/dist/src/models/BqPreCompiledData.js +31 -0
- package/dist/src/models/Client.d.ts +1 -0
- package/dist/src/models/Client.js +31 -0
- package/dist/src/models/ClientAdditionalRevenue.d.ts +3 -1
- package/dist/src/models/ClientAdditionalRevenue.js +48 -0
- package/dist/src/models/ClientLearning.d.ts +1 -0
- package/dist/src/models/ClientLearning.js +31 -0
- package/dist/src/models/ClientLinks.d.ts +1 -0
- package/dist/src/models/ClientLinks.js +31 -0
- package/dist/src/models/ClientNextSteps.d.ts +1 -0
- package/dist/src/models/ClientNextSteps.js +30 -0
- package/dist/src/models/ClientNote.d.ts +1 -0
- package/dist/src/models/ClientNote.js +31 -0
- package/dist/src/models/ClientScript.d.ts +12 -11
- package/dist/src/models/ClientScript.js +54 -8
- package/dist/src/models/ClientStrategy.d.ts +1 -0
- package/dist/src/models/ClientStrategy.js +31 -0
- package/dist/src/models/CustomQuery.d.ts +38 -0
- package/dist/src/models/CustomQuery.js +68 -0
- package/dist/src/models/Environment.d.ts +2 -0
- package/dist/src/models/Environment.js +34 -0
- package/dist/src/models/Goal.d.ts +1 -0
- package/dist/src/models/Goal.js +31 -1
- package/dist/src/models/Page.d.ts +2 -0
- package/dist/src/models/Page.js +48 -0
- package/dist/src/models/Report.d.ts +1 -0
- package/dist/src/models/Report.js +30 -0
- package/dist/src/models/StageInCustomerJourney.d.ts +1 -0
- package/dist/src/models/StageInCustomerJourney.js +31 -0
- package/dist/src/models/Test.d.ts +2 -0
- package/dist/src/models/Test.js +46 -2
- package/dist/src/models/TestTimeline.d.ts +39 -0
- package/dist/src/models/TestTimeline.js +79 -0
- package/index.ts +6 -1
- package/package.json +3 -2
- package/src/constant.ts +17 -0
- package/src/models/Announcement.ts +22 -0
- package/src/models/Audience.ts +23 -0
- package/src/models/BqPreCompiledData.ts +22 -0
- package/src/models/Client.ts +22 -0
- package/src/models/ClientAdditionalRevenue.ts +42 -1
- package/src/models/ClientLearning.ts +22 -0
- package/src/models/ClientLinks.ts +23 -2
- package/src/models/ClientNextSteps.ts +20 -0
- package/src/models/ClientNote.ts +22 -1
- package/src/models/ClientScript.ts +56 -20
- package/src/models/ClientStrategy.ts +24 -0
- package/src/models/CustomQuery.ts +49 -0
- package/src/models/Environment.ts +27 -0
- package/src/models/Goal.ts +22 -2
- package/src/models/Page.ts +43 -0
- package/src/models/Report.ts +22 -0
- package/src/models/StageInCustomerJourney.ts +22 -0
- package/src/models/Test.ts +40 -3
- package/src/models/TestTimeline.ts +61 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
import { generateRandomIID } from "../constant";
|
|
3
|
+
|
|
4
|
+
export interface ITestTimeline extends Document {
|
|
5
|
+
iid: string;
|
|
6
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
7
|
+
test: mongoose.Schema.Types.ObjectId;
|
|
8
|
+
event: string;
|
|
9
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
10
|
+
user: mongoose.Schema.Types.ObjectId;
|
|
11
|
+
changes: {
|
|
12
|
+
type: mongoose.Schema.Types.Mixed,
|
|
13
|
+
default: {},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const TestTimelineSchema = new Schema<ITestTimeline>({
|
|
17
|
+
iid: {
|
|
18
|
+
type: String,
|
|
19
|
+
unique: true,
|
|
20
|
+
},
|
|
21
|
+
event: {
|
|
22
|
+
type: String,
|
|
23
|
+
enum: ["test_created", "test_updated", "test_deleted"],
|
|
24
|
+
},
|
|
25
|
+
organizationId: {
|
|
26
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
27
|
+
ref: "organization",
|
|
28
|
+
default: null,
|
|
29
|
+
},
|
|
30
|
+
client: {
|
|
31
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
32
|
+
ref: "client",
|
|
33
|
+
},
|
|
34
|
+
test: {
|
|
35
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
36
|
+
ref: "test",
|
|
37
|
+
},
|
|
38
|
+
user: {
|
|
39
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
40
|
+
ref: "user",
|
|
41
|
+
},
|
|
42
|
+
changes: {
|
|
43
|
+
type: mongoose.Schema.Types.Mixed,
|
|
44
|
+
default: {},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
timestamps: true,
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
TestTimelineSchema.pre("save", async function (next) {
|
|
52
|
+
if (!this.iid) {
|
|
53
|
+
this.iid = generateRandomIID();
|
|
54
|
+
}
|
|
55
|
+
next();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const TestTimeline = mongoose.models.testTimeline || model<ITestTimeline>("testTimeline", TestTimelineSchema);
|
|
60
|
+
|
|
61
|
+
export default TestTimeline;
|