codebase-models 1.0.7 → 2.0.1
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 +7 -8
- package/dist/src/models/Announcement.js +30 -10
- package/dist/src/models/AppEvent.d.ts +1 -3
- package/dist/src/models/AppEvent.js +1 -1
- package/dist/src/models/Audience.d.ts +2 -3
- package/dist/src/models/Audience.js +6 -1
- package/dist/src/models/{Experiments.d.ts → BqPreCompiledData.d.ts} +12 -32
- package/dist/src/models/{ClientExperiment.js → BqPreCompiledData.js} +26 -46
- package/dist/src/models/CVRReport.d.ts +2 -3
- package/dist/src/models/CVRReport.js +14 -1
- package/dist/src/models/Client.d.ts +2 -4
- package/dist/src/models/Client.js +32 -52
- package/dist/src/models/ClientAdditionalRevenue.d.ts +2 -4
- package/dist/src/models/ClientAdditionalRevenue.js +4 -3
- package/dist/src/models/ClientLearning.d.ts +2 -4
- package/dist/src/models/ClientLearning.js +11 -7
- package/dist/src/models/ClientLinks.d.ts +2 -4
- package/dist/src/models/ClientLinks.js +16 -7
- package/dist/src/models/ClientNextSteps.d.ts +2 -4
- package/dist/src/models/ClientNextSteps.js +4 -3
- package/dist/src/models/ClientNote.d.ts +2 -4
- package/dist/src/models/ClientNote.js +4 -3
- package/dist/src/models/ClientReportsTemp.d.ts +2 -4
- package/dist/src/models/ClientReportsTemp.js +21 -3
- package/dist/src/models/ClientRetention.d.ts +2 -3
- package/dist/src/models/ClientRetention.js +19 -1
- package/dist/src/models/ClientScript.d.ts +2 -4
- package/dist/src/models/ClientScript.js +25 -9
- package/dist/src/models/ClientStrategy.d.ts +2 -4
- package/dist/src/models/ClientStrategy.js +4 -3
- package/dist/src/models/ClientSurvay.d.ts +2 -7
- package/dist/src/models/ClientSurvay.js +6 -1
- package/dist/src/models/Environment.d.ts +3 -3
- package/dist/src/models/Environment.js +27 -3
- package/dist/src/models/Faqs.d.ts +2 -3
- package/dist/src/models/Faqs.js +6 -1
- package/dist/src/models/Feedback.d.ts +2 -4
- package/dist/src/models/Feedback.js +4 -3
- package/dist/src/models/Goal.d.ts +3 -4
- package/dist/src/models/Goal.js +34 -12
- package/dist/src/models/Hypothesis.d.ts +3 -3
- package/dist/src/models/Hypothesis.js +50 -10
- package/dist/src/models/HypothesisSheet.d.ts +2 -4
- package/dist/src/models/HypothesisSheet.js +27 -3
- package/dist/src/models/LandingPages.d.ts +4 -3
- package/dist/src/models/LandingPages.js +30 -1
- package/dist/src/models/NewIdeas.d.ts +2 -4
- package/dist/src/models/NewIdeas.js +4 -3
- package/dist/src/models/Notification.d.ts +2 -3
- package/dist/src/models/Notification.js +30 -2
- package/dist/src/models/{ClientExperiment.d.ts → Organization.d.ts} +18 -31
- package/dist/src/models/{Experiments.js → Organization.js} +36 -54
- package/dist/src/models/Page.d.ts +4 -4
- package/dist/src/models/Page.js +57 -5
- package/dist/src/models/PageElement.d.ts +4 -3
- package/dist/src/models/PageElement.js +60 -8
- package/dist/src/models/PageTestType.d.ts +3 -3
- package/dist/src/models/PageTestType.js +42 -6
- package/dist/src/models/Portfolio.d.ts +2 -3
- package/dist/src/models/Portfolio.js +6 -1
- package/dist/src/models/PrecalculationFilters.d.ts +34 -0
- package/dist/src/models/PrecalculationFilters.js +78 -0
- package/dist/src/models/QueryLog.d.ts +2 -4
- package/dist/src/models/QueryLog.js +4 -3
- package/dist/src/models/ReadNotification.d.ts +2 -3
- package/dist/src/models/ReadNotification.js +30 -2
- package/dist/src/models/Report.d.ts +3 -4
- package/dist/src/models/Report.js +33 -49
- package/dist/src/models/Role.d.ts +4 -3
- package/dist/src/models/Role.js +51 -8
- package/dist/src/models/SavedSegment.d.ts +2 -3
- package/dist/src/models/SavedSegment.js +6 -1
- package/dist/src/models/Segment.d.ts +2 -3
- package/dist/src/models/Segment.js +6 -1
- package/dist/src/models/SegmentCombination.d.ts +2 -3
- package/dist/src/models/SegmentCombination.js +6 -1
- package/dist/src/models/Snippet.d.ts +3 -4
- package/dist/src/models/Snippet.js +29 -4
- package/dist/src/models/StageInCustomerJourney.d.ts +4 -4
- package/dist/src/models/StageInCustomerJourney.js +56 -4
- package/dist/src/models/Tag.d.ts +2 -3
- package/dist/src/models/Tag.js +30 -2
- package/dist/src/models/Temp.d.ts +2 -3
- package/dist/src/models/Temp.js +30 -2
- package/dist/src/models/Test.d.ts +17 -18
- package/dist/src/models/Test.js +83 -186
- package/dist/src/models/TestSequentialValue.d.ts +2 -3
- package/dist/src/models/TestSequentialValue.js +6 -1
- package/dist/src/models/Tier.d.ts +2 -3
- package/dist/src/models/Tier.js +30 -2
- package/dist/src/models/Trigger.d.ts +2 -3
- package/dist/src/models/Trigger.js +30 -2
- package/dist/src/models/User.d.ts +2 -3
- package/dist/src/models/User.js +10 -11
- package/index.ts +6 -4
- package/package.json +1 -1
- package/src/models/Announcement.ts +51 -28
- package/src/models/AppEvent.ts +1 -1
- package/src/models/Audience.ts +7 -1
- package/src/models/BqPreCompiledData.ts +62 -0
- package/src/models/CVRReport.ts +18 -1
- package/src/models/Client.ts +40 -60
- package/src/models/ClientAdditionalRevenue.ts +5 -4
- package/src/models/ClientLearning.ts +12 -8
- package/src/models/ClientLinks.ts +19 -8
- package/src/models/ClientNextSteps.ts +5 -4
- package/src/models/ClientNote.ts +5 -4
- package/src/models/ClientReportsTemp.ts +25 -4
- package/src/models/ClientRetention.ts +28 -2
- package/src/models/ClientScript.ts +27 -10
- package/src/models/ClientStrategy.ts +5 -4
- package/src/models/ClientSurvay.ts +7 -1
- package/src/models/Environment.ts +32 -4
- package/src/models/Faqs.ts +7 -1
- package/src/models/Feedback.ts +5 -4
- package/src/models/Goal.ts +37 -13
- package/src/models/Hypothesis.ts +30 -9
- package/src/models/HypothesisSheet.ts +4 -3
- package/src/models/LandingPages.ts +35 -1
- package/src/models/NewIdeas.ts +5 -4
- package/src/models/Notification.ts +7 -1
- package/src/models/Organization.ts +86 -0
- package/src/models/Page.ts +63 -6
- package/src/models/PageElement.ts +39 -8
- package/src/models/PageTestType.ts +22 -5
- package/src/models/Portfolio.ts +7 -1
- package/src/models/PrecalculationFilters.ts +68 -0
- package/src/models/QueryLog.ts +5 -4
- package/src/models/ReadNotification.ts +7 -1
- package/src/models/Report.ts +55 -67
- package/src/models/Role.ts +32 -7
- package/src/models/SavedSegment.ts +7 -1
- package/src/models/Segment.ts +7 -1
- package/src/models/SegmentCombination.ts +7 -1
- package/src/models/Snippet.ts +33 -5
- package/src/models/StageInCustomerJourney.ts +34 -6
- package/src/models/Tag.ts +7 -1
- package/src/models/Temp.ts +7 -1
- package/src/models/Test.ts +156 -244
- package/src/models/TestSequentialValue.ts +7 -1
- package/src/models/Tier.ts +7 -1
- package/src/models/Trigger.ts +7 -1
- package/src/models/User.ts +12 -11
- package/src/models/ClientExperiment.ts +0 -113
- package/src/models/Experiments.ts +0 -118
package/dist/src/models/Page.js
CHANGED
|
@@ -32,45 +32,97 @@ mongoose_1.default.plugin(mongoose_slug_updater_1.default);
|
|
|
32
32
|
const UrltargetingsSchema = new mongoose_1.Schema({
|
|
33
33
|
type: {
|
|
34
34
|
type: String,
|
|
35
|
+
required: true,
|
|
36
|
+
trim: true,
|
|
35
37
|
},
|
|
36
38
|
url: {
|
|
37
39
|
type: String,
|
|
40
|
+
required: true,
|
|
41
|
+
trim: true,
|
|
38
42
|
},
|
|
39
43
|
url_type: {
|
|
40
44
|
type: String,
|
|
45
|
+
required: true,
|
|
46
|
+
trim: true,
|
|
41
47
|
},
|
|
42
48
|
});
|
|
43
49
|
const PageSchema = new mongoose_1.Schema({
|
|
44
50
|
name: {
|
|
45
51
|
type: String,
|
|
46
52
|
required: true,
|
|
53
|
+
trim: true,
|
|
54
|
+
index: true,
|
|
47
55
|
},
|
|
48
56
|
trigger: {
|
|
49
57
|
type: String,
|
|
50
|
-
default: "direct"
|
|
58
|
+
default: "direct",
|
|
59
|
+
trim: true,
|
|
60
|
+
index: true,
|
|
61
|
+
},
|
|
62
|
+
organizationId: {
|
|
63
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
64
|
+
ref: "organization",
|
|
65
|
+
default: null,
|
|
66
|
+
index: true,
|
|
51
67
|
},
|
|
52
68
|
client: {
|
|
53
69
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
54
70
|
ref: "client",
|
|
71
|
+
required: true,
|
|
72
|
+
index: true,
|
|
55
73
|
},
|
|
56
74
|
trigger_js: {
|
|
57
75
|
type: String,
|
|
58
|
-
default: ""
|
|
76
|
+
default: "",
|
|
77
|
+
trim: true,
|
|
78
|
+
},
|
|
79
|
+
api_name: {
|
|
80
|
+
type: String,
|
|
81
|
+
slug: ["name"],
|
|
82
|
+
slugPaddingSize: 4,
|
|
83
|
+
unique: true,
|
|
84
|
+
trim: true,
|
|
59
85
|
},
|
|
60
|
-
api_name: { type: String, slug: ["name"], slugPaddingSize: 4, unique: true },
|
|
61
86
|
poll_on_rules: {
|
|
62
87
|
type: Boolean,
|
|
63
88
|
default: false,
|
|
89
|
+
index: true,
|
|
64
90
|
},
|
|
65
91
|
deactivation_mode: {
|
|
66
92
|
type: String,
|
|
67
93
|
default: "reset",
|
|
94
|
+
trim: true,
|
|
68
95
|
},
|
|
69
96
|
rules_js: {
|
|
70
97
|
type: String,
|
|
71
|
-
default: "return true"
|
|
98
|
+
default: "return true",
|
|
99
|
+
trim: true,
|
|
72
100
|
},
|
|
73
101
|
urltargetings: [UrltargetingsSchema],
|
|
102
|
+
isActive: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true,
|
|
105
|
+
index: true,
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
timestamps: true
|
|
74
109
|
});
|
|
75
|
-
|
|
110
|
+
// Compound indexes for common query patterns
|
|
111
|
+
PageSchema.index({ client: 1, name: 1 }, { unique: true });
|
|
112
|
+
PageSchema.index({ client: 1, isActive: 1 });
|
|
113
|
+
PageSchema.index({ organizationId: 1, client: 1 });
|
|
114
|
+
PageSchema.index({ organizationId: 1, name: 1 });
|
|
115
|
+
// Text index for full-text search
|
|
116
|
+
// PageSchema.index({
|
|
117
|
+
// name: 'text',
|
|
118
|
+
// trigger_js: 'text',
|
|
119
|
+
// rules_js: 'text'
|
|
120
|
+
// }, {
|
|
121
|
+
// weights: {
|
|
122
|
+
// name: 10,
|
|
123
|
+
// trigger_js: 5,
|
|
124
|
+
// rules_js: 5
|
|
125
|
+
// }
|
|
126
|
+
// });
|
|
127
|
+
const Page = mongoose_1.default.models.page || (0, mongoose_1.model)("page", PageSchema);
|
|
76
128
|
exports.default = Page;
|
|
@@ -26,10 +26,11 @@ import mongoose, { Document } from "mongoose";
|
|
|
26
26
|
export interface IPageElement extends Document {
|
|
27
27
|
name: string;
|
|
28
28
|
slug?: string;
|
|
29
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
30
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
31
|
+
isActive?: boolean;
|
|
29
32
|
createdAt?: Date;
|
|
30
33
|
updatedAt?: Date;
|
|
31
34
|
}
|
|
32
|
-
declare const PageElement: mongoose.Model<
|
|
33
|
-
_id: mongoose.Types.ObjectId;
|
|
34
|
-
}, any>;
|
|
35
|
+
declare const PageElement: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
35
36
|
export default PageElement;
|
|
@@ -1,22 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
29
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
30
|
+
const mongoose_slug_updater_1 = __importDefault(require("mongoose-slug-updater"));
|
|
31
|
+
mongoose_1.default.plugin(mongoose_slug_updater_1.default);
|
|
4
32
|
const PageElementSchema = new mongoose_1.Schema({
|
|
5
33
|
name: {
|
|
6
34
|
type: String,
|
|
7
35
|
required: true,
|
|
36
|
+
trim: true,
|
|
37
|
+
index: true,
|
|
8
38
|
},
|
|
9
39
|
slug: {
|
|
10
40
|
type: String,
|
|
41
|
+
slug: ["name"],
|
|
42
|
+
slugPaddingSize: 4,
|
|
43
|
+
unique: true,
|
|
44
|
+
trim: true,
|
|
11
45
|
},
|
|
12
|
-
|
|
13
|
-
type:
|
|
14
|
-
|
|
46
|
+
organizationId: {
|
|
47
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
48
|
+
ref: "organization",
|
|
49
|
+
index: true,
|
|
50
|
+
default: null,
|
|
15
51
|
},
|
|
16
|
-
|
|
17
|
-
type:
|
|
18
|
-
|
|
52
|
+
client: {
|
|
53
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
54
|
+
ref: "client",
|
|
55
|
+
required: true,
|
|
56
|
+
index: true,
|
|
19
57
|
},
|
|
58
|
+
isActive: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: true,
|
|
61
|
+
index: true,
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
timestamps: true
|
|
20
65
|
});
|
|
21
|
-
|
|
66
|
+
// Compound indexes for common query patterns
|
|
67
|
+
PageElementSchema.index({ client: 1, name: 1 }, { unique: true });
|
|
68
|
+
PageElementSchema.index({ client: 1, isActive: 1 });
|
|
69
|
+
PageElementSchema.index({ organizationId: 1, client: 1 });
|
|
70
|
+
PageElementSchema.index({ organizationId: 1, name: 1 });
|
|
71
|
+
// Text index for full-text search
|
|
72
|
+
PageElementSchema.index({ name: 'text' });
|
|
73
|
+
const PageElement = mongoose_1.default.models.pageelement || (0, mongoose_1.model)("pageelement", PageElementSchema);
|
|
22
74
|
exports.default = PageElement;
|
|
@@ -26,10 +26,10 @@ import mongoose, { Document } from "mongoose";
|
|
|
26
26
|
export interface IPageTestType extends Document {
|
|
27
27
|
name: string;
|
|
28
28
|
details?: string;
|
|
29
|
+
isActive?: boolean;
|
|
29
30
|
createdAt?: Date;
|
|
30
31
|
updatedAt?: Date;
|
|
32
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
31
33
|
}
|
|
32
|
-
declare const PageTestType: mongoose.Model<
|
|
33
|
-
_id: mongoose.Types.ObjectId;
|
|
34
|
-
}, any>;
|
|
34
|
+
declare const PageTestType: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
35
35
|
export default PageTestType;
|
|
@@ -1,24 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
26
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
4
27
|
const PageTestTypeSchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
5
33
|
name: {
|
|
6
34
|
type: String,
|
|
7
35
|
required: true,
|
|
8
36
|
unique: true,
|
|
37
|
+
trim: true,
|
|
38
|
+
index: true,
|
|
9
39
|
},
|
|
10
40
|
details: {
|
|
11
41
|
type: String,
|
|
12
42
|
default: "",
|
|
43
|
+
trim: true,
|
|
13
44
|
},
|
|
14
45
|
createdAt: {
|
|
15
46
|
type: Date,
|
|
16
47
|
default: new Date(),
|
|
17
48
|
},
|
|
18
|
-
|
|
19
|
-
type:
|
|
20
|
-
default:
|
|
21
|
-
|
|
49
|
+
isActive: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true,
|
|
52
|
+
index: true,
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
timestamps: true
|
|
22
56
|
});
|
|
23
|
-
|
|
57
|
+
// Compound indexes for common query patterns
|
|
58
|
+
PageTestTypeSchema.index({ name: 1, isActive: 1 });
|
|
59
|
+
const PageTestType = mongoose_1.default.models.pagetesttype || (0, mongoose_1.model)("pagetesttype", PageTestTypeSchema);
|
|
24
60
|
exports.default = PageTestType;
|
|
@@ -26,8 +26,7 @@ import mongoose, { Document } from "mongoose";
|
|
|
26
26
|
export interface IPortfolio extends Document {
|
|
27
27
|
portfoliokey: mongoose.Schema.Types.Mixed;
|
|
28
28
|
portfolioData?: mongoose.Schema.Types.Mixed;
|
|
29
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
29
30
|
}
|
|
30
|
-
declare const Portfolio: mongoose.Model<
|
|
31
|
-
_id: mongoose.Types.ObjectId;
|
|
32
|
-
}, any>;
|
|
31
|
+
declare const Portfolio: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
33
32
|
export default Portfolio;
|
|
@@ -33,8 +33,13 @@ const PortfolioSchema = new mongoose_1.Schema({
|
|
|
33
33
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
34
34
|
default: null,
|
|
35
35
|
},
|
|
36
|
+
organizationId: {
|
|
37
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
38
|
+
ref: "organization",
|
|
39
|
+
default: null,
|
|
40
|
+
},
|
|
36
41
|
}, {
|
|
37
42
|
timestamps: true,
|
|
38
43
|
});
|
|
39
|
-
const Portfolio = (0, mongoose_1.model)("portfolio", PortfolioSchema);
|
|
44
|
+
const Portfolio = mongoose_1.default.models.portfolio || (0, mongoose_1.model)("portfolio", PortfolioSchema);
|
|
40
45
|
exports.default = Portfolio;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import mongoose, { Document } from "mongoose";
|
|
26
|
+
export interface IPrecalculationFilters extends Document {
|
|
27
|
+
title: string;
|
|
28
|
+
organizationId: mongoose.Schema.Types.ObjectId;
|
|
29
|
+
client: mongoose.Schema.Types.ObjectId;
|
|
30
|
+
filters: any;
|
|
31
|
+
otherFilters: any;
|
|
32
|
+
}
|
|
33
|
+
declare const PrecalculationFilters: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
34
|
+
export default PrecalculationFilters;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
|
+
const PrecalculationFiltersSchema = new mongoose_1.Schema({
|
|
28
|
+
title: {
|
|
29
|
+
type: String,
|
|
30
|
+
trim: true,
|
|
31
|
+
},
|
|
32
|
+
organizationId: {
|
|
33
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
34
|
+
ref: "organization",
|
|
35
|
+
},
|
|
36
|
+
client: {
|
|
37
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
38
|
+
ref: "client",
|
|
39
|
+
},
|
|
40
|
+
filters: {
|
|
41
|
+
type: Object,
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
otherFilters: {
|
|
45
|
+
type: Object,
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
}, {
|
|
49
|
+
timestamps: true
|
|
50
|
+
});
|
|
51
|
+
// Pre-save middleware to generate title from filters
|
|
52
|
+
// PrecalculationFiltersSchema.pre('save', function(next) {
|
|
53
|
+
// if (!this.title) {
|
|
54
|
+
// // Generate title from filters object
|
|
55
|
+
// const filterValues = Object.values(this.filters);
|
|
56
|
+
// const otherFilterValues = Object.values(this.otherFilters);
|
|
57
|
+
// // Combine all values and create a title
|
|
58
|
+
// const allValues = [...filterValues, ...otherFilterValues]
|
|
59
|
+
// .filter(value => value !== null && value !== undefined)
|
|
60
|
+
// .map(value => {
|
|
61
|
+
// if (typeof value === 'object') {
|
|
62
|
+
// return Object.values(value).join(' ');
|
|
63
|
+
// }
|
|
64
|
+
// return value.toString();
|
|
65
|
+
// })
|
|
66
|
+
// .join(' ');
|
|
67
|
+
// // Truncate if too long and add ellipsis
|
|
68
|
+
// this.title = allValues.length > 50
|
|
69
|
+
// ? allValues.substring(0, 47) + '...'
|
|
70
|
+
// : allValues;
|
|
71
|
+
// }
|
|
72
|
+
// next();
|
|
73
|
+
// });
|
|
74
|
+
PrecalculationFiltersSchema.index({ organizationId: 1, test: 1 });
|
|
75
|
+
PrecalculationFiltersSchema.index({ organizationId: 1, client: 1 });
|
|
76
|
+
// Check if model is already registered
|
|
77
|
+
const PrecalculationFilters = mongoose_1.default.models.precalculationfilter || (0, mongoose_1.model)("precalculationfilter", PrecalculationFiltersSchema);
|
|
78
|
+
exports.default = PrecalculationFilters;
|
|
@@ -24,12 +24,10 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IQueryLog extends Document {
|
|
27
|
-
|
|
27
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
28
28
|
query: string;
|
|
29
29
|
timeTaken: number;
|
|
30
30
|
user?: mongoose.Schema.Types.ObjectId;
|
|
31
31
|
}
|
|
32
|
-
declare const QueryLog: mongoose.Model<
|
|
33
|
-
_id: mongoose.Types.ObjectId;
|
|
34
|
-
}, any>;
|
|
32
|
+
declare const QueryLog: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
35
33
|
export default QueryLog;
|
|
@@ -25,8 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
27
|
const QueryLogSchema = new mongoose_1.Schema({
|
|
28
|
-
|
|
29
|
-
type:
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
30
31
|
default: null,
|
|
31
32
|
},
|
|
32
33
|
query: {
|
|
@@ -42,5 +43,5 @@ const QueryLogSchema = new mongoose_1.Schema({
|
|
|
42
43
|
}, {
|
|
43
44
|
timestamps: true,
|
|
44
45
|
});
|
|
45
|
-
const QueryLog = (0, mongoose_1.model)("querylog", QueryLogSchema);
|
|
46
|
+
const QueryLog = mongoose_1.default.models.querylog || (0, mongoose_1.model)("querylog", QueryLogSchema);
|
|
46
47
|
exports.default = QueryLog;
|
|
@@ -27,8 +27,7 @@ export interface IReadNotification extends Document {
|
|
|
27
27
|
notification?: mongoose.Schema.Types.ObjectId;
|
|
28
28
|
user?: mongoose.Schema.Types.ObjectId;
|
|
29
29
|
read?: boolean;
|
|
30
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
30
31
|
}
|
|
31
|
-
declare const ReadNotification: mongoose.Model<
|
|
32
|
-
_id: mongoose.Types.ObjectId;
|
|
33
|
-
}, any>;
|
|
32
|
+
declare const ReadNotification: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
34
33
|
export default ReadNotification;
|
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
26
|
+
const mongoose_1 = __importStar(require("mongoose"));
|
|
4
27
|
const ReadNotificationSchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
5
33
|
notification: {
|
|
6
34
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
7
35
|
ref: "notification",
|
|
@@ -17,5 +45,5 @@ const ReadNotificationSchema = new mongoose_1.Schema({
|
|
|
17
45
|
}, {
|
|
18
46
|
timestamps: true,
|
|
19
47
|
});
|
|
20
|
-
const ReadNotification = (0, mongoose_1.model)("readnotification", ReadNotificationSchema);
|
|
48
|
+
const ReadNotification = mongoose_1.default.models.readnotification || (0, mongoose_1.model)("readnotification", ReadNotificationSchema);
|
|
21
49
|
exports.default = ReadNotification;
|
|
@@ -38,11 +38,10 @@ export interface IReports extends Document {
|
|
|
38
38
|
from?: Date;
|
|
39
39
|
to?: Date;
|
|
40
40
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
41
|
-
excludedFromCalculations?:
|
|
41
|
+
excludedFromCalculations?: boolean;
|
|
42
42
|
createdAt?: Date;
|
|
43
43
|
updatedAt?: Date;
|
|
44
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
44
45
|
}
|
|
45
|
-
declare const Report: mongoose.Model<
|
|
46
|
-
_id: mongoose.Types.ObjectId;
|
|
47
|
-
}, any>;
|
|
46
|
+
declare const Report: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
48
47
|
export default Report;
|
|
@@ -25,69 +25,53 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
27
27
|
const ReportsSchema = new mongoose_1.Schema({
|
|
28
|
-
|
|
29
|
-
type:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
reportLink: {
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
conclusion: {
|
|
39
|
-
type: String,
|
|
40
|
-
},
|
|
41
|
-
variant: {
|
|
42
|
-
type: String,
|
|
43
|
-
},
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
33
|
+
name: { type: String, required: true },
|
|
34
|
+
segmentName: { type: String },
|
|
35
|
+
reportLink: { type: String },
|
|
36
|
+
conclusion: { type: String },
|
|
37
|
+
variant: { type: String },
|
|
44
38
|
client: {
|
|
45
39
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
46
|
-
ref: "client"
|
|
47
|
-
},
|
|
48
|
-
viewId: {
|
|
49
|
-
type: String,
|
|
40
|
+
ref: "client"
|
|
50
41
|
},
|
|
42
|
+
viewId: { type: String },
|
|
51
43
|
test: {
|
|
52
44
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
53
|
-
ref: "test"
|
|
54
|
-
},
|
|
55
|
-
gaTestId: {
|
|
56
|
-
type: String,
|
|
57
|
-
},
|
|
58
|
-
reportDetails: {
|
|
59
|
-
type: mongoose_1.default.Schema.Types.Mixed,
|
|
45
|
+
ref: "test"
|
|
60
46
|
},
|
|
47
|
+
gaTestId: { type: String },
|
|
48
|
+
reportDetails: { type: mongoose_1.default.Schema.Types.Mixed },
|
|
61
49
|
learnings: {
|
|
62
50
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
63
|
-
default: []
|
|
64
|
-
},
|
|
65
|
-
from: {
|
|
66
|
-
type: Date,
|
|
67
|
-
},
|
|
68
|
-
to: {
|
|
69
|
-
type: Date,
|
|
51
|
+
default: []
|
|
70
52
|
},
|
|
53
|
+
from: { type: Date },
|
|
54
|
+
to: { type: Date },
|
|
71
55
|
createdBy: {
|
|
72
56
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
73
|
-
ref: "user"
|
|
57
|
+
ref: "user"
|
|
74
58
|
},
|
|
75
59
|
excludedFromCalculations: {
|
|
76
60
|
type: Boolean,
|
|
77
61
|
default: false
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
default: new Date(),
|
|
82
|
-
},
|
|
83
|
-
updatedAt: {
|
|
84
|
-
type: Date,
|
|
85
|
-
default: new Date(),
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
ReportsSchema.index({
|
|
89
|
-
client: 1,
|
|
90
|
-
conclusion: 1,
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
timestamps: true
|
|
91
65
|
});
|
|
92
|
-
|
|
66
|
+
// Add compound indexes for better query performance
|
|
67
|
+
ReportsSchema.index({ client: 1, conclusion: 1 });
|
|
68
|
+
ReportsSchema.index({ test: 1, to: -1 }); // For sorting reports by date
|
|
69
|
+
ReportsSchema.index({ client: 1, test: 1 }); // For client-specific test reports
|
|
70
|
+
ReportsSchema.index({ from: 1, to: 1 }); // For date range queries
|
|
71
|
+
ReportsSchema.index({ client: 1, "reportDetails.implementedStatus": 1 }); // For implemented status queries
|
|
72
|
+
ReportsSchema.index({ client: 1, "reportDetails.conclusionFactorStatusAll": 1 }); // For conclusion factor queries
|
|
73
|
+
ReportsSchema.index({ client: 1, gaTestId: 1 }); // For GA test ID lookups
|
|
74
|
+
ReportsSchema.index({ createdBy: 1, to: -1 }); // For user's reports
|
|
75
|
+
ReportsSchema.index({ client: 1, excludedFromCalculations: 1 }); // For calculation exclusions
|
|
76
|
+
const Report = mongoose_1.default.models.report || (0, mongoose_1.model)("report", ReportsSchema);
|
|
93
77
|
exports.default = Report;
|
|
@@ -25,10 +25,11 @@
|
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface IRole extends Document {
|
|
27
27
|
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
30
|
+
isActive?: boolean;
|
|
28
31
|
createdAt?: Date;
|
|
29
32
|
updatedAt?: Date;
|
|
30
33
|
}
|
|
31
|
-
declare const Role: mongoose.Model<
|
|
32
|
-
_id: mongoose.Types.ObjectId;
|
|
33
|
-
}, any>;
|
|
34
|
+
declare const Role: mongoose.Model<any, {}, {}, {}, any, any>;
|
|
34
35
|
export default Role;
|