codebase-models 1.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/dist/index.d.ts +66 -0
- package/dist/index.js +93 -0
- package/dist/src/constant.d.ts +11 -0
- package/dist/src/constant.js +15 -0
- package/dist/src/models/Announcement.d.ts +37 -0
- package/dist/src/models/Announcement.js +59 -0
- package/dist/src/models/CVRReport.d.ts +33 -0
- package/dist/src/models/CVRReport.js +40 -0
- package/dist/src/models/Client.d.ts +51 -0
- package/dist/src/models/Client.js +95 -0
- package/dist/src/models/ClientAdditionalRevenue.d.ts +41 -0
- package/dist/src/models/ClientAdditionalRevenue.js +68 -0
- package/dist/src/models/ClientLearning.d.ts +36 -0
- package/dist/src/models/ClientLearning.js +55 -0
- package/dist/src/models/ClientLinks.d.ts +39 -0
- package/dist/src/models/ClientLinks.js +66 -0
- package/dist/src/models/ClientNextSteps.d.ts +36 -0
- package/dist/src/models/ClientNextSteps.js +55 -0
- package/dist/src/models/ClientNote.d.ts +40 -0
- package/dist/src/models/ClientNote.js +68 -0
- package/dist/src/models/ClientReportsTemp.d.ts +41 -0
- package/dist/src/models/ClientReportsTemp.js +67 -0
- package/dist/src/models/ClientRetention.d.ts +42 -0
- package/dist/src/models/ClientRetention.js +78 -0
- package/dist/src/models/ClientStrategy.d.ts +41 -0
- package/dist/src/models/ClientStrategy.js +73 -0
- package/dist/src/models/ClientSurvay.d.ts +41 -0
- package/dist/src/models/ClientSurvay.js +45 -0
- package/dist/src/models/Faqs.d.ts +36 -0
- package/dist/src/models/Faqs.js +47 -0
- package/dist/src/models/Feedback.d.ts +38 -0
- package/dist/src/models/Feedback.js +58 -0
- package/dist/src/models/Goal.d.ts +37 -0
- package/dist/src/models/Goal.js +30 -0
- package/dist/src/models/Hypothesis.d.ts +39 -0
- package/dist/src/models/Hypothesis.js +38 -0
- package/dist/src/models/HypothesisSheet.d.ts +49 -0
- package/dist/src/models/HypothesisSheet.js +89 -0
- package/dist/src/models/LandingPages.d.ts +38 -0
- package/dist/src/models/LandingPages.js +54 -0
- package/dist/src/models/NewIdeas.d.ts +40 -0
- package/dist/src/models/NewIdeas.js +70 -0
- package/dist/src/models/Notification.d.ts +38 -0
- package/dist/src/models/Notification.js +33 -0
- package/dist/src/models/PageElement.d.ts +35 -0
- package/dist/src/models/PageElement.js +22 -0
- package/dist/src/models/PageTestType.d.ts +35 -0
- package/dist/src/models/PageTestType.js +24 -0
- package/dist/src/models/Portfolio.d.ts +33 -0
- package/dist/src/models/Portfolio.js +40 -0
- package/dist/src/models/QueryLog.d.ts +35 -0
- package/dist/src/models/QueryLog.js +46 -0
- package/dist/src/models/ReadNotification.d.ts +34 -0
- package/dist/src/models/ReadNotification.js +21 -0
- package/dist/src/models/Report.d.ts +47 -0
- package/dist/src/models/Report.js +89 -0
- package/dist/src/models/Role.d.ts +34 -0
- package/dist/src/models/Role.js +21 -0
- package/dist/src/models/SavedSegment.d.ts +34 -0
- package/dist/src/models/SavedSegment.js +44 -0
- package/dist/src/models/Segment.d.ts +37 -0
- package/dist/src/models/Segment.js +54 -0
- package/dist/src/models/SegmentCombination.d.ts +41 -0
- package/dist/src/models/SegmentCombination.js +68 -0
- package/dist/src/models/Snippet.d.ts +43 -0
- package/dist/src/models/Snippet.js +82 -0
- package/dist/src/models/StageInCustomerJourney.d.ts +35 -0
- package/dist/src/models/StageInCustomerJourney.js +21 -0
- package/dist/src/models/Tag.d.ts +34 -0
- package/dist/src/models/Tag.js +20 -0
- package/dist/src/models/Temp.d.ts +35 -0
- package/dist/src/models/Temp.js +22 -0
- package/dist/src/models/Test.d.ts +68 -0
- package/dist/src/models/Test.js +187 -0
- package/dist/src/models/TestSequentialValue.d.ts +38 -0
- package/dist/src/models/TestSequentialValue.js +54 -0
- package/dist/src/models/Tier.d.ts +36 -0
- package/dist/src/models/Tier.js +27 -0
- package/dist/src/models/Trigger.d.ts +36 -0
- package/dist/src/models/Trigger.js +24 -0
- package/dist/src/models/User.d.ts +42 -0
- package/dist/src/models/User.js +70 -0
- package/global.d.ts +1 -0
- package/index.ts +124 -0
- package/package.json +32 -0
- package/src/constant.ts +14 -0
- package/src/models/Announcement.ts +49 -0
- package/src/models/CVRReport.ts +25 -0
- package/src/models/Client.ts +100 -0
- package/src/models/ClientAdditionalRevenue.ts +67 -0
- package/src/models/ClientLearning.ts +48 -0
- package/src/models/ClientLinks.ts +58 -0
- package/src/models/ClientNextSteps.ts +47 -0
- package/src/models/ClientNote.ts +61 -0
- package/src/models/ClientReportsTemp.ts +64 -0
- package/src/models/ClientRetention.ts +76 -0
- package/src/models/ClientStrategy.ts +70 -0
- package/src/models/ClientSurvay.ts +36 -0
- package/src/models/Faqs.ts +32 -0
- package/src/models/Feedback.ts +46 -0
- package/src/models/Goal.ts +40 -0
- package/src/models/Hypothesis.ts +50 -0
- package/src/models/HypothesisSheet.ts +114 -0
- package/src/models/LandingPages.ts +46 -0
- package/src/models/NewIdeas.ts +63 -0
- package/src/models/Notification.ts +47 -0
- package/src/models/PageElement.ts +30 -0
- package/src/models/PageTestType.ts +32 -0
- package/src/models/Portfolio.ts +26 -0
- package/src/models/QueryLog.ts +34 -0
- package/src/models/ReadNotification.ts +34 -0
- package/src/models/Report.ts +87 -0
- package/src/models/Role.ts +28 -0
- package/src/models/SavedSegment.ts +31 -0
- package/src/models/Segment.ts +44 -0
- package/src/models/SegmentCombination.ts +62 -0
- package/src/models/Snippet.ts +78 -0
- package/src/models/StageInCustomerJourney.ts +35 -0
- package/src/models/Tag.ts +27 -0
- package/src/models/Temp.ts +30 -0
- package/src/models/Test.ts +209 -0
- package/src/models/TestSequentialValue.ts +49 -0
- package/src/models/Tier.ts +36 -0
- package/src/models/Trigger.ts +32 -0
- package/src/models/User.ts +61 -0
- package/tsconfig.json +109 -0
|
@@ -0,0 +1,42 @@
|
|
|
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 IUser extends Document {
|
|
27
|
+
name: string;
|
|
28
|
+
email: string;
|
|
29
|
+
password: string;
|
|
30
|
+
token: string;
|
|
31
|
+
role?: mongoose.Schema.Types.ObjectId[];
|
|
32
|
+
deactivated: boolean;
|
|
33
|
+
client?: mongoose.Schema.Types.ObjectId[];
|
|
34
|
+
twoFactor: boolean;
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
resetLink: string;
|
|
38
|
+
}
|
|
39
|
+
declare const User: mongoose.Model<IUser, {}, {}, {}, mongoose.Document<unknown, {}, IUser> & IUser & {
|
|
40
|
+
_id: mongoose.Types.ObjectId;
|
|
41
|
+
}, any>;
|
|
42
|
+
export default User;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 UserSchema = new mongoose_1.Schema({
|
|
28
|
+
name: String,
|
|
29
|
+
email: {
|
|
30
|
+
type: String,
|
|
31
|
+
unique: true,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
password: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
token: String,
|
|
39
|
+
role: {
|
|
40
|
+
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
41
|
+
ref: "role",
|
|
42
|
+
},
|
|
43
|
+
deactivated: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
client: {
|
|
48
|
+
type: [mongoose_1.default.Schema.Types.ObjectId],
|
|
49
|
+
ref: "client",
|
|
50
|
+
default: null,
|
|
51
|
+
},
|
|
52
|
+
twoFactor: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
createdAt: {
|
|
57
|
+
type: Date,
|
|
58
|
+
default: new Date(),
|
|
59
|
+
},
|
|
60
|
+
updatedAt: {
|
|
61
|
+
type: Date,
|
|
62
|
+
default: new Date(),
|
|
63
|
+
},
|
|
64
|
+
resetLink: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: null,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
const User = (0, mongoose_1.model)("user", UserSchema);
|
|
70
|
+
exports.default = User;
|
package/global.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module "mongoose-slug-updater";
|
package/index.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
|
|
3
|
+
import Client from "./src/models/Client";
|
|
4
|
+
import ClientReportsTemp from "./src/models/ClientReportsTemp";
|
|
5
|
+
import QueryLog from "./src/models/QueryLog";
|
|
6
|
+
import Report from "./src/models/Report";
|
|
7
|
+
import Test from "./src/models/Test";
|
|
8
|
+
import TestSequentialValue from "./src/models/TestSequentialValue";
|
|
9
|
+
import User from "./src/models/User";
|
|
10
|
+
import Announcement from "./src/models/Announcement";
|
|
11
|
+
import ClientAdditionalRevenue from "./src/models/ClientAdditionalRevenue";
|
|
12
|
+
import ClientLearning from "./src/models/ClientLearning";
|
|
13
|
+
import ClientLinks from "./src/models/ClientLinks";
|
|
14
|
+
import ClientNextStep from "./src/models/ClientNextSteps";
|
|
15
|
+
import ClientNote from "./src/models/ClientNote";
|
|
16
|
+
import ClientRetention from "./src/models/ClientRetention";
|
|
17
|
+
import ClientStrategy from "./src/models/ClientStrategy";
|
|
18
|
+
import ClientSurvey from "./src/models/ClientSurvay";
|
|
19
|
+
import CVRReport from "./src/models/CVRReport";
|
|
20
|
+
import Faq from "./src/models/Faqs";
|
|
21
|
+
import Feedback from "./src/models/Feedback";
|
|
22
|
+
import Goal from "./src/models/Goal";
|
|
23
|
+
import Hypothesis from "./src/models/Hypothesis";
|
|
24
|
+
import HypothesisSheet from "./src/models/HypothesisSheet";
|
|
25
|
+
import LandingPages from "./src/models/LandingPages";
|
|
26
|
+
import NewIdeas from "./src/models/NewIdeas";
|
|
27
|
+
import Notification from "./src/models/Notification";
|
|
28
|
+
import PageElement from "./src/models/PageElement";
|
|
29
|
+
import PageTestType from "./src/models/PageTestType";
|
|
30
|
+
import Portfolio from "./src/models/Portfolio";
|
|
31
|
+
import ReadNotification from "./src/models/ReadNotification";
|
|
32
|
+
import Role from "./src/models/Role";
|
|
33
|
+
import SavedSegment from "./src/models/SavedSegment";
|
|
34
|
+
import Segment from "./src/models/Segment";
|
|
35
|
+
import SegmentCombination from "./src/models/SegmentCombination";
|
|
36
|
+
import Snippet from "./src/models/Snippet";
|
|
37
|
+
import StageInCustomerJourney from "./src/models/StageInCustomerJourney";
|
|
38
|
+
import Tag from "./src/models/Tag";
|
|
39
|
+
import Temp from "./src/models/Temp";
|
|
40
|
+
import Tier from "./src/models/Tier";
|
|
41
|
+
import Trigger from "./src/models/Trigger";
|
|
42
|
+
|
|
43
|
+
async function seedRoles() {
|
|
44
|
+
const checkRoles = await Role.countDocuments();
|
|
45
|
+
if (checkRoles < 5) {
|
|
46
|
+
Promise.all(
|
|
47
|
+
["USER", "ADMIN", "EDITOR", "OPTIMIZER", "CLIENT"].map((name) => {
|
|
48
|
+
Role.bulkWrite([
|
|
49
|
+
{
|
|
50
|
+
updateOne: {
|
|
51
|
+
filter: {
|
|
52
|
+
name: name,
|
|
53
|
+
},
|
|
54
|
+
update: {
|
|
55
|
+
$set: {
|
|
56
|
+
name,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
upsert: true,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
]);
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function connect(
|
|
69
|
+
uri: string,
|
|
70
|
+
options?: mongoose.ConnectOptions | undefined
|
|
71
|
+
): Promise<typeof mongoose> {
|
|
72
|
+
if (uri) {
|
|
73
|
+
console.log("Connecting to the database on URI: ", uri);
|
|
74
|
+
const mongooseConnection = await mongoose.connect(uri, options);
|
|
75
|
+
if (mongooseConnection.connection.readyState === 1) {
|
|
76
|
+
await seedRoles();
|
|
77
|
+
console.log("Roles seeded successfully");
|
|
78
|
+
}
|
|
79
|
+
return mongooseConnection;
|
|
80
|
+
}
|
|
81
|
+
throw new Error("URI is required to connect to the database");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Client,
|
|
86
|
+
ClientReportsTemp,
|
|
87
|
+
QueryLog,
|
|
88
|
+
Report,
|
|
89
|
+
Test,
|
|
90
|
+
TestSequentialValue,
|
|
91
|
+
User,
|
|
92
|
+
Announcement,
|
|
93
|
+
ClientAdditionalRevenue,
|
|
94
|
+
ClientLearning,
|
|
95
|
+
ClientLinks,
|
|
96
|
+
ClientNextStep,
|
|
97
|
+
ClientNote,
|
|
98
|
+
ClientRetention,
|
|
99
|
+
ClientStrategy,
|
|
100
|
+
ClientSurvey,
|
|
101
|
+
CVRReport,
|
|
102
|
+
Faq,
|
|
103
|
+
Feedback,
|
|
104
|
+
Goal,
|
|
105
|
+
Hypothesis,
|
|
106
|
+
HypothesisSheet,
|
|
107
|
+
LandingPages,
|
|
108
|
+
NewIdeas,
|
|
109
|
+
Notification,
|
|
110
|
+
PageElement,
|
|
111
|
+
PageTestType,
|
|
112
|
+
Portfolio,
|
|
113
|
+
ReadNotification,
|
|
114
|
+
Role,
|
|
115
|
+
SavedSegment,
|
|
116
|
+
Segment,
|
|
117
|
+
SegmentCombination,
|
|
118
|
+
Snippet,
|
|
119
|
+
StageInCustomerJourney,
|
|
120
|
+
Tag,
|
|
121
|
+
Temp,
|
|
122
|
+
Tier,
|
|
123
|
+
Trigger,
|
|
124
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codebase-models",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Common models for codebase",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "rm -rf dist",
|
|
8
|
+
"build": "npm run clean && tsc -d --outDir dist",
|
|
9
|
+
"prepublish": "npm run build"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "Ajay Bhatia <prof.ajaybhatia@gmail.com>",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"mongoose": "^8.2.3",
|
|
16
|
+
"mongoose-slug-updater": "^3.3.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/mongoose": "^5.11.97",
|
|
20
|
+
"@types/node": "^20.11.30",
|
|
21
|
+
"typescript": "^5.4.3"
|
|
22
|
+
},
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/AcceleratedAgency/codebase-models.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/AcceleratedAgency/codebase-models/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/AcceleratedAgency/codebase-models#readme"
|
|
32
|
+
}
|
package/src/constant.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IAnnouncement extends Document {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: String;
|
|
6
|
+
active?: Boolean;
|
|
7
|
+
forRoles?: mongoose.Schema.Types.ObjectId;
|
|
8
|
+
forUsers?: mongoose.Schema.Types.ObjectId;
|
|
9
|
+
readBy?: mongoose.Schema.Types.ObjectId;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const AnnouncementSchema = new Schema<IAnnouncement>(
|
|
13
|
+
{
|
|
14
|
+
title: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
description: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: false,
|
|
21
|
+
},
|
|
22
|
+
active: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true,
|
|
25
|
+
},
|
|
26
|
+
forRoles: {
|
|
27
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
28
|
+
required: true,
|
|
29
|
+
ref: "role",
|
|
30
|
+
},
|
|
31
|
+
forUsers: {
|
|
32
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
33
|
+
required: false,
|
|
34
|
+
ref: "user",
|
|
35
|
+
},
|
|
36
|
+
readBy: {
|
|
37
|
+
type: [mongoose.Schema.Types.ObjectId],
|
|
38
|
+
required: false,
|
|
39
|
+
ref: "user",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
timestamps: true,
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const Announcement = model<IAnnouncement>("announcement", AnnouncementSchema);
|
|
48
|
+
|
|
49
|
+
export default Announcement;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface ICVRReport extends Document {
|
|
4
|
+
reportLink?: string;
|
|
5
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const CVRReportSchema = new Schema<ICVRReport>(
|
|
9
|
+
{
|
|
10
|
+
reportLink: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: null,
|
|
13
|
+
},
|
|
14
|
+
client: {
|
|
15
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
+
ref: "client",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
timestamps: true,
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const CVRReport = model<ICVRReport>("cvrreport", CVRReportSchema);
|
|
25
|
+
export default CVRReport;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import mongoose, { Schema, Document, model } from "mongoose";
|
|
2
|
+
import slug from "mongoose-slug-updater";
|
|
3
|
+
|
|
4
|
+
mongoose.plugin(slug);
|
|
5
|
+
|
|
6
|
+
export interface IProperty extends Document {
|
|
7
|
+
propertyname: string;
|
|
8
|
+
viewId: string;
|
|
9
|
+
platform?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const PropertySchema: Schema = new Schema<IProperty>({
|
|
13
|
+
propertyname: { type: String, required: true },
|
|
14
|
+
viewId: { type: String, required: true },
|
|
15
|
+
platform: { type: String, required: false, default: "UA" },
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export interface IClient extends Document {
|
|
19
|
+
organisationId?: string;
|
|
20
|
+
name: string;
|
|
21
|
+
slug?: string;
|
|
22
|
+
viewId?: string;
|
|
23
|
+
portfolioClient?: boolean;
|
|
24
|
+
gaproperties?: IProperty[];
|
|
25
|
+
tier?: mongoose.Schema.Types.ObjectId;
|
|
26
|
+
active: boolean;
|
|
27
|
+
currency?: string;
|
|
28
|
+
logo?: string;
|
|
29
|
+
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
30
|
+
onboardDate?: Date;
|
|
31
|
+
bqClientId?: string;
|
|
32
|
+
defaultDataSet?: string;
|
|
33
|
+
NDAStatus?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const ClientSchema: Schema = new Schema<IClient>(
|
|
37
|
+
{
|
|
38
|
+
organisationId: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: null,
|
|
41
|
+
},
|
|
42
|
+
name: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
slug: { type: String, slug: ["name"], slugPaddingSize: 4, unique: true },
|
|
47
|
+
viewId: {
|
|
48
|
+
type: String,
|
|
49
|
+
},
|
|
50
|
+
portfolioClient: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
gaproperties: [PropertySchema],
|
|
55
|
+
tier: {
|
|
56
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
57
|
+
ref: "tier",
|
|
58
|
+
default: null,
|
|
59
|
+
},
|
|
60
|
+
active: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true,
|
|
63
|
+
},
|
|
64
|
+
currency: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "USD",
|
|
67
|
+
},
|
|
68
|
+
logo: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "",
|
|
71
|
+
},
|
|
72
|
+
createdBy: {
|
|
73
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
74
|
+
ref: "user",
|
|
75
|
+
default: null,
|
|
76
|
+
},
|
|
77
|
+
onboardDate: {
|
|
78
|
+
type: Date,
|
|
79
|
+
default: new Date(),
|
|
80
|
+
},
|
|
81
|
+
bqClientId: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: null,
|
|
84
|
+
},
|
|
85
|
+
defaultDataSet: {
|
|
86
|
+
type: String,
|
|
87
|
+
},
|
|
88
|
+
NDAStatus: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: false,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{ timestamps: true }
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
ClientSchema.index({ active: 1 });
|
|
97
|
+
|
|
98
|
+
const Client = model<IClient>("client", ClientSchema);
|
|
99
|
+
|
|
100
|
+
export default Client;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IClientAdditionalRevenue extends Document {
|
|
4
|
+
organisationId?: string;
|
|
5
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
6
|
+
additionalRevenueForTests: IAdditionalRevenue;
|
|
7
|
+
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IAdditionalRevenue extends Document {
|
|
11
|
+
segmentName: string;
|
|
12
|
+
lastDate?: Date;
|
|
13
|
+
test?: mongoose.Schema.Types.ObjectId;
|
|
14
|
+
data_to_project?: mongoose.Schema.Types.Mixed;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const AdditionalRevenueSchema = new Schema<IAdditionalRevenue>({
|
|
18
|
+
// add_rev: {
|
|
19
|
+
// type: Number,
|
|
20
|
+
// },
|
|
21
|
+
segmentName: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
lastDate: {
|
|
26
|
+
type: Date,
|
|
27
|
+
},
|
|
28
|
+
test: {
|
|
29
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
30
|
+
ref: "test",
|
|
31
|
+
},
|
|
32
|
+
data_to_project: {
|
|
33
|
+
type: mongoose.Schema.Types.Mixed,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const ClientAdditionalRevenueSchema = new Schema<IClientAdditionalRevenue>(
|
|
38
|
+
{
|
|
39
|
+
organisationId: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: null,
|
|
42
|
+
},
|
|
43
|
+
client: {
|
|
44
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
45
|
+
ref: "client",
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
additionalRevenueForTests: [AdditionalRevenueSchema],
|
|
49
|
+
createdBy: {
|
|
50
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
51
|
+
ref: "user",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
timestamps: true,
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
ClientAdditionalRevenueSchema.index({
|
|
60
|
+
client: 1,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const ClientAdditionalRevenue = model<IClientAdditionalRevenue>(
|
|
64
|
+
"clientadditionalrevenue",
|
|
65
|
+
ClientAdditionalRevenueSchema
|
|
66
|
+
);
|
|
67
|
+
export default ClientAdditionalRevenue;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IClientLearning extends Document {
|
|
4
|
+
name: string;
|
|
5
|
+
organisationId?: string;
|
|
6
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
7
|
+
viewId?: string;
|
|
8
|
+
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ClientLearningSchema = new Schema<IClientLearning>(
|
|
12
|
+
{
|
|
13
|
+
name: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
organisationId: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
21
|
+
client: {
|
|
22
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
23
|
+
ref: "client",
|
|
24
|
+
},
|
|
25
|
+
viewId: {
|
|
26
|
+
type: String,
|
|
27
|
+
},
|
|
28
|
+
createdBy: {
|
|
29
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
30
|
+
ref: "user",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
timestamps: true,
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
ClientLearningSchema.index({
|
|
39
|
+
client: 1,
|
|
40
|
+
viewId: 1,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const ClientLearning = model<IClientLearning>(
|
|
44
|
+
"clientlearning",
|
|
45
|
+
ClientLearningSchema
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export default ClientLearning;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IClientLinks extends Document {
|
|
4
|
+
organisationId?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
link?: string;
|
|
8
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
9
|
+
private?: boolean;
|
|
10
|
+
viewId?: string;
|
|
11
|
+
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const ClientLinksSchema = new Schema<IClientLinks>(
|
|
15
|
+
{
|
|
16
|
+
organisationId: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: null,
|
|
19
|
+
},
|
|
20
|
+
title: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
link: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
client: {
|
|
32
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
33
|
+
ref: "client",
|
|
34
|
+
},
|
|
35
|
+
private: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
viewId: {
|
|
40
|
+
type: String,
|
|
41
|
+
},
|
|
42
|
+
createdBy: {
|
|
43
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
44
|
+
ref: "user",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
timestamps: true,
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
ClientLinksSchema.index({
|
|
53
|
+
client: 1,
|
|
54
|
+
viewId: 1,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const ClientLinks = model<IClientLinks>("clientlink", ClientLinksSchema);
|
|
58
|
+
export default ClientLinks;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import mongoose, { Document, Schema, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IClientNextSteps extends Document {
|
|
4
|
+
name: string;
|
|
5
|
+
organisationId?: string;
|
|
6
|
+
client?: mongoose.Schema.Types.ObjectId;
|
|
7
|
+
viewId?: string;
|
|
8
|
+
createdBy?: mongoose.Schema.Types.ObjectId;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ClientNextStepsSchema = new Schema<IClientNextSteps>(
|
|
12
|
+
{
|
|
13
|
+
name: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
organisationId: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
21
|
+
client: {
|
|
22
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
23
|
+
ref: "client",
|
|
24
|
+
},
|
|
25
|
+
viewId: {
|
|
26
|
+
type: String,
|
|
27
|
+
},
|
|
28
|
+
createdBy: {
|
|
29
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
30
|
+
ref: "user",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
timestamps: true,
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
ClientNextStepsSchema.index({
|
|
39
|
+
client: 1,
|
|
40
|
+
viewId: 1,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const ClientNextStep = model<IClientNextSteps>(
|
|
44
|
+
"clientnextstep",
|
|
45
|
+
ClientNextStepsSchema
|
|
46
|
+
);
|
|
47
|
+
export default ClientNextStep;
|