codebase-models 1.0.7 → 2.0.0
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/.github/workflows/npm-publish.yml +33 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -5
- package/dist/src/models/Announcement.d.ts +6 -5
- package/dist/src/models/Announcement.js +29 -9
- package/dist/src/models/Audience.d.ts +1 -0
- package/dist/src/models/Audience.js +5 -0
- package/dist/src/models/{Experiments.d.ts → BqPreCompiledData.d.ts} +12 -30
- package/dist/src/models/{ClientExperiment.js → BqPreCompiledData.js} +26 -46
- package/dist/src/models/CVRReport.d.ts +1 -0
- package/dist/src/models/CVRReport.js +13 -0
- package/dist/src/models/Client.d.ts +1 -1
- package/dist/src/models/Client.js +31 -51
- package/dist/src/models/ClientAdditionalRevenue.d.ts +1 -1
- package/dist/src/models/ClientAdditionalRevenue.js +3 -2
- package/dist/src/models/ClientLearning.d.ts +1 -1
- package/dist/src/models/ClientLearning.js +10 -6
- package/dist/src/models/ClientLinks.d.ts +1 -1
- package/dist/src/models/ClientLinks.js +15 -6
- package/dist/src/models/ClientNextSteps.d.ts +1 -1
- package/dist/src/models/ClientNextSteps.js +3 -2
- package/dist/src/models/ClientNote.d.ts +1 -1
- package/dist/src/models/ClientNote.js +3 -2
- package/dist/src/models/ClientReportsTemp.d.ts +1 -1
- package/dist/src/models/ClientReportsTemp.js +20 -2
- package/dist/src/models/ClientRetention.d.ts +1 -0
- package/dist/src/models/ClientRetention.js +18 -0
- package/dist/src/models/ClientScript.d.ts +1 -1
- package/dist/src/models/ClientScript.js +24 -8
- package/dist/src/models/ClientStrategy.d.ts +1 -1
- package/dist/src/models/ClientStrategy.js +3 -2
- package/dist/src/models/ClientSurvay.d.ts +1 -0
- package/dist/src/models/ClientSurvay.js +5 -0
- package/dist/src/models/Environment.d.ts +2 -0
- package/dist/src/models/Environment.js +26 -2
- package/dist/src/models/Faqs.d.ts +1 -0
- package/dist/src/models/Faqs.js +5 -0
- package/dist/src/models/Feedback.d.ts +1 -1
- package/dist/src/models/Feedback.js +3 -2
- package/dist/src/models/Goal.d.ts +2 -1
- package/dist/src/models/Goal.js +33 -11
- package/dist/src/models/Hypothesis.d.ts +2 -0
- package/dist/src/models/Hypothesis.js +49 -9
- package/dist/src/models/HypothesisSheet.d.ts +1 -1
- package/dist/src/models/HypothesisSheet.js +26 -2
- package/dist/src/models/LandingPages.d.ts +3 -0
- package/dist/src/models/LandingPages.js +29 -0
- package/dist/src/models/NewIdeas.d.ts +1 -1
- package/dist/src/models/NewIdeas.js +3 -2
- package/dist/src/models/Notification.d.ts +1 -0
- package/dist/src/models/Notification.js +29 -1
- package/dist/src/models/{ClientExperiment.d.ts → Organization.d.ts} +18 -29
- package/dist/src/models/{Experiments.js → Organization.js} +36 -54
- package/dist/src/models/Page.d.ts +3 -1
- package/dist/src/models/Page.js +56 -4
- package/dist/src/models/PageElement.d.ts +3 -0
- package/dist/src/models/PageElement.js +59 -7
- package/dist/src/models/PageTestType.d.ts +2 -0
- package/dist/src/models/PageTestType.js +41 -5
- package/dist/src/models/Portfolio.d.ts +1 -0
- package/dist/src/models/Portfolio.js +5 -0
- package/dist/src/models/PrecalculationFilters.d.ts +36 -0
- package/dist/src/models/PrecalculationFilters.js +77 -0
- package/dist/src/models/QueryLog.d.ts +1 -1
- package/dist/src/models/QueryLog.js +3 -2
- package/dist/src/models/ReadNotification.d.ts +1 -0
- package/dist/src/models/ReadNotification.js +29 -1
- package/dist/src/models/Report.d.ts +2 -1
- package/dist/src/models/Report.js +32 -48
- package/dist/src/models/Role.d.ts +3 -0
- package/dist/src/models/Role.js +50 -7
- package/dist/src/models/SavedSegment.d.ts +1 -0
- package/dist/src/models/SavedSegment.js +5 -0
- package/dist/src/models/Segment.d.ts +1 -0
- package/dist/src/models/Segment.js +5 -0
- package/dist/src/models/SegmentCombination.d.ts +1 -0
- package/dist/src/models/SegmentCombination.js +5 -0
- package/dist/src/models/Snippet.d.ts +2 -1
- package/dist/src/models/Snippet.js +28 -3
- package/dist/src/models/StageInCustomerJourney.d.ts +3 -1
- package/dist/src/models/StageInCustomerJourney.js +56 -4
- package/dist/src/models/Tag.d.ts +1 -0
- package/dist/src/models/Tag.js +29 -1
- package/dist/src/models/Temp.d.ts +1 -0
- package/dist/src/models/Temp.js +29 -1
- package/dist/src/models/Test.d.ts +16 -15
- package/dist/src/models/Test.js +82 -185
- package/dist/src/models/TestSequentialValue.d.ts +1 -0
- package/dist/src/models/TestSequentialValue.js +5 -0
- package/dist/src/models/Tier.d.ts +1 -0
- package/dist/src/models/Tier.js +29 -1
- package/dist/src/models/Trigger.d.ts +1 -0
- package/dist/src/models/Trigger.js +29 -1
- package/dist/src/models/User.d.ts +1 -0
- package/dist/src/models/User.js +9 -10
- package/index.ts +6 -4
- package/package.json +1 -1
- package/src/models/Announcement.ts +50 -27
- package/src/models/Audience.ts +6 -0
- package/src/models/BqPreCompiledData.ts +62 -0
- package/src/models/CVRReport.ts +17 -0
- package/src/models/Client.ts +39 -59
- package/src/models/ClientAdditionalRevenue.ts +4 -3
- package/src/models/ClientLearning.ts +11 -7
- package/src/models/ClientLinks.ts +18 -7
- package/src/models/ClientNextSteps.ts +4 -3
- package/src/models/ClientNote.ts +4 -3
- package/src/models/ClientReportsTemp.ts +24 -3
- package/src/models/ClientRetention.ts +27 -1
- package/src/models/ClientScript.ts +26 -9
- package/src/models/ClientStrategy.ts +4 -3
- package/src/models/ClientSurvay.ts +6 -0
- package/src/models/Environment.ts +31 -3
- package/src/models/Faqs.ts +6 -0
- package/src/models/Feedback.ts +4 -3
- package/src/models/Goal.ts +36 -12
- package/src/models/Hypothesis.ts +29 -8
- package/src/models/HypothesisSheet.ts +3 -2
- package/src/models/LandingPages.ts +34 -0
- package/src/models/NewIdeas.ts +4 -3
- package/src/models/Notification.ts +6 -0
- package/src/models/Organization.ts +86 -0
- package/src/models/Page.ts +62 -5
- package/src/models/PageElement.ts +38 -7
- package/src/models/PageTestType.ts +21 -4
- package/src/models/Portfolio.ts +6 -0
- package/src/models/PrecalculationFilters.ts +67 -0
- package/src/models/QueryLog.ts +4 -3
- package/src/models/ReadNotification.ts +6 -0
- package/src/models/Report.ts +54 -66
- package/src/models/Role.ts +31 -6
- package/src/models/SavedSegment.ts +6 -0
- package/src/models/Segment.ts +6 -0
- package/src/models/SegmentCombination.ts +6 -0
- package/src/models/Snippet.ts +32 -4
- package/src/models/StageInCustomerJourney.ts +33 -5
- package/src/models/Tag.ts +6 -0
- package/src/models/Temp.ts +6 -0
- package/src/models/Test.ts +155 -243
- package/src/models/TestSequentialValue.ts +6 -0
- package/src/models/Tier.ts +6 -0
- package/src/models/Trigger.ts +6 -0
- package/src/models/User.ts +11 -10
- package/src/models/ClientExperiment.ts +0 -113
- package/src/models/Experiments.ts +0 -118
|
@@ -6,7 +6,7 @@ export interface IClientScriptSchema extends Document {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export interface IClientScript extends Document {
|
|
9
|
-
|
|
9
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
10
10
|
client?: mongoose.Schema.Types.ObjectId;
|
|
11
11
|
viewId?: string;
|
|
12
12
|
clientScriptURL: string;
|
|
@@ -41,23 +41,28 @@ export interface IClientScript extends Document {
|
|
|
41
41
|
|
|
42
42
|
const ClientScriptSchema = new Schema<IClientScript>(
|
|
43
43
|
{
|
|
44
|
-
|
|
45
|
-
type:
|
|
44
|
+
organizationId: {
|
|
45
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
46
|
+
ref: "organization",
|
|
46
47
|
default: null,
|
|
47
48
|
},
|
|
48
49
|
client: {
|
|
49
50
|
type: mongoose.Schema.Types.ObjectId,
|
|
50
51
|
ref: "client",
|
|
52
|
+
index: true,
|
|
51
53
|
},
|
|
52
54
|
viewId: {
|
|
53
55
|
type: String,
|
|
56
|
+
index: true,
|
|
54
57
|
},
|
|
55
58
|
clientScriptURL: {
|
|
56
59
|
type: String,
|
|
60
|
+
trim: true,
|
|
57
61
|
},
|
|
58
62
|
jquery_include: {
|
|
59
63
|
type: String,
|
|
60
64
|
default: "false",
|
|
65
|
+
trim: true,
|
|
61
66
|
},
|
|
62
67
|
debug: {
|
|
63
68
|
type: Boolean,
|
|
@@ -76,6 +81,7 @@ const ClientScriptSchema = new Schema<IClientScript>(
|
|
|
76
81
|
},
|
|
77
82
|
activation_mode: {
|
|
78
83
|
type: String,
|
|
84
|
+
trim: true,
|
|
79
85
|
},
|
|
80
86
|
use_antiflicker: {
|
|
81
87
|
type: Boolean,
|
|
@@ -87,17 +93,21 @@ const ClientScriptSchema = new Schema<IClientScript>(
|
|
|
87
93
|
},
|
|
88
94
|
rules: {
|
|
89
95
|
type: String,
|
|
90
|
-
default: "return true;"
|
|
96
|
+
default: "return true;",
|
|
97
|
+
trim: true,
|
|
91
98
|
},
|
|
92
99
|
rules_tracking: {
|
|
93
100
|
type: String,
|
|
94
|
-
default: "return true;"
|
|
101
|
+
default: "return true;",
|
|
102
|
+
trim: true,
|
|
95
103
|
},
|
|
96
104
|
tracker_url: {
|
|
97
105
|
type: String,
|
|
106
|
+
trim: true,
|
|
98
107
|
},
|
|
99
108
|
asset_url: {
|
|
100
109
|
type: String,
|
|
110
|
+
trim: true,
|
|
101
111
|
},
|
|
102
112
|
metadata_key_exp_1: {
|
|
103
113
|
type: mongoose.Schema.Types.Mixed,
|
|
@@ -119,6 +129,7 @@ const ClientScriptSchema = new Schema<IClientScript>(
|
|
|
119
129
|
},
|
|
120
130
|
cookie_domain: {
|
|
121
131
|
type: String,
|
|
132
|
+
trim: true,
|
|
122
133
|
},
|
|
123
134
|
snippet_version: {
|
|
124
135
|
type: Number,
|
|
@@ -126,6 +137,7 @@ const ClientScriptSchema = new Schema<IClientScript>(
|
|
|
126
137
|
storage: {
|
|
127
138
|
type: String,
|
|
128
139
|
default: "default",
|
|
140
|
+
trim: true,
|
|
129
141
|
},
|
|
130
142
|
run_only_on_reinit: {
|
|
131
143
|
type: Boolean,
|
|
@@ -140,9 +152,11 @@ const ClientScriptSchema = new Schema<IClientScript>(
|
|
|
140
152
|
},
|
|
141
153
|
jscode: {
|
|
142
154
|
type: String,
|
|
155
|
+
trim: true,
|
|
143
156
|
},
|
|
144
157
|
csscode: {
|
|
145
158
|
type: String,
|
|
159
|
+
trim: true,
|
|
146
160
|
},
|
|
147
161
|
is_spa: {
|
|
148
162
|
type: Boolean,
|
|
@@ -154,10 +168,13 @@ const ClientScriptSchema = new Schema<IClientScript>(
|
|
|
154
168
|
}
|
|
155
169
|
);
|
|
156
170
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
171
|
+
// Compound indexes for common query patterns
|
|
172
|
+
ClientScriptSchema.index({ client: 1 });
|
|
173
|
+
// Sparse indexes for optional fields
|
|
174
|
+
ClientScriptSchema.index({ organisationId: 1 }, { sparse: true });
|
|
175
|
+
ClientScriptSchema.index({ tracker_url: 1 }, { sparse: true });
|
|
176
|
+
ClientScriptSchema.index({ asset_url: 1 }, { sparse: true });
|
|
177
|
+
|
|
161
178
|
|
|
162
179
|
const ClientScript = model<IClientScript>("clientscript", ClientScriptSchema);
|
|
163
180
|
|
|
@@ -6,7 +6,7 @@ export interface IClientStrategy extends Document {
|
|
|
6
6
|
startDate?: Date;
|
|
7
7
|
endDate?: Date;
|
|
8
8
|
strategies?: mongoose.Schema.Types.Mixed;
|
|
9
|
-
|
|
9
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
10
10
|
client?: mongoose.Schema.Types.ObjectId;
|
|
11
11
|
learningsoftime?: mongoose.Schema.Types.Mixed;
|
|
12
12
|
viewId?: string;
|
|
@@ -32,8 +32,9 @@ const ClientStrategySchema = new Schema<IClientStrategy>(
|
|
|
32
32
|
strategies: {
|
|
33
33
|
type: mongoose.Schema.Types.Mixed,
|
|
34
34
|
},
|
|
35
|
-
|
|
36
|
-
type:
|
|
35
|
+
organizationId: {
|
|
36
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
37
|
+
ref: "organization",
|
|
37
38
|
default: null,
|
|
38
39
|
},
|
|
39
40
|
client: {
|
|
@@ -3,6 +3,7 @@ import mongoose, { Document, Schema, model } from "mongoose";
|
|
|
3
3
|
export interface IClientSurvay extends Document {
|
|
4
4
|
responses: IResponce;
|
|
5
5
|
user?: mongoose.Schema.Types.ObjectId;
|
|
6
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export interface IResponce extends Document {
|
|
@@ -26,6 +27,11 @@ const ClientSurveySchema = new Schema<IClientSurvay>(
|
|
|
26
27
|
type: mongoose.Schema.Types.ObjectId,
|
|
27
28
|
ref: "user",
|
|
28
29
|
},
|
|
30
|
+
organizationId: {
|
|
31
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
32
|
+
ref: "organization",
|
|
33
|
+
default: null,
|
|
34
|
+
},
|
|
29
35
|
},
|
|
30
36
|
{
|
|
31
37
|
timestamps: true,
|
|
@@ -4,26 +4,54 @@ export interface IEnvironment extends Document {
|
|
|
4
4
|
name: string;
|
|
5
5
|
rules_js?: string;
|
|
6
6
|
client?: mongoose.Schema.Types.ObjectId;
|
|
7
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
8
|
+
isActive?: boolean;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
const EnvironmentSchema = new Schema<IEnvironment>({
|
|
10
12
|
name: {
|
|
11
13
|
type: String,
|
|
12
14
|
required: true,
|
|
13
|
-
default: 'Default'
|
|
15
|
+
default: 'Default',
|
|
16
|
+
trim: true,
|
|
17
|
+
index: true,
|
|
14
18
|
},
|
|
15
19
|
client: {
|
|
16
20
|
type: mongoose.Schema.Types.ObjectId,
|
|
17
21
|
ref: "client",
|
|
22
|
+
required: true,
|
|
23
|
+
index: true,
|
|
24
|
+
},
|
|
25
|
+
organizationId: {
|
|
26
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
27
|
+
ref: "organization",
|
|
28
|
+
index: true,
|
|
18
29
|
},
|
|
19
30
|
rules_js: {
|
|
20
31
|
type: String,
|
|
21
|
-
default: "return true"
|
|
32
|
+
default: "return true",
|
|
33
|
+
trim: true,
|
|
22
34
|
},
|
|
23
|
-
|
|
35
|
+
isActive: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: true,
|
|
38
|
+
index: true,
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
24
41
|
timestamps: true
|
|
25
42
|
});
|
|
26
43
|
|
|
44
|
+
// Compound indexes for common query patterns
|
|
45
|
+
EnvironmentSchema.index({ client: 1, name: 1 }, { unique: true });
|
|
46
|
+
EnvironmentSchema.index({ client: 1, isActive: 1 });
|
|
47
|
+
EnvironmentSchema.index({ organizationId: 1, client: 1 });
|
|
48
|
+
EnvironmentSchema.index({ organizationId: 1, name: 1 }, {
|
|
49
|
+
sparse: true,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Text index for full-text search
|
|
53
|
+
EnvironmentSchema.index({ name: 'text' });
|
|
54
|
+
|
|
27
55
|
const Environment = model<IEnvironment>("environment", EnvironmentSchema);
|
|
28
56
|
|
|
29
57
|
export default Environment;
|
package/src/models/Faqs.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface IFaqs extends Document {
|
|
|
6
6
|
keywords?: mongoose.Schema.Types.Array;
|
|
7
7
|
createdAt?: Date;
|
|
8
8
|
updatedAt?: Date;
|
|
9
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
const FaqSchema = new Schema<IFaqs>({
|
|
@@ -26,6 +27,11 @@ const FaqSchema = new Schema<IFaqs>({
|
|
|
26
27
|
type: Date,
|
|
27
28
|
default: new Date(),
|
|
28
29
|
},
|
|
30
|
+
organizationId: {
|
|
31
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
32
|
+
ref: "organization",
|
|
33
|
+
default: null,
|
|
34
|
+
},
|
|
29
35
|
});
|
|
30
36
|
|
|
31
37
|
const Faq = model<IFaqs>("faq", FaqSchema);
|
package/src/models/Feedback.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface IFeedback extends Document {
|
|
|
5
5
|
details?: string;
|
|
6
6
|
client?: mongoose.Schema.Types.ObjectId;
|
|
7
7
|
thread?: mongoose.Schema.Types.Mixed;
|
|
8
|
-
|
|
8
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
9
9
|
createdAt?: Date;
|
|
10
10
|
updatedAt?: Date;
|
|
11
11
|
}
|
|
@@ -27,8 +27,9 @@ const FeedbackSchema = new Schema<IFeedback>({
|
|
|
27
27
|
type: mongoose.Schema.Types.Mixed,
|
|
28
28
|
default: [],
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
type:
|
|
30
|
+
organizationId: {
|
|
31
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
32
|
+
ref: "organization",
|
|
32
33
|
default: null,
|
|
33
34
|
},
|
|
34
35
|
createdAt: {
|
package/src/models/Goal.ts
CHANGED
|
@@ -6,13 +6,14 @@ export interface IGoal extends Document {
|
|
|
6
6
|
name: string;
|
|
7
7
|
details?: string;
|
|
8
8
|
slug?: string;
|
|
9
|
-
|
|
9
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
10
10
|
client?: mongoose.Schema.Types.ObjectId;
|
|
11
11
|
type: string;
|
|
12
12
|
counting_method: string;
|
|
13
13
|
css_selector: string;
|
|
14
14
|
api_name: string;
|
|
15
15
|
rules_js: string;
|
|
16
|
+
isActive?: boolean;
|
|
16
17
|
createdAt?: Date;
|
|
17
18
|
updatedAt?: Date;
|
|
18
19
|
}
|
|
@@ -21,45 +22,68 @@ const GoalSchema = new Schema<IGoal>({
|
|
|
21
22
|
name: {
|
|
22
23
|
type: String,
|
|
23
24
|
required: true,
|
|
25
|
+
trim: true,
|
|
26
|
+
index: true,
|
|
24
27
|
},
|
|
25
28
|
details: {
|
|
26
29
|
type: String,
|
|
27
30
|
default: "",
|
|
31
|
+
trim: true,
|
|
28
32
|
},
|
|
29
33
|
slug: {
|
|
30
34
|
type: String,
|
|
35
|
+
unique: true,
|
|
36
|
+
sparse: true,
|
|
31
37
|
},
|
|
32
|
-
|
|
33
|
-
type:
|
|
38
|
+
organizationId: {
|
|
39
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
40
|
+
ref: "organization",
|
|
34
41
|
default: null,
|
|
42
|
+
index: true,
|
|
35
43
|
},
|
|
36
44
|
client: {
|
|
37
45
|
type: mongoose.Schema.Types.ObjectId,
|
|
38
46
|
ref: "client",
|
|
47
|
+
index: true,
|
|
39
48
|
},
|
|
40
49
|
type: {
|
|
41
50
|
type: String,
|
|
51
|
+
trim: true,
|
|
42
52
|
},
|
|
43
53
|
counting_method: {
|
|
44
54
|
type: String,
|
|
55
|
+
trim: true,
|
|
45
56
|
},
|
|
46
57
|
css_selector: {
|
|
47
58
|
type: String,
|
|
59
|
+
trim: true,
|
|
60
|
+
},
|
|
61
|
+
api_name: {
|
|
62
|
+
type: String,
|
|
63
|
+
slug: ["name"],
|
|
64
|
+
slugPaddingSize: 4,
|
|
65
|
+
unique: true,
|
|
66
|
+
trim: true,
|
|
48
67
|
},
|
|
49
|
-
api_name: { type: String, slug: ["name"], slugPaddingSize: 4, unique: true },
|
|
50
68
|
rules_js: {
|
|
51
69
|
type: String,
|
|
70
|
+
trim: true,
|
|
52
71
|
},
|
|
53
|
-
|
|
54
|
-
type:
|
|
55
|
-
default:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
},
|
|
72
|
+
isActive: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: true,
|
|
75
|
+
index: true,
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
timestamps: true
|
|
61
79
|
});
|
|
62
80
|
|
|
81
|
+
// Compound indexes for common query patterns
|
|
82
|
+
GoalSchema.index({ client: 1});
|
|
83
|
+
GoalSchema.index({ client: 1, isActive: 1 });
|
|
84
|
+
GoalSchema.index({ organizationId: 1, client: 1 });
|
|
85
|
+
GoalSchema.index({ client: 1, name: 1 }, { unique: true });
|
|
86
|
+
|
|
63
87
|
const Goal = model<IGoal>("goal", GoalSchema);
|
|
64
88
|
|
|
65
89
|
export default Goal;
|
package/src/models/Hypothesis.ts
CHANGED
|
@@ -1,50 +1,71 @@
|
|
|
1
1
|
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
2
|
|
|
3
3
|
export interface IHypothesis extends Document {
|
|
4
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
4
5
|
hypothesisNumber?: string;
|
|
5
6
|
name: string;
|
|
6
7
|
action: string;
|
|
7
8
|
result: string;
|
|
8
9
|
expectation: string;
|
|
9
10
|
tagged?: string;
|
|
11
|
+
isActive?: boolean;
|
|
10
12
|
createdAt?: Date;
|
|
11
13
|
updatedAt?: Date;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
const HypothesisSchema = new Schema<IHypothesis>({
|
|
17
|
+
organizationId: {
|
|
18
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
19
|
+
ref: "organization",
|
|
20
|
+
default: null,
|
|
21
|
+
},
|
|
15
22
|
hypothesisNumber: {
|
|
16
23
|
type: String,
|
|
24
|
+
trim: true,
|
|
25
|
+
index: true,
|
|
17
26
|
},
|
|
18
27
|
name: {
|
|
19
28
|
type: String,
|
|
20
29
|
required: true,
|
|
30
|
+
trim: true,
|
|
31
|
+
index: true,
|
|
21
32
|
},
|
|
22
33
|
action: {
|
|
23
34
|
type: String,
|
|
24
35
|
required: true,
|
|
36
|
+
trim: true,
|
|
25
37
|
},
|
|
26
38
|
result: {
|
|
27
39
|
type: String,
|
|
28
40
|
required: true,
|
|
41
|
+
trim: true,
|
|
29
42
|
},
|
|
30
43
|
expectation: {
|
|
31
44
|
type: String,
|
|
32
45
|
required: true,
|
|
46
|
+
trim: true,
|
|
33
47
|
},
|
|
34
48
|
tagged: {
|
|
35
49
|
type: String,
|
|
36
50
|
default: "General Purpose",
|
|
51
|
+
trim: true,
|
|
52
|
+
index: true,
|
|
37
53
|
},
|
|
38
|
-
|
|
39
|
-
type:
|
|
40
|
-
default:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
54
|
+
isActive: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true,
|
|
57
|
+
index: true,
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
timestamps: true
|
|
46
61
|
});
|
|
47
62
|
|
|
63
|
+
// Compound indexes for common query patterns
|
|
64
|
+
HypothesisSchema.index({ hypothesisNumber: 1, isActive: 1 });
|
|
65
|
+
HypothesisSchema.index({ tagged: 1, isActive: 1 });
|
|
66
|
+
HypothesisSchema.index({ name: 1, isActive: 1 });
|
|
67
|
+
|
|
68
|
+
|
|
48
69
|
const Hypothesis = model<IHypothesis>("hypos", HypothesisSchema);
|
|
49
70
|
|
|
50
71
|
export default Hypothesis;
|
|
@@ -2,7 +2,7 @@ import mongoose, { Document, Schema, model } from "mongoose";
|
|
|
2
2
|
import HypothesisSheetConstants from "../constant";
|
|
3
3
|
|
|
4
4
|
export interface IHypothesisSheet extends Document {
|
|
5
|
-
organizationId?:
|
|
5
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
6
6
|
client?: mongoose.Schema.Types.ObjectId;
|
|
7
7
|
viewId?: string;
|
|
8
8
|
pageelement?: mongoose.Schema.Types.ObjectId;
|
|
@@ -25,8 +25,9 @@ export interface IHypothesisSheet extends Document {
|
|
|
25
25
|
const HypothesisSheetSchema = new Schema<IHypothesisSheet>(
|
|
26
26
|
{
|
|
27
27
|
organizationId: {
|
|
28
|
-
type:
|
|
28
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
29
29
|
default: null,
|
|
30
|
+
ref: "organization",
|
|
30
31
|
},
|
|
31
32
|
client: {
|
|
32
33
|
type: Schema.Types.ObjectId,
|
|
@@ -2,19 +2,29 @@ import mongoose, { Document, Schema, model } from "mongoose";
|
|
|
2
2
|
|
|
3
3
|
export interface ILandingPagesData extends Document {
|
|
4
4
|
conversionRate?: Number;
|
|
5
|
+
lastUpdated?: Date;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
const LandingPageDataSchema = new Schema<ILandingPagesData>({
|
|
8
9
|
conversionRate: {
|
|
9
10
|
type: Number,
|
|
11
|
+
min: 0,
|
|
12
|
+
max: 100,
|
|
13
|
+
index: true,
|
|
10
14
|
},
|
|
15
|
+
lastUpdated: {
|
|
16
|
+
type: Date,
|
|
17
|
+
default: Date.now,
|
|
18
|
+
}
|
|
11
19
|
});
|
|
12
20
|
|
|
13
21
|
export interface ILandingPages extends Document {
|
|
14
22
|
title: string;
|
|
15
23
|
client?: mongoose.Schema.Types.ObjectId;
|
|
24
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
16
25
|
screenshot?: string;
|
|
17
26
|
dataPoints?: ILandingPagesData;
|
|
27
|
+
isActive?: boolean;
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
const LandingPagesSchema = new Schema<ILandingPages>(
|
|
@@ -22,25 +32,49 @@ const LandingPagesSchema = new Schema<ILandingPages>(
|
|
|
22
32
|
title: {
|
|
23
33
|
type: String,
|
|
24
34
|
required: true,
|
|
35
|
+
trim: true,
|
|
36
|
+
index: true,
|
|
25
37
|
},
|
|
26
38
|
client: {
|
|
27
39
|
type: mongoose.Schema.Types.ObjectId,
|
|
28
40
|
ref: "client",
|
|
29
41
|
required: true,
|
|
42
|
+
index: true,
|
|
43
|
+
},
|
|
44
|
+
organizationId: {
|
|
45
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
46
|
+
ref: "organization",
|
|
47
|
+
index: true,
|
|
30
48
|
},
|
|
31
49
|
screenshot: {
|
|
32
50
|
type: String,
|
|
33
51
|
default: null,
|
|
52
|
+
trim: true,
|
|
34
53
|
},
|
|
35
54
|
dataPoints: {
|
|
36
55
|
type: LandingPageDataSchema,
|
|
37
56
|
default: {},
|
|
38
57
|
},
|
|
58
|
+
isActive: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: true,
|
|
61
|
+
index: true,
|
|
62
|
+
}
|
|
39
63
|
},
|
|
40
64
|
{
|
|
41
65
|
timestamps: true,
|
|
42
66
|
}
|
|
43
67
|
);
|
|
44
68
|
|
|
69
|
+
// Compound indexes for common query patterns
|
|
70
|
+
LandingPagesSchema.index({ client: 1, title: 1 }, { unique: true });
|
|
71
|
+
LandingPagesSchema.index({ client: 1, isActive: 1 });
|
|
72
|
+
LandingPagesSchema.index({ organizationId: 1, client: 1 });
|
|
73
|
+
LandingPagesSchema.index({ organizationId: 1, title: 1 });
|
|
74
|
+
LandingPagesSchema.index({ client: 1, 'dataPoints.conversionRate': -1 });
|
|
75
|
+
|
|
76
|
+
// Text index for full-text search
|
|
77
|
+
LandingPagesSchema.index({ title: 'text' });
|
|
78
|
+
|
|
45
79
|
const LandingPages = model<ILandingPages>("LandingPages", LandingPagesSchema);
|
|
46
80
|
export default LandingPages;
|
package/src/models/NewIdeas.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
2
|
|
|
3
3
|
export interface INewIdeas extends Document {
|
|
4
|
-
|
|
4
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
5
5
|
ideaName: string;
|
|
6
6
|
client?: mongoose.Schema.Types.ObjectId;
|
|
7
7
|
hypothesis?: mongoose.Schema.Types.ObjectId;
|
|
@@ -14,8 +14,9 @@ export interface INewIdeas extends Document {
|
|
|
14
14
|
|
|
15
15
|
const NewIdeasSchema = new Schema<INewIdeas>(
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
type:
|
|
17
|
+
organizationId: {
|
|
18
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
19
|
+
ref: "organization",
|
|
19
20
|
default: null,
|
|
20
21
|
},
|
|
21
22
|
ideaName: {
|
|
@@ -8,10 +8,16 @@ export interface INotification extends Document {
|
|
|
8
8
|
archive?: boolean;
|
|
9
9
|
module?: string;
|
|
10
10
|
moduleData?: string;
|
|
11
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
const NotificationSchema = new Schema<INotification>(
|
|
14
15
|
{
|
|
16
|
+
organizationId: {
|
|
17
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
18
|
+
ref: "organization",
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
15
21
|
title: {
|
|
16
22
|
type: String,
|
|
17
23
|
},
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IOrganization extends Document {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
adminEmail: string;
|
|
7
|
+
adminContact: string;
|
|
8
|
+
createdBy: mongoose.Schema.Types.ObjectId;
|
|
9
|
+
address: string;
|
|
10
|
+
city: string;
|
|
11
|
+
state: string;
|
|
12
|
+
zip: string;
|
|
13
|
+
country: string;
|
|
14
|
+
phone: string;
|
|
15
|
+
logo: string;
|
|
16
|
+
website: string;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
isActive: boolean;
|
|
20
|
+
}
|
|
21
|
+
const OrganizationSchema = new Schema<IOrganization>({
|
|
22
|
+
name: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true,
|
|
25
|
+
unique: true,
|
|
26
|
+
},
|
|
27
|
+
description: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
adminEmail: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
adminContact: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
createdBy: {
|
|
40
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
41
|
+
ref: "user",
|
|
42
|
+
},
|
|
43
|
+
address: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
city: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: true,
|
|
50
|
+
},
|
|
51
|
+
state: {
|
|
52
|
+
type: String,
|
|
53
|
+
required: true,
|
|
54
|
+
},
|
|
55
|
+
zip: {
|
|
56
|
+
type: String,
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
country: {
|
|
60
|
+
type: String,
|
|
61
|
+
required: true,
|
|
62
|
+
},
|
|
63
|
+
phone: {
|
|
64
|
+
type: String,
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
logo: {
|
|
68
|
+
type: String,
|
|
69
|
+
required: true,
|
|
70
|
+
},
|
|
71
|
+
website: {
|
|
72
|
+
type: String,
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
isActive: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true,
|
|
78
|
+
},
|
|
79
|
+
}, {
|
|
80
|
+
timestamps: true
|
|
81
|
+
});
|
|
82
|
+
const Organization = model<IOrganization>("organization", OrganizationSchema);
|
|
83
|
+
|
|
84
|
+
OrganizationSchema.index({ name: 1, isActive: 1 });
|
|
85
|
+
|
|
86
|
+
export default Organization;
|