codebase-models 1.0.6 → 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 +5 -4
- package/dist/index.js +20 -11
- package/dist/src/models/Announcement.d.ts +6 -5
- package/dist/src/models/Announcement.js +29 -9
- package/dist/src/models/Audience.d.ts +2 -1
- package/dist/src/models/Audience.js +6 -1
- 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 +3 -1
- package/dist/src/models/Client.js +31 -45
- 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 +25 -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 -0
- package/dist/src/models/Report.js +35 -47
- 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 +18 -17
- 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
|
@@ -26,8 +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
34
|
declare const PageTestType: mongoose.Model<IPageTestType, {}, {}, {}, mongoose.Document<unknown, {}, IPageTestType> & IPageTestType & {
|
|
33
35
|
_id: mongoose.Types.ObjectId;
|
|
@@ -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
|
});
|
|
57
|
+
// Compound indexes for common query patterns
|
|
58
|
+
PageTestTypeSchema.index({ name: 1, isActive: 1 });
|
|
23
59
|
const PageTestType = (0, mongoose_1.model)("pagetesttype", PageTestTypeSchema);
|
|
24
60
|
exports.default = PageTestType;
|
|
@@ -26,6 +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
31
|
declare const Portfolio: mongoose.Model<IPortfolio, {}, {}, {}, mongoose.Document<unknown, {}, IPortfolio> & IPortfolio & {
|
|
31
32
|
_id: mongoose.Types.ObjectId;
|
|
@@ -33,6 +33,11 @@ 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
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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<IPrecalculationFilters, {}, {}, {}, mongoose.Document<unknown, {}, IPrecalculationFilters> & IPrecalculationFilters & {
|
|
34
|
+
_id: mongoose.Types.ObjectId;
|
|
35
|
+
}, any>;
|
|
36
|
+
export default PrecalculationFilters;
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
const PrecalculationFilters = (0, mongoose_1.model)("precalculationfilters", PrecalculationFiltersSchema);
|
|
77
|
+
exports.default = PrecalculationFilters;
|
|
@@ -24,7 +24,7 @@
|
|
|
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;
|
|
@@ -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: {
|
|
@@ -27,6 +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
32
|
declare const ReadNotification: mongoose.Model<IReadNotification, {}, {}, {}, mongoose.Document<unknown, {}, IReadNotification> & IReadNotification & {
|
|
32
33
|
_id: mongoose.Types.ObjectId;
|
|
@@ -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",
|
|
@@ -38,8 +38,10 @@ export interface IReports extends Document {
|
|
|
38
38
|
from?: Date;
|
|
39
39
|
to?: Date;
|
|
40
40
|
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
41
|
+
excludedFromCalculations?: boolean;
|
|
41
42
|
createdAt?: Date;
|
|
42
43
|
updatedAt?: Date;
|
|
44
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
43
45
|
}
|
|
44
46
|
declare const Report: mongoose.Model<IReports, {}, {}, {}, mongoose.Document<unknown, {}, IReports> & IReports & {
|
|
45
47
|
_id: mongoose.Types.ObjectId;
|
|
@@ -25,65 +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
|
-
|
|
76
|
-
type:
|
|
77
|
-
default:
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
default: new Date(),
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
ReportsSchema.index({
|
|
85
|
-
client: 1,
|
|
86
|
-
conclusion: 1,
|
|
59
|
+
excludedFromCalculations: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
timestamps: true
|
|
87
65
|
});
|
|
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
|
|
88
76
|
const Report = (0, mongoose_1.model)("report", ReportsSchema);
|
|
89
77
|
exports.default = Report;
|
|
@@ -25,6 +25,9 @@
|
|
|
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
|
}
|
package/dist/src/models/Role.js
CHANGED
|
@@ -1,21 +1,64 @@
|
|
|
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 RoleSchema = new mongoose_1.Schema({
|
|
5
28
|
name: {
|
|
6
29
|
type: String,
|
|
7
30
|
unique: true,
|
|
8
31
|
required: true,
|
|
9
32
|
enum: ["USER", "ADMIN", "EDITOR", "COLLABORATOR", "CLIENT"],
|
|
33
|
+
trim: true,
|
|
34
|
+
index: true,
|
|
35
|
+
uppercase: true,
|
|
10
36
|
},
|
|
11
|
-
|
|
12
|
-
type:
|
|
13
|
-
|
|
37
|
+
description: {
|
|
38
|
+
type: String,
|
|
39
|
+
trim: true,
|
|
14
40
|
},
|
|
15
|
-
|
|
16
|
-
type:
|
|
17
|
-
|
|
41
|
+
organizationId: {
|
|
42
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
43
|
+
ref: "organization",
|
|
44
|
+
index: true,
|
|
45
|
+
default: null,
|
|
18
46
|
},
|
|
47
|
+
isActive: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true,
|
|
50
|
+
index: true,
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
timestamps: true
|
|
54
|
+
});
|
|
55
|
+
// Compound indexes for common query patterns
|
|
56
|
+
RoleSchema.index({ name: 1, isActive: 1 });
|
|
57
|
+
RoleSchema.index({ organizationId: 1, name: 1 });
|
|
58
|
+
// Add text index for search
|
|
59
|
+
RoleSchema.index({
|
|
60
|
+
name: 'text',
|
|
61
|
+
description: 'text'
|
|
19
62
|
});
|
|
20
63
|
const Role = (0, mongoose_1.model)("role", RoleSchema);
|
|
21
64
|
exports.default = Role;
|
|
@@ -27,6 +27,7 @@ export interface ISavedSegment extends Document {
|
|
|
27
27
|
test?: mongoose.Schema.Types.ObjectId;
|
|
28
28
|
segment?: mongoose.Schema.Types.ObjectId;
|
|
29
29
|
segmentFilters?: mongoose.Schema.Types.Mixed;
|
|
30
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
30
31
|
}
|
|
31
32
|
declare const SavedSegment: mongoose.Model<ISavedSegment, {}, {}, {}, mongoose.Document<unknown, {}, ISavedSegment> & ISavedSegment & {
|
|
32
33
|
_id: mongoose.Types.ObjectId;
|
|
@@ -37,6 +37,11 @@ const SavedSegmentSchema = new mongoose_1.Schema({
|
|
|
37
37
|
type: mongoose_1.default.Schema.Types.Mixed,
|
|
38
38
|
default: null,
|
|
39
39
|
},
|
|
40
|
+
organizationId: {
|
|
41
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
42
|
+
ref: "organization",
|
|
43
|
+
default: null,
|
|
44
|
+
},
|
|
40
45
|
}, {
|
|
41
46
|
timestamps: true,
|
|
42
47
|
});
|
|
@@ -30,6 +30,7 @@ export interface ISegment extends Document {
|
|
|
30
30
|
segmentType?: string;
|
|
31
31
|
client?: mongoose.Schema.Types.ObjectId;
|
|
32
32
|
published?: boolean;
|
|
33
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
33
34
|
}
|
|
34
35
|
declare const Segment: mongoose.Model<ISegment, {}, {}, {}, mongoose.Document<unknown, {}, ISegment> & ISegment & {
|
|
35
36
|
_id: mongoose.Types.ObjectId;
|
|
@@ -25,6 +25,11 @@ 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 SegmentSchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
28
33
|
name: {
|
|
29
34
|
type: String,
|
|
30
35
|
},
|
|
@@ -34,6 +34,7 @@ export interface ISegmentCombination extends Document {
|
|
|
34
34
|
order?: Number;
|
|
35
35
|
createdAt?: Date;
|
|
36
36
|
updatedAt?: Date;
|
|
37
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
37
38
|
}
|
|
38
39
|
declare const SegmentCombination: mongoose.Model<ISegmentCombination, {}, {}, {}, mongoose.Document<unknown, {}, ISegmentCombination> & ISegmentCombination & {
|
|
39
40
|
_id: mongoose.Types.ObjectId;
|
|
@@ -25,6 +25,11 @@ 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 SegmentSchema = new mongoose_1.Schema({
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
31
|
+
default: null,
|
|
32
|
+
},
|
|
28
33
|
name: {
|
|
29
34
|
type: String,
|
|
30
35
|
},
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
26
|
export interface ISnippet extends Document {
|
|
27
|
-
organisationId?: string;
|
|
28
27
|
name?: string;
|
|
29
28
|
pageelement?: mongoose.Schema.Types.ObjectId[];
|
|
30
29
|
client?: mongoose.Schema.Types.ObjectId;
|
|
@@ -36,6 +35,8 @@ export interface ISnippet extends Document {
|
|
|
36
35
|
jscode?: string;
|
|
37
36
|
test?: mongoose.Schema.Types.ObjectId;
|
|
38
37
|
status?: string;
|
|
38
|
+
isActive?: boolean;
|
|
39
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
39
40
|
}
|
|
40
41
|
declare const Snippet: mongoose.Model<ISnippet, {}, {}, {}, mongoose.Document<unknown, {}, ISnippet> & ISnippet & {
|
|
41
42
|
_id: mongoose.Types.ObjectId;
|
|
@@ -25,58 +25,83 @@ 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 SnippetSchema = new mongoose_1.Schema({
|
|
28
|
-
|
|
29
|
-
type:
|
|
28
|
+
organizationId: {
|
|
29
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
30
|
+
ref: "organization",
|
|
30
31
|
default: null,
|
|
32
|
+
index: true,
|
|
31
33
|
},
|
|
32
34
|
name: {
|
|
33
35
|
type: String,
|
|
34
36
|
required: true,
|
|
35
37
|
unique: true,
|
|
38
|
+
trim: true,
|
|
39
|
+
index: true,
|
|
36
40
|
},
|
|
37
41
|
pageelement: {
|
|
38
42
|
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
39
43
|
ref: "pageelement",
|
|
40
44
|
default: [],
|
|
45
|
+
index: true,
|
|
41
46
|
},
|
|
42
47
|
client: {
|
|
43
48
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
44
49
|
ref: "client",
|
|
50
|
+
required: true,
|
|
51
|
+
index: true,
|
|
45
52
|
},
|
|
46
53
|
details: {
|
|
47
54
|
type: String,
|
|
48
55
|
default: "",
|
|
56
|
+
trim: true,
|
|
49
57
|
},
|
|
50
58
|
figmaUrl: {
|
|
51
59
|
type: String,
|
|
60
|
+
trim: true,
|
|
52
61
|
},
|
|
53
62
|
tags: {
|
|
54
63
|
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
55
64
|
ref: "tag",
|
|
56
65
|
default: [],
|
|
66
|
+
index: true,
|
|
57
67
|
},
|
|
58
68
|
htmlcode: {
|
|
59
69
|
type: String,
|
|
60
70
|
default: "",
|
|
71
|
+
trim: true,
|
|
61
72
|
},
|
|
62
73
|
csscode: {
|
|
63
74
|
type: String,
|
|
75
|
+
trim: true,
|
|
64
76
|
},
|
|
65
77
|
jscode: {
|
|
66
78
|
type: String,
|
|
67
79
|
default: "",
|
|
80
|
+
trim: true,
|
|
68
81
|
},
|
|
69
82
|
test: {
|
|
70
83
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
71
84
|
ref: "test",
|
|
85
|
+
index: true,
|
|
72
86
|
},
|
|
73
87
|
status: {
|
|
74
88
|
type: String,
|
|
75
89
|
default: "live",
|
|
76
|
-
enum: ["live", "draft"],
|
|
90
|
+
enum: ["live", "draft", "running", "paused", "preview", "ended"],
|
|
91
|
+
index: true,
|
|
77
92
|
},
|
|
93
|
+
isActive: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: true,
|
|
96
|
+
index: true,
|
|
97
|
+
}
|
|
78
98
|
}, {
|
|
79
99
|
timestamps: true,
|
|
80
100
|
});
|
|
101
|
+
// Compound indexes for common query patterns
|
|
102
|
+
SnippetSchema.index({ client: 1, name: 1 }, { unique: true });
|
|
103
|
+
SnippetSchema.index({ organisationId: 1, client: 1 });
|
|
104
|
+
SnippetSchema.index({ client: 1, tags: 1 });
|
|
105
|
+
SnippetSchema.index({ client: 1, pageelement: 1 });
|
|
81
106
|
const Snippet = (0, mongoose_1.model)("snippet", SnippetSchema);
|
|
82
107
|
exports.default = Snippet;
|
|
@@ -27,7 +27,9 @@ export interface IStageInCustomerJourney extends Document {
|
|
|
27
27
|
name?: string;
|
|
28
28
|
stages?: string;
|
|
29
29
|
slug?: string;
|
|
30
|
-
organizationId?:
|
|
30
|
+
organizationId?: mongoose.Schema.Types.ObjectId;
|
|
31
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
32
|
+
isActive?: boolean;
|
|
31
33
|
}
|
|
32
34
|
declare const StageInCustomerJourney: mongoose.Model<IStageInCustomerJourney, {}, {}, {}, mongoose.Document<unknown, {}, IStageInCustomerJourney> & IStageInCustomerJourney & {
|
|
33
35
|
_id: mongoose.Types.ObjectId;
|