codebase-models 2.1.8 → 2.1.10

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.js CHANGED
@@ -119,7 +119,7 @@ function seedRoles() {
119
119
  return __awaiter(this, void 0, void 0, function* () {
120
120
  const checkRoles = yield Role_1.default.countDocuments();
121
121
  if (checkRoles < 5) {
122
- Promise.all(["USER", "ADMIN", "EDITOR", "OPTIMIZER", "CLIENT"].map((name) => {
122
+ Promise.all(["USER", "ADMIN", "EDITOR", "OPTIMIZER", "CLIENT", "EXTERNAL"].map((name) => {
123
123
  Role_1.default.bulkWrite([
124
124
  {
125
125
  updateOne: {
@@ -29,6 +29,7 @@ export interface IAudience extends Document {
29
29
  name: string;
30
30
  rules_js?: string;
31
31
  client?: mongoose.Schema.Types.ObjectId;
32
+ createdBy?: mongoose.Schema.Types.ObjectId;
32
33
  }
33
34
  declare const Audience: mongoose.Model<any, {}, {}, {}, any, any>;
34
35
  export default Audience;
@@ -55,6 +55,11 @@ const AudienceSchema = new mongoose_1.Schema({
55
55
  type: mongoose_1.default.Schema.Types.ObjectId,
56
56
  ref: "client",
57
57
  },
58
+ createdBy: {
59
+ type: mongoose_1.default.Schema.Types.ObjectId,
60
+ ref: "user",
61
+ default: null,
62
+ },
58
63
  }, {
59
64
  timestamps: true,
60
65
  });
@@ -30,6 +30,7 @@ export interface IClientReportsTemp extends Document {
30
30
  test?: mongoose.Schema.Types.ObjectId;
31
31
  filters?: string;
32
32
  metricsFilters?: string;
33
+ otherFilters?: mongoose.Schema.Types.Mixed;
33
34
  date?: Date;
34
35
  report?: mongoose.Schema.Types.Mixed;
35
36
  deactivated?: boolean;
@@ -49,6 +49,10 @@ const ClientReportsTempSchema = new mongoose_1.Schema({
49
49
  type: String,
50
50
  trim: true,
51
51
  },
52
+ otherFilters: {
53
+ type: mongoose_1.default.Schema.Types.Mixed,
54
+ default: {},
55
+ },
52
56
  date: {
53
57
  type: Date,
54
58
  },
@@ -32,6 +32,7 @@ export interface IEnvironment extends Document {
32
32
  isActive?: boolean;
33
33
  default?: boolean;
34
34
  qa?: boolean;
35
+ createdBy?: mongoose.Schema.Types.ObjectId;
35
36
  }
36
37
  declare const Environment: mongoose.Model<any, {}, {}, {}, any, any>;
37
38
  export default Environment;
@@ -70,7 +70,12 @@ const EnvironmentSchema = new mongoose_1.Schema({
70
70
  qa: {
71
71
  type: Boolean,
72
72
  default: false,
73
- }
73
+ },
74
+ createdBy: {
75
+ type: mongoose_1.default.Schema.Types.ObjectId,
76
+ ref: "user",
77
+ default: null,
78
+ },
74
79
  }, {
75
80
  timestamps: true
76
81
  });
@@ -36,8 +36,7 @@ export interface IGoal extends Document {
36
36
  api_name: string;
37
37
  rules_js: string;
38
38
  isActive?: boolean;
39
- createdAt?: Date;
40
- updatedAt?: Date;
39
+ createdBy?: mongoose.Schema.Types.ObjectId;
41
40
  }
42
41
  declare const Goal: mongoose.Model<any, {}, {}, {}, any, any>;
43
42
  export default Goal;
@@ -94,6 +94,11 @@ const GoalSchema = new mongoose_1.Schema({
94
94
  isActive: {
95
95
  type: Boolean,
96
96
  default: true,
97
+ },
98
+ createdBy: {
99
+ type: mongoose_1.default.Schema.Types.ObjectId,
100
+ ref: "user",
101
+ default: null,
97
102
  }
98
103
  }, {
99
104
  timestamps: true
@@ -42,6 +42,7 @@ export interface IHypothesisSheet extends Document {
42
42
  designedToIncreaseUserMotivation?: Number;
43
43
  thoughtsOfTeam?: Number;
44
44
  tested?: Boolean;
45
+ createdBy?: mongoose.Schema.Types.ObjectId;
45
46
  }
46
47
  declare const HypothesisSheet: mongoose.Model<IHypothesisSheet, {}, {}, {}, mongoose.Document<unknown, {}, IHypothesisSheet> & IHypothesisSheet & {
47
48
  _id: mongoose.Types.ObjectId;
@@ -106,6 +106,11 @@ const HypothesisSheetSchema = new mongoose_1.Schema({
106
106
  type: Boolean,
107
107
  default: false,
108
108
  },
109
+ createdBy: {
110
+ type: mongoose_1.default.Schema.Types.ObjectId,
111
+ ref: "user",
112
+ default: null,
113
+ },
109
114
  }, {
110
115
  timestamps: true,
111
116
  });
@@ -42,6 +42,7 @@ export interface IPage extends Document {
42
42
  rules_js: string;
43
43
  urltargetings: IUrltargetings[];
44
44
  isActive?: boolean;
45
+ createdBy?: mongoose.Schema.Types.ObjectId;
45
46
  }
46
47
  declare const Page: mongoose.Model<any, {}, {}, {}, any, any>;
47
48
  export default Page;
@@ -114,6 +114,11 @@ const PageSchema = new mongoose_1.Schema({
114
114
  isActive: {
115
115
  type: Boolean,
116
116
  default: true,
117
+ },
118
+ createdBy: {
119
+ type: mongoose_1.default.Schema.Types.ObjectId,
120
+ ref: "user",
121
+ default: null,
117
122
  }
118
123
  }, {
119
124
  timestamps: true
package/index.ts CHANGED
@@ -54,7 +54,7 @@ async function seedRoles() {
54
54
  const checkRoles = await Role.countDocuments();
55
55
  if (checkRoles < 5) {
56
56
  Promise.all(
57
- ["USER", "ADMIN", "EDITOR", "OPTIMIZER", "CLIENT"].map((name) => {
57
+ ["USER", "ADMIN", "EDITOR", "OPTIMIZER", "CLIENT", "EXTERNAL"].map((name) => {
58
58
  Role.bulkWrite([
59
59
  {
60
60
  updateOne: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "2.1.8",
3
+ "version": "2.1.10",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -7,6 +7,7 @@ export interface IAudience extends Document {
7
7
  name: string;
8
8
  rules_js?: string;
9
9
  client?: mongoose.Schema.Types.ObjectId;
10
+ createdBy?: mongoose.Schema.Types.ObjectId;
10
11
  }
11
12
 
12
13
  const AudienceSchema = new Schema<IAudience>(
@@ -31,6 +32,11 @@ const AudienceSchema = new Schema<IAudience>(
31
32
  type: mongoose.Schema.Types.ObjectId,
32
33
  ref: "client",
33
34
  },
35
+ createdBy: {
36
+ type: mongoose.Schema.Types.ObjectId,
37
+ ref: "user",
38
+ default: null,
39
+ },
34
40
  },
35
41
  {
36
42
  timestamps: true,
@@ -7,6 +7,7 @@ export interface IClientReportsTemp extends Document {
7
7
  test?: mongoose.Schema.Types.ObjectId;
8
8
  filters?: string;
9
9
  metricsFilters?: string;
10
+ otherFilters?: mongoose.Schema.Types.Mixed;
10
11
  date?: Date;
11
12
  report?: mongoose.Schema.Types.Mixed;
12
13
  deactivated?: boolean;
@@ -39,6 +40,10 @@ const ClientReportsTempSchema = new Schema<IClientReportsTemp>(
39
40
  type: String,
40
41
  trim: true,
41
42
  },
43
+ otherFilters: {
44
+ type: mongoose.Schema.Types.Mixed,
45
+ default: {},
46
+ },
42
47
  date: {
43
48
  type: Date,
44
49
  },
@@ -10,6 +10,7 @@ export interface IEnvironment extends Document {
10
10
  isActive?: boolean;
11
11
  default?: boolean;
12
12
  qa?: boolean;
13
+ createdBy?: mongoose.Schema.Types.ObjectId;
13
14
  }
14
15
 
15
16
  const EnvironmentSchema = new Schema<IEnvironment>({
@@ -49,7 +50,12 @@ const EnvironmentSchema = new Schema<IEnvironment>({
49
50
  qa: {
50
51
  type: Boolean,
51
52
  default: false,
52
- }
53
+ },
54
+ createdBy: {
55
+ type: mongoose.Schema.Types.ObjectId,
56
+ ref: "user",
57
+ default: null,
58
+ },
53
59
  }, {
54
60
  timestamps: true
55
61
  });
@@ -16,8 +16,7 @@ export interface IGoal extends Document {
16
16
  api_name: string;
17
17
  rules_js: string;
18
18
  isActive?: boolean;
19
- createdAt?: Date;
20
- updatedAt?: Date;
19
+ createdBy?: mongoose.Schema.Types.ObjectId;
21
20
  }
22
21
 
23
22
  const GoalSchema = new Schema<IGoal>({
@@ -75,6 +74,11 @@ const GoalSchema = new Schema<IGoal>({
75
74
  isActive: {
76
75
  type: Boolean,
77
76
  default: true,
77
+ },
78
+ createdBy: {
79
+ type: mongoose.Schema.Types.ObjectId,
80
+ ref: "user",
81
+ default: null,
78
82
  }
79
83
  }, {
80
84
  timestamps: true
@@ -20,6 +20,7 @@ export interface IHypothesisSheet extends Document {
20
20
  designedToIncreaseUserMotivation?: Number;
21
21
  thoughtsOfTeam?: Number;
22
22
  tested?: Boolean;
23
+ createdBy?: mongoose.Schema.Types.ObjectId;
23
24
  }
24
25
 
25
26
  const HypothesisSheetSchema = new Schema<IHypothesisSheet>(
@@ -101,6 +102,11 @@ const HypothesisSheetSchema = new Schema<IHypothesisSheet>(
101
102
  type: Boolean,
102
103
  default: false,
103
104
  },
105
+ createdBy: {
106
+ type: mongoose.Schema.Types.ObjectId,
107
+ ref: "user",
108
+ default: null,
109
+ },
104
110
  },
105
111
  {
106
112
  timestamps: true,
@@ -26,6 +26,7 @@ export interface IPage extends Document {
26
26
  rules_js: string;
27
27
  urltargetings: IUrltargetings[];
28
28
  isActive?: boolean;
29
+ createdBy?: mongoose.Schema.Types.ObjectId;
29
30
  }
30
31
 
31
32
  const UrltargetingsSchema = new Schema<IUrltargetings>({
@@ -107,6 +108,11 @@ const PageSchema = new Schema<IPage>({
107
108
  isActive: {
108
109
  type: Boolean,
109
110
  default: true,
111
+ },
112
+ createdBy: {
113
+ type: mongoose.Schema.Types.ObjectId,
114
+ ref: "user",
115
+ default: null,
110
116
  }
111
117
  }, {
112
118
  timestamps: true