codebase-models 2.0.0 → 2.0.2
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/src/models/Announcement.d.ts +1 -3
- package/dist/src/models/Announcement.js +1 -1
- package/dist/src/models/AppEvent.d.ts +1 -3
- package/dist/src/models/AppEvent.js +1 -1
- package/dist/src/models/Audience.d.ts +1 -3
- package/dist/src/models/Audience.js +1 -1
- package/dist/src/models/BqPreCompiledData.d.ts +1 -3
- package/dist/src/models/BqPreCompiledData.js +1 -1
- package/dist/src/models/CVRReport.d.ts +1 -3
- package/dist/src/models/CVRReport.js +1 -2
- package/dist/src/models/Client.d.ts +1 -3
- package/dist/src/models/Client.js +1 -1
- package/dist/src/models/ClientAdditionalRevenue.d.ts +1 -3
- package/dist/src/models/ClientAdditionalRevenue.js +1 -1
- package/dist/src/models/ClientLearning.d.ts +1 -3
- package/dist/src/models/ClientLearning.js +1 -1
- package/dist/src/models/ClientLinks.d.ts +1 -3
- package/dist/src/models/ClientLinks.js +1 -1
- package/dist/src/models/ClientNextSteps.d.ts +1 -3
- package/dist/src/models/ClientNextSteps.js +1 -1
- package/dist/src/models/ClientNote.d.ts +1 -3
- package/dist/src/models/ClientNote.js +1 -1
- package/dist/src/models/ClientReportsTemp.d.ts +1 -3
- package/dist/src/models/ClientReportsTemp.js +1 -3
- package/dist/src/models/ClientRetention.d.ts +1 -3
- package/dist/src/models/ClientRetention.js +1 -3
- package/dist/src/models/ClientScript.d.ts +1 -3
- package/dist/src/models/ClientScript.js +1 -2
- package/dist/src/models/ClientStrategy.d.ts +1 -3
- package/dist/src/models/ClientStrategy.js +1 -1
- package/dist/src/models/ClientSurvay.d.ts +1 -7
- package/dist/src/models/ClientSurvay.js +1 -1
- package/dist/src/models/Environment.d.ts +1 -3
- package/dist/src/models/Environment.js +1 -5
- package/dist/src/models/Faqs.d.ts +1 -3
- package/dist/src/models/Faqs.js +1 -1
- package/dist/src/models/Feedback.d.ts +1 -3
- package/dist/src/models/Feedback.js +1 -1
- package/dist/src/models/Goal.d.ts +1 -3
- package/dist/src/models/Goal.js +1 -4
- package/dist/src/models/Hypothesis.d.ts +1 -3
- package/dist/src/models/Hypothesis.js +1 -5
- package/dist/src/models/HypothesisSheet.d.ts +1 -3
- package/dist/src/models/HypothesisSheet.js +1 -1
- package/dist/src/models/LandingPages.d.ts +1 -3
- package/dist/src/models/LandingPages.js +1 -6
- package/dist/src/models/NewIdeas.d.ts +1 -3
- package/dist/src/models/NewIdeas.js +1 -1
- package/dist/src/models/Notification.d.ts +1 -3
- package/dist/src/models/Notification.js +1 -1
- package/dist/src/models/Organization.d.ts +1 -3
- package/dist/src/models/Organization.js +1 -1
- package/dist/src/models/Page.d.ts +1 -3
- package/dist/src/models/Page.js +1 -8
- package/dist/src/models/PageElement.d.ts +1 -3
- package/dist/src/models/PageElement.js +1 -5
- package/dist/src/models/PageTestType.d.ts +1 -3
- package/dist/src/models/PageTestType.js +1 -1
- package/dist/src/models/Portfolio.d.ts +1 -3
- package/dist/src/models/Portfolio.js +1 -1
- package/dist/src/models/PrecalculationFilters.d.ts +1 -3
- package/dist/src/models/PrecalculationFilters.js +2 -1
- package/dist/src/models/QueryLog.d.ts +1 -3
- package/dist/src/models/QueryLog.js +1 -1
- package/dist/src/models/ReadNotification.d.ts +1 -3
- package/dist/src/models/ReadNotification.js +1 -1
- package/dist/src/models/Report.d.ts +1 -3
- package/dist/src/models/Report.js +1 -1
- package/dist/src/models/Role.d.ts +1 -3
- package/dist/src/models/Role.js +1 -1
- package/dist/src/models/SavedSegment.d.ts +1 -3
- package/dist/src/models/SavedSegment.js +1 -1
- package/dist/src/models/Segment.d.ts +1 -3
- package/dist/src/models/Segment.js +1 -1
- package/dist/src/models/SegmentCombination.d.ts +1 -3
- package/dist/src/models/SegmentCombination.js +1 -1
- package/dist/src/models/Snippet.d.ts +1 -3
- package/dist/src/models/Snippet.js +1 -5
- package/dist/src/models/StageInCustomerJourney.d.ts +1 -3
- package/dist/src/models/StageInCustomerJourney.js +1 -1
- package/dist/src/models/Tag.d.ts +1 -3
- package/dist/src/models/Tag.js +1 -1
- package/dist/src/models/Temp.d.ts +1 -3
- package/dist/src/models/Temp.js +1 -1
- package/dist/src/models/Test.d.ts +1 -3
- package/dist/src/models/Test.js +1 -1
- package/dist/src/models/TestSequentialValue.d.ts +1 -3
- package/dist/src/models/TestSequentialValue.js +1 -1
- package/dist/src/models/Tier.d.ts +1 -3
- package/dist/src/models/Tier.js +1 -1
- package/dist/src/models/Trigger.d.ts +1 -3
- package/dist/src/models/Trigger.js +1 -1
- package/dist/src/models/User.d.ts +1 -3
- package/dist/src/models/User.js +1 -1
- package/package.json +1 -1
- package/src/models/Announcement.ts +1 -1
- package/src/models/AppEvent.ts +1 -1
- package/src/models/Audience.ts +1 -1
- package/src/models/BqPreCompiledData.ts +1 -1
- package/src/models/CVRReport.ts +1 -2
- package/src/models/Client.ts +1 -1
- package/src/models/ClientAdditionalRevenue.ts +1 -1
- package/src/models/ClientLearning.ts +1 -1
- package/src/models/ClientLinks.ts +1 -1
- package/src/models/ClientNextSteps.ts +1 -1
- package/src/models/ClientNote.ts +1 -1
- package/src/models/ClientReportsTemp.ts +1 -3
- package/src/models/ClientRetention.ts +1 -3
- package/src/models/ClientScript.ts +1 -2
- package/src/models/ClientStrategy.ts +1 -1
- package/src/models/ClientSurvay.ts +1 -1
- package/src/models/Environment.ts +2 -6
- package/src/models/Faqs.ts +1 -1
- package/src/models/Feedback.ts +1 -1
- package/src/models/Goal.ts +1 -4
- package/src/models/Hypothesis.ts +1 -5
- package/src/models/HypothesisSheet.ts +1 -1
- package/src/models/LandingPages.ts +1 -6
- package/src/models/NewIdeas.ts +1 -1
- package/src/models/Notification.ts +1 -1
- package/src/models/Organization.ts +1 -1
- package/src/models/Page.ts +4 -8
- package/src/models/PageElement.ts +1 -5
- package/src/models/PageTestType.ts +1 -1
- package/src/models/Portfolio.ts +1 -1
- package/src/models/PrecalculationFilters.ts +2 -1
- package/src/models/QueryLog.ts +1 -1
- package/src/models/ReadNotification.ts +1 -1
- package/src/models/Report.ts +1 -1
- package/src/models/Role.ts +1 -1
- package/src/models/SavedSegment.ts +1 -1
- package/src/models/Segment.ts +1 -1
- package/src/models/SegmentCombination.ts +1 -1
- package/src/models/Snippet.ts +1 -5
- package/src/models/StageInCustomerJourney.ts +1 -1
- package/src/models/Tag.ts +1 -1
- package/src/models/Temp.ts +1 -1
- package/src/models/Test.ts +1 -1
- package/src/models/TestSequentialValue.ts +1 -1
- package/src/models/Tier.ts +1 -1
- package/src/models/Trigger.ts +1 -1
- package/src/models/User.ts +1 -1
|
@@ -26,7 +26,6 @@ const ClientRetentionSchema = new Schema<IClientRetention>(
|
|
|
26
26
|
type: mongoose.Schema.Types.ObjectId,
|
|
27
27
|
ref: "client",
|
|
28
28
|
required: true,
|
|
29
|
-
index: true,
|
|
30
29
|
},
|
|
31
30
|
viewId: {
|
|
32
31
|
type: String,
|
|
@@ -36,7 +35,6 @@ const ClientRetentionSchema = new Schema<IClientRetention>(
|
|
|
36
35
|
type: Number,
|
|
37
36
|
required: true,
|
|
38
37
|
default: new Date().getFullYear(),
|
|
39
|
-
index: true,
|
|
40
38
|
},
|
|
41
39
|
retentions: {
|
|
42
40
|
type: [
|
|
@@ -101,7 +99,7 @@ ClientRetentionSchema.index(
|
|
|
101
99
|
// Index for sorting by retainer value
|
|
102
100
|
ClientRetentionSchema.index({ "retentions.retainerValue": -1 });
|
|
103
101
|
|
|
104
|
-
const ClientRetention = model<IClientRetention>(
|
|
102
|
+
const ClientRetention = mongoose.models.clientretention || model<IClientRetention>(
|
|
105
103
|
"ClientRetention",
|
|
106
104
|
ClientRetentionSchema
|
|
107
105
|
);
|
|
@@ -49,7 +49,6 @@ const ClientScriptSchema = new Schema<IClientScript>(
|
|
|
49
49
|
client: {
|
|
50
50
|
type: mongoose.Schema.Types.ObjectId,
|
|
51
51
|
ref: "client",
|
|
52
|
-
index: true,
|
|
53
52
|
},
|
|
54
53
|
viewId: {
|
|
55
54
|
type: String,
|
|
@@ -176,6 +175,6 @@ ClientScriptSchema.index({ tracker_url: 1 }, { sparse: true });
|
|
|
176
175
|
ClientScriptSchema.index({ asset_url: 1 }, { sparse: true });
|
|
177
176
|
|
|
178
177
|
|
|
179
|
-
const ClientScript = model<IClientScript>("clientscript", ClientScriptSchema);
|
|
178
|
+
const ClientScript = mongoose.models.clientscript || model<IClientScript>("clientscript", ClientScriptSchema);
|
|
180
179
|
|
|
181
180
|
export default ClientScript;
|
|
@@ -14,18 +14,15 @@ const EnvironmentSchema = new Schema<IEnvironment>({
|
|
|
14
14
|
required: true,
|
|
15
15
|
default: 'Default',
|
|
16
16
|
trim: true,
|
|
17
|
-
index: true,
|
|
18
17
|
},
|
|
19
18
|
client: {
|
|
20
19
|
type: mongoose.Schema.Types.ObjectId,
|
|
21
20
|
ref: "client",
|
|
22
21
|
required: true,
|
|
23
|
-
index: true,
|
|
24
22
|
},
|
|
25
23
|
organizationId: {
|
|
26
24
|
type: mongoose.Schema.Types.ObjectId,
|
|
27
25
|
ref: "organization",
|
|
28
|
-
index: true,
|
|
29
26
|
},
|
|
30
27
|
rules_js: {
|
|
31
28
|
type: String,
|
|
@@ -35,8 +32,7 @@ const EnvironmentSchema = new Schema<IEnvironment>({
|
|
|
35
32
|
isActive: {
|
|
36
33
|
type: Boolean,
|
|
37
34
|
default: true,
|
|
38
|
-
|
|
39
|
-
}
|
|
35
|
+
}
|
|
40
36
|
}, {
|
|
41
37
|
timestamps: true
|
|
42
38
|
});
|
|
@@ -52,6 +48,6 @@ EnvironmentSchema.index({ organizationId: 1, name: 1 }, {
|
|
|
52
48
|
// Text index for full-text search
|
|
53
49
|
EnvironmentSchema.index({ name: 'text' });
|
|
54
50
|
|
|
55
|
-
const Environment = model<IEnvironment>("environment", EnvironmentSchema);
|
|
51
|
+
const Environment = mongoose.models.environment || model<IEnvironment>("environment", EnvironmentSchema);
|
|
56
52
|
|
|
57
53
|
export default Environment;
|
package/src/models/Faqs.ts
CHANGED
package/src/models/Feedback.ts
CHANGED
package/src/models/Goal.ts
CHANGED
|
@@ -39,12 +39,10 @@ const GoalSchema = new Schema<IGoal>({
|
|
|
39
39
|
type: mongoose.Schema.Types.ObjectId,
|
|
40
40
|
ref: "organization",
|
|
41
41
|
default: null,
|
|
42
|
-
index: true,
|
|
43
42
|
},
|
|
44
43
|
client: {
|
|
45
44
|
type: mongoose.Schema.Types.ObjectId,
|
|
46
45
|
ref: "client",
|
|
47
|
-
index: true,
|
|
48
46
|
},
|
|
49
47
|
type: {
|
|
50
48
|
type: String,
|
|
@@ -72,7 +70,6 @@ const GoalSchema = new Schema<IGoal>({
|
|
|
72
70
|
isActive: {
|
|
73
71
|
type: Boolean,
|
|
74
72
|
default: true,
|
|
75
|
-
index: true,
|
|
76
73
|
}
|
|
77
74
|
}, {
|
|
78
75
|
timestamps: true
|
|
@@ -84,6 +81,6 @@ GoalSchema.index({ client: 1, isActive: 1 });
|
|
|
84
81
|
GoalSchema.index({ organizationId: 1, client: 1 });
|
|
85
82
|
GoalSchema.index({ client: 1, name: 1 }, { unique: true });
|
|
86
83
|
|
|
87
|
-
const Goal = model<IGoal>("goal", GoalSchema);
|
|
84
|
+
const Goal = mongoose.models.goal || model<IGoal>("goal", GoalSchema);
|
|
88
85
|
|
|
89
86
|
export default Goal;
|
package/src/models/Hypothesis.ts
CHANGED
|
@@ -22,13 +22,11 @@ const HypothesisSchema = new Schema<IHypothesis>({
|
|
|
22
22
|
hypothesisNumber: {
|
|
23
23
|
type: String,
|
|
24
24
|
trim: true,
|
|
25
|
-
index: true,
|
|
26
25
|
},
|
|
27
26
|
name: {
|
|
28
27
|
type: String,
|
|
29
28
|
required: true,
|
|
30
29
|
trim: true,
|
|
31
|
-
index: true,
|
|
32
30
|
},
|
|
33
31
|
action: {
|
|
34
32
|
type: String,
|
|
@@ -49,12 +47,10 @@ const HypothesisSchema = new Schema<IHypothesis>({
|
|
|
49
47
|
type: String,
|
|
50
48
|
default: "General Purpose",
|
|
51
49
|
trim: true,
|
|
52
|
-
index: true,
|
|
53
50
|
},
|
|
54
51
|
isActive: {
|
|
55
52
|
type: Boolean,
|
|
56
53
|
default: true,
|
|
57
|
-
index: true,
|
|
58
54
|
}
|
|
59
55
|
}, {
|
|
60
56
|
timestamps: true
|
|
@@ -66,6 +62,6 @@ HypothesisSchema.index({ tagged: 1, isActive: 1 });
|
|
|
66
62
|
HypothesisSchema.index({ name: 1, isActive: 1 });
|
|
67
63
|
|
|
68
64
|
|
|
69
|
-
const Hypothesis = model<IHypothesis>("
|
|
65
|
+
const Hypothesis = mongoose.models.hypothesis || model<IHypothesis>("hypothesis", HypothesisSchema);
|
|
70
66
|
|
|
71
67
|
export default Hypothesis;
|
|
@@ -107,7 +107,7 @@ const HypothesisSheetSchema = new Schema<IHypothesisSheet>(
|
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
109
|
|
|
110
|
-
const HypothesisSheet = model<IHypothesisSheet>(
|
|
110
|
+
const HypothesisSheet = mongoose.models.hypothesissheet || model<IHypothesisSheet>(
|
|
111
111
|
"hypothesisSheet",
|
|
112
112
|
HypothesisSheetSchema
|
|
113
113
|
);
|
|
@@ -10,7 +10,6 @@ const LandingPageDataSchema = new Schema<ILandingPagesData>({
|
|
|
10
10
|
type: Number,
|
|
11
11
|
min: 0,
|
|
12
12
|
max: 100,
|
|
13
|
-
index: true,
|
|
14
13
|
},
|
|
15
14
|
lastUpdated: {
|
|
16
15
|
type: Date,
|
|
@@ -33,18 +32,15 @@ const LandingPagesSchema = new Schema<ILandingPages>(
|
|
|
33
32
|
type: String,
|
|
34
33
|
required: true,
|
|
35
34
|
trim: true,
|
|
36
|
-
index: true,
|
|
37
35
|
},
|
|
38
36
|
client: {
|
|
39
37
|
type: mongoose.Schema.Types.ObjectId,
|
|
40
38
|
ref: "client",
|
|
41
39
|
required: true,
|
|
42
|
-
index: true,
|
|
43
40
|
},
|
|
44
41
|
organizationId: {
|
|
45
42
|
type: mongoose.Schema.Types.ObjectId,
|
|
46
43
|
ref: "organization",
|
|
47
|
-
index: true,
|
|
48
44
|
},
|
|
49
45
|
screenshot: {
|
|
50
46
|
type: String,
|
|
@@ -58,7 +54,6 @@ const LandingPagesSchema = new Schema<ILandingPages>(
|
|
|
58
54
|
isActive: {
|
|
59
55
|
type: Boolean,
|
|
60
56
|
default: true,
|
|
61
|
-
index: true,
|
|
62
57
|
}
|
|
63
58
|
},
|
|
64
59
|
{
|
|
@@ -76,5 +71,5 @@ LandingPagesSchema.index({ client: 1, 'dataPoints.conversionRate': -1 });
|
|
|
76
71
|
// Text index for full-text search
|
|
77
72
|
LandingPagesSchema.index({ title: 'text' });
|
|
78
73
|
|
|
79
|
-
const LandingPages = model<ILandingPages>("
|
|
74
|
+
const LandingPages = mongoose.models.landingpages || model<ILandingPages>("landingpages", LandingPagesSchema);
|
|
80
75
|
export default LandingPages;
|
package/src/models/NewIdeas.ts
CHANGED
|
@@ -48,6 +48,6 @@ const NotificationSchema = new Schema<INotification>(
|
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
|
|
51
|
-
const Notification = model<INotification>("notification", NotificationSchema);
|
|
51
|
+
const Notification = mongoose.models.notification || model<INotification>("notification", NotificationSchema);
|
|
52
52
|
|
|
53
53
|
export default Notification;
|
|
@@ -79,7 +79,7 @@ const OrganizationSchema = new Schema<IOrganization>({
|
|
|
79
79
|
}, {
|
|
80
80
|
timestamps: true
|
|
81
81
|
});
|
|
82
|
-
const Organization = model<IOrganization>("organization", OrganizationSchema);
|
|
82
|
+
const Organization = mongoose.models.organization || model<IOrganization>("organization", OrganizationSchema);
|
|
83
83
|
|
|
84
84
|
OrganizationSchema.index({ name: 1, isActive: 1 });
|
|
85
85
|
|
package/src/models/Page.ts
CHANGED
|
@@ -45,25 +45,23 @@ const PageSchema = new Schema<IPage>({
|
|
|
45
45
|
type: String,
|
|
46
46
|
required: true,
|
|
47
47
|
trim: true,
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
},
|
|
50
50
|
trigger: {
|
|
51
51
|
type: String,
|
|
52
52
|
default: "direct",
|
|
53
53
|
trim: true,
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
},
|
|
56
56
|
organizationId: {
|
|
57
57
|
type: mongoose.Schema.Types.ObjectId,
|
|
58
58
|
ref: "organization",
|
|
59
59
|
default: null,
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
},
|
|
62
62
|
client: {
|
|
63
63
|
type: mongoose.Schema.Types.ObjectId,
|
|
64
64
|
ref: "client",
|
|
65
|
-
required: true,
|
|
66
|
-
index: true,
|
|
67
65
|
},
|
|
68
66
|
trigger_js: {
|
|
69
67
|
type: String,
|
|
@@ -80,7 +78,6 @@ const PageSchema = new Schema<IPage>({
|
|
|
80
78
|
poll_on_rules: {
|
|
81
79
|
type: Boolean,
|
|
82
80
|
default: false,
|
|
83
|
-
index: true,
|
|
84
81
|
},
|
|
85
82
|
deactivation_mode: {
|
|
86
83
|
type: String,
|
|
@@ -96,7 +93,6 @@ const PageSchema = new Schema<IPage>({
|
|
|
96
93
|
isActive: {
|
|
97
94
|
type: Boolean,
|
|
98
95
|
default: true,
|
|
99
|
-
index: true,
|
|
100
96
|
}
|
|
101
97
|
}, {
|
|
102
98
|
timestamps: true
|
|
@@ -121,6 +117,6 @@ PageSchema.index({ organizationId: 1, name: 1 });
|
|
|
121
117
|
// }
|
|
122
118
|
// });
|
|
123
119
|
|
|
124
|
-
const Page = model<IPage>("page", PageSchema);
|
|
120
|
+
const Page = mongoose.models.page || model<IPage>("page", PageSchema);
|
|
125
121
|
|
|
126
122
|
export default Page;
|
|
@@ -17,7 +17,6 @@ const PageElementSchema = new Schema<IPageElement>({
|
|
|
17
17
|
type: String,
|
|
18
18
|
required: true,
|
|
19
19
|
trim: true,
|
|
20
|
-
index: true,
|
|
21
20
|
},
|
|
22
21
|
slug: {
|
|
23
22
|
type: String,
|
|
@@ -35,13 +34,10 @@ const PageElementSchema = new Schema<IPageElement>({
|
|
|
35
34
|
client: {
|
|
36
35
|
type: mongoose.Schema.Types.ObjectId,
|
|
37
36
|
ref: "client",
|
|
38
|
-
required: true,
|
|
39
|
-
index: true,
|
|
40
37
|
},
|
|
41
38
|
isActive: {
|
|
42
39
|
type: Boolean,
|
|
43
40
|
default: true,
|
|
44
|
-
index: true,
|
|
45
41
|
}
|
|
46
42
|
}, {
|
|
47
43
|
timestamps: true
|
|
@@ -56,6 +52,6 @@ PageElementSchema.index({ organizationId: 1, name: 1 });
|
|
|
56
52
|
// Text index for full-text search
|
|
57
53
|
PageElementSchema.index({ name: 'text' });
|
|
58
54
|
|
|
59
|
-
const PageElement = model<IPageElement>("pageelement", PageElementSchema);
|
|
55
|
+
const PageElement = mongoose.models.pageelement || model<IPageElement>("pageelement", PageElementSchema);
|
|
60
56
|
|
|
61
57
|
export default PageElement;
|
|
@@ -44,6 +44,6 @@ const PageTestTypeSchema = new Schema<IPageTestType>({
|
|
|
44
44
|
PageTestTypeSchema.index({ name: 1, isActive: 1 });
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
const PageTestType = model<IPageTestType>("pagetesttype", PageTestTypeSchema);
|
|
47
|
+
const PageTestType = mongoose.models.pagetesttype || model<IPageTestType>("pagetesttype", PageTestTypeSchema);
|
|
48
48
|
|
|
49
49
|
export default PageTestType;
|
package/src/models/Portfolio.ts
CHANGED
|
@@ -62,6 +62,7 @@ const PrecalculationFiltersSchema = new Schema<IPrecalculationFilters>({
|
|
|
62
62
|
PrecalculationFiltersSchema.index({ organizationId: 1, test: 1 });
|
|
63
63
|
PrecalculationFiltersSchema.index({ organizationId: 1, client: 1 });
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
// Check if model is already registered
|
|
66
|
+
const PrecalculationFilters = mongoose.models.precalculationfilter || model<IPrecalculationFilters>("precalculationfilter", PrecalculationFiltersSchema);
|
|
66
67
|
|
|
67
68
|
export default PrecalculationFilters;
|
package/src/models/QueryLog.ts
CHANGED
|
@@ -32,7 +32,7 @@ const ReadNotificationSchema = new Schema<IReadNotification>(
|
|
|
32
32
|
}
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
const ReadNotification = model<IReadNotification>(
|
|
35
|
+
const ReadNotification = mongoose.models.readnotification || model<IReadNotification>(
|
|
36
36
|
"readnotification",
|
|
37
37
|
ReadNotificationSchema
|
|
38
38
|
);
|
package/src/models/Report.ts
CHANGED
|
@@ -75,6 +75,6 @@ ReportsSchema.index({ client: 1, gaTestId: 1 }); // For GA test ID lookups
|
|
|
75
75
|
ReportsSchema.index({ createdBy: 1, to: -1 }); // For user's reports
|
|
76
76
|
ReportsSchema.index({ client: 1, excludedFromCalculations: 1 }); // For calculation exclusions
|
|
77
77
|
|
|
78
|
-
const Report = model<IReports>("report", ReportsSchema);
|
|
78
|
+
const Report = mongoose.models.report || model<IReports>("report", ReportsSchema);
|
|
79
79
|
|
|
80
80
|
export default Report;
|
package/src/models/Role.ts
CHANGED
|
@@ -32,6 +32,6 @@ const SavedSegmentSchema = new Schema<ISavedSegment>(
|
|
|
32
32
|
}
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
const SavedSegment = model<ISavedSegment>("savedsegment", SavedSegmentSchema);
|
|
35
|
+
const SavedSegment = mongoose.models.savedsegment || model<ISavedSegment>("savedsegment", SavedSegmentSchema);
|
|
36
36
|
|
|
37
37
|
export default SavedSegment;
|
package/src/models/Segment.ts
CHANGED
|
@@ -60,7 +60,7 @@ const SegmentSchema = new Schema<ISegmentCombination>({
|
|
|
60
60
|
},
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
const SegmentCombination = model<ISegmentCombination>(
|
|
63
|
+
const SegmentCombination = mongoose.models.segmentcombination || model<ISegmentCombination>(
|
|
64
64
|
"segmentcombination",
|
|
65
65
|
SegmentSchema
|
|
66
66
|
);
|
package/src/models/Snippet.ts
CHANGED
|
@@ -41,7 +41,6 @@ const SnippetSchema = new Schema<ISnippet>(
|
|
|
41
41
|
type: mongoose.Schema.Types.ObjectId,
|
|
42
42
|
ref: "client",
|
|
43
43
|
required: true,
|
|
44
|
-
index: true,
|
|
45
44
|
},
|
|
46
45
|
details: {
|
|
47
46
|
type: String,
|
|
@@ -56,7 +55,6 @@ const SnippetSchema = new Schema<ISnippet>(
|
|
|
56
55
|
type: [mongoose.Schema.Types.ObjectId],
|
|
57
56
|
ref: "tag",
|
|
58
57
|
default: [],
|
|
59
|
-
index: true,
|
|
60
58
|
},
|
|
61
59
|
htmlcode: {
|
|
62
60
|
type: String,
|
|
@@ -81,12 +79,10 @@ const SnippetSchema = new Schema<ISnippet>(
|
|
|
81
79
|
type: String,
|
|
82
80
|
default: "live",
|
|
83
81
|
enum: ["live", "draft","running","paused","preview","ended"],
|
|
84
|
-
index: true,
|
|
85
82
|
},
|
|
86
83
|
isActive: {
|
|
87
84
|
type: Boolean,
|
|
88
85
|
default: true,
|
|
89
|
-
index: true,
|
|
90
86
|
}
|
|
91
87
|
},
|
|
92
88
|
{
|
|
@@ -101,6 +97,6 @@ SnippetSchema.index({ client: 1, tags: 1 });
|
|
|
101
97
|
SnippetSchema.index({ client: 1, pageelement: 1 });
|
|
102
98
|
|
|
103
99
|
|
|
104
|
-
const Snippet = model<ISnippet>("snippet", SnippetSchema);
|
|
100
|
+
const Snippet = mongoose.models.snippet || model<ISnippet>("snippet", SnippetSchema);
|
|
105
101
|
|
|
106
102
|
export default Snippet;
|
|
@@ -55,7 +55,7 @@ const StageInCustomerJourneySchema = new Schema<IStageInCustomerJourney>(
|
|
|
55
55
|
|
|
56
56
|
// Compound indexes for common query patterns
|
|
57
57
|
// StageInCustomerJourneySchema.index({ client: 1, slug: 1 });
|
|
58
|
-
const StageInCustomerJourney = model<IStageInCustomerJourney>(
|
|
58
|
+
const StageInCustomerJourney = mongoose.models.stageincustomerjourney || model<IStageInCustomerJourney>(
|
|
59
59
|
"stageincustomerjourney",
|
|
60
60
|
StageInCustomerJourneySchema
|
|
61
61
|
);
|
package/src/models/Tag.ts
CHANGED
package/src/models/Temp.ts
CHANGED
package/src/models/Test.ts
CHANGED
|
@@ -219,6 +219,6 @@ TestSchema.index({ client: 1, status: 1 }, { partialFilterExpression: { status:
|
|
|
219
219
|
// Add TTL index for automatic cleanup of ended tests after 1 year
|
|
220
220
|
TestSchema.index({ enddate: 1 }, { expireAfterSeconds: 31536000 });
|
|
221
221
|
|
|
222
|
-
const Test = model<ITest>("test", TestSchema);
|
|
222
|
+
const Test = mongoose.models.test || model<ITest>("test", TestSchema);
|
|
223
223
|
|
|
224
224
|
export default Test;
|
|
@@ -47,7 +47,7 @@ const TestSequentialValueSchema = new Schema<ITestSequentialValue>(
|
|
|
47
47
|
|
|
48
48
|
TestSequentialValueSchema.index({ test: 1 });
|
|
49
49
|
|
|
50
|
-
const TestSequentialValue = model<ITestSequentialValue>(
|
|
50
|
+
const TestSequentialValue = mongoose.models.testsequentialvalue || model<ITestSequentialValue>(
|
|
51
51
|
"testsequentialvalue",
|
|
52
52
|
TestSequentialValueSchema
|
|
53
53
|
);
|
package/src/models/Tier.ts
CHANGED
package/src/models/Trigger.ts
CHANGED
package/src/models/User.ts
CHANGED
|
@@ -58,5 +58,5 @@ UserSchema.index({ organizationId: 1, role: 1 });
|
|
|
58
58
|
UserSchema.index({ organizationId: 1, client: 1 });
|
|
59
59
|
UserSchema.index({ email: 1 }, { unique: true });
|
|
60
60
|
|
|
61
|
-
const User = model<IUser>("user", UserSchema);
|
|
61
|
+
const User = mongoose.models.user || model<IUser>("user", UserSchema);
|
|
62
62
|
export default User;
|