codebase-models 2.1.22 → 2.1.24

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 CHANGED
@@ -72,9 +72,9 @@ import Environment from "./src/models/Environment";
72
72
  import PrecalculationFilters from "./src/models/PrecalculationFilters";
73
73
  import BqPreCompiledData from "./src/models/BqPreCompiledData";
74
74
  import CustomQuery from "./src/models/CustomQuery";
75
- import { generateRandomIID } from "./src/constant";
75
+ import { generateRandomIID, RolesConstants } from "./src/constant";
76
76
  import TestTimeline from "./src/models/TestTimeline";
77
77
  import CronData from "./src/models/CronData";
78
78
  import CronConfig from "./src/models/CronConfig";
79
79
  export declare function connect(uri: string, options?: mongoose.ConnectOptions | undefined): Promise<typeof mongoose>;
80
- export { generateRandomIID, Client, ClientReportsTemp, QueryLog, Report, Test, TestSequentialValue, User, AppEvent, Announcement, ClientAdditionalRevenue, ClientLearning, ClientLinks, ClientNextStep, ClientNote, ClientRetention, ClientStrategy, ClientSurvey, CVRReport, Faq, Feedback, Goal, Hypothesis, HypothesisSheet, LandingPages, NewIdeas, Notification, Page, PageElement, PageTestType, Portfolio, ReadNotification, Role, CustomQuery, SavedSegment, TestTimeline, Segment, SegmentCombination, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, Audience, Environment, Organization, PrecalculationFilters, BqPreCompiledData, CronData, CronConfig, UserPermission };
80
+ export { generateRandomIID, RolesConstants, Client, ClientReportsTemp, QueryLog, Report, Test, TestSequentialValue, User, AppEvent, Announcement, ClientAdditionalRevenue, ClientLearning, ClientLinks, ClientNextStep, ClientNote, ClientRetention, ClientStrategy, ClientSurvey, CVRReport, Faq, Feedback, Goal, Hypothesis, HypothesisSheet, LandingPages, NewIdeas, Notification, Page, PageElement, PageTestType, Portfolio, ReadNotification, Role, CustomQuery, SavedSegment, TestTimeline, Segment, SegmentCombination, Snippet, StageInCustomerJourney, Tag, Temp, Tier, Trigger, ClientScript, Audience, Environment, Organization, PrecalculationFilters, BqPreCompiledData, CronData, CronConfig, UserPermission, };
package/dist/index.js CHANGED
@@ -12,8 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.PrecalculationFilters = exports.Organization = exports.Environment = exports.Audience = exports.ClientScript = exports.Trigger = exports.Tier = exports.Temp = exports.Tag = exports.StageInCustomerJourney = exports.Snippet = exports.SegmentCombination = exports.Segment = exports.TestTimeline = exports.SavedSegment = exports.CustomQuery = exports.Role = exports.ReadNotification = exports.Portfolio = exports.PageTestType = exports.PageElement = exports.Page = exports.Notification = exports.NewIdeas = exports.LandingPages = exports.HypothesisSheet = exports.Hypothesis = exports.Goal = exports.Feedback = exports.Faq = exports.CVRReport = exports.ClientSurvey = exports.ClientStrategy = exports.ClientRetention = exports.ClientNote = exports.ClientNextStep = exports.ClientLinks = exports.ClientLearning = exports.ClientAdditionalRevenue = exports.Announcement = exports.AppEvent = exports.User = exports.TestSequentialValue = exports.Test = exports.Report = exports.QueryLog = exports.ClientReportsTemp = exports.Client = exports.generateRandomIID = exports.connect = void 0;
16
- exports.UserPermission = exports.CronConfig = exports.CronData = exports.BqPreCompiledData = void 0;
15
+ exports.Organization = exports.Environment = exports.Audience = exports.ClientScript = exports.Trigger = exports.Tier = exports.Temp = exports.Tag = exports.StageInCustomerJourney = exports.Snippet = exports.SegmentCombination = exports.Segment = exports.TestTimeline = exports.SavedSegment = exports.CustomQuery = exports.Role = exports.ReadNotification = exports.Portfolio = exports.PageTestType = exports.PageElement = exports.Page = exports.Notification = exports.NewIdeas = exports.LandingPages = exports.HypothesisSheet = exports.Hypothesis = exports.Goal = exports.Feedback = exports.Faq = exports.CVRReport = exports.ClientSurvey = exports.ClientStrategy = exports.ClientRetention = exports.ClientNote = exports.ClientNextStep = exports.ClientLinks = exports.ClientLearning = exports.ClientAdditionalRevenue = exports.Announcement = exports.AppEvent = exports.User = exports.TestSequentialValue = exports.Test = exports.Report = exports.QueryLog = exports.ClientReportsTemp = exports.Client = exports.RolesConstants = exports.generateRandomIID = exports.connect = void 0;
16
+ exports.UserPermission = exports.CronConfig = exports.CronData = exports.BqPreCompiledData = exports.PrecalculationFilters = void 0;
17
17
  const mongoose_1 = __importDefault(require("mongoose"));
18
18
  const Client_1 = __importDefault(require("./src/models/Client"));
19
19
  exports.Client = Client_1.default;
@@ -115,6 +115,7 @@ const CustomQuery_1 = __importDefault(require("./src/models/CustomQuery"));
115
115
  exports.CustomQuery = CustomQuery_1.default;
116
116
  const constant_1 = require("./src/constant");
117
117
  Object.defineProperty(exports, "generateRandomIID", { enumerable: true, get: function () { return constant_1.generateRandomIID; } });
118
+ Object.defineProperty(exports, "RolesConstants", { enumerable: true, get: function () { return constant_1.RolesConstants; } });
118
119
  const TestTimeline_1 = __importDefault(require("./src/models/TestTimeline"));
119
120
  exports.TestTimeline = TestTimeline_1.default;
120
121
  const CronData_1 = __importDefault(require("./src/models/CronData"));
@@ -124,8 +125,8 @@ exports.CronConfig = CronConfig_1.default;
124
125
  function seedRoles() {
125
126
  return __awaiter(this, void 0, void 0, function* () {
126
127
  const checkRoles = yield Role_1.default.countDocuments();
127
- if (checkRoles < 5) {
128
- Promise.all(["USER", "ADMIN", "EDITOR", "OPTIMIZER", "CLIENT", "EXTERNAL"].map((name) => {
128
+ if (checkRoles < constant_1.RolesConstants.length) {
129
+ Promise.all(constant_1.RolesConstants.map((name) => {
129
130
  Role_1.default.bulkWrite([
130
131
  {
131
132
  updateOne: {
@@ -8,11 +8,12 @@ declare const HypothesisSheetConstants: {
8
8
  MEDIUM: number;
9
9
  GOOD: number;
10
10
  };
11
+ declare const RolesConstants: string[];
11
12
  /**
12
13
  * Generates a random unique identifier
13
14
  * @returns A 12-character uppercase string (increased from 8 for better uniqueness)
14
15
  * @throws Error if UUID generation fails
15
16
  */
16
17
  declare const generateRandomIID: () => string;
17
- export { generateRandomIID };
18
+ export { generateRandomIID, RolesConstants };
18
19
  export default HypothesisSheetConstants;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateRandomIID = void 0;
3
+ exports.RolesConstants = exports.generateRandomIID = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  const HypothesisSheetConstants = {
6
6
  NO: 0,
@@ -14,6 +14,17 @@ const HypothesisSheetConstants = {
14
14
  MEDIUM: 1,
15
15
  GOOD: 2,
16
16
  };
17
+ const RolesConstants = [
18
+ "USER",
19
+ "ADMIN",
20
+ // "EDITOR",
21
+ // "COLLABORATOR",
22
+ "CLIENT",
23
+ "EXTERNAL",
24
+ "QA",
25
+ "OPTIMIZER",
26
+ ];
27
+ exports.RolesConstants = RolesConstants;
17
28
  /**
18
29
  * Generates a random unique identifier
19
30
  * @returns A 12-character uppercase string (increased from 8 for better uniqueness)
@@ -22,10 +33,10 @@ const HypothesisSheetConstants = {
22
33
  const generateRandomIID = () => {
23
34
  try {
24
35
  // Take first 12 characters instead of 8 for better uniqueness
25
- return (0, uuid_1.v4)().replace(/-/g, '').substring(0, 12).toUpperCase();
36
+ return (0, uuid_1.v4)().replace(/-/g, "").substring(0, 12).toUpperCase();
26
37
  }
27
38
  catch (error) {
28
- throw new Error(`Failed to generate random IID: ${error instanceof Error ? error.message : 'Unknown error'}`);
39
+ throw new Error(`Failed to generate random IID: ${error instanceof Error ? error.message : "Unknown error"}`);
29
40
  }
30
41
  };
31
42
  exports.generateRandomIID = generateRandomIID;
@@ -38,6 +38,8 @@ const CronConfigSchema = new mongoose_1.Schema({
38
38
  iid: {
39
39
  type: String,
40
40
  unique: true,
41
+ sparse: true, // ✅ avoids null duplication
42
+ default: () => (0, constant_1.generateRandomIID)(), // ✅ auto-generate always
41
43
  },
42
44
  organizationId: {
43
45
  type: mongoose_1.default.Schema.Types.ObjectId,
@@ -86,7 +88,7 @@ const CronConfigSchema = new mongoose_1.Schema({
86
88
  required: true,
87
89
  },
88
90
  }, {
89
- timestamps: true
91
+ timestamps: true,
90
92
  });
91
93
  CronConfigSchema.pre("save", function (next) {
92
94
  return __awaiter(this, void 0, void 0, function* () {
@@ -98,5 +100,7 @@ CronConfigSchema.pre("save", function (next) {
98
100
  });
99
101
  CronConfigSchema.index({ test: 1 });
100
102
  CronConfigSchema.index({ client: 1 });
101
- const CronConfig = mongoose_1.default.models.cronConfig || (0, mongoose_1.model)("cronConfig", CronConfigSchema);
103
+ CronConfigSchema.index({ iid: 1 }, { unique: true, sparse: true });
104
+ const CronConfig = mongoose_1.default.models.cronConfig ||
105
+ (0, mongoose_1.model)("cronConfig", CronConfigSchema);
102
106
  exports.default = CronConfig;
@@ -29,7 +29,16 @@ const RoleSchema = new mongoose_1.Schema({
29
29
  type: String,
30
30
  unique: true,
31
31
  required: true,
32
- enum: ["USER", "ADMIN", "EDITOR", "COLLABORATOR", "CLIENT", "EXTERNAL"],
32
+ enum: [
33
+ "USER",
34
+ "ADMIN",
35
+ "EDITOR",
36
+ "COLLABORATOR",
37
+ "CLIENT",
38
+ "EXTERNAL",
39
+ "QA",
40
+ "OPTIMIZER",
41
+ ],
33
42
  trim: true,
34
43
  uppercase: true,
35
44
  },
@@ -56,12 +65,12 @@ const RoleSchema = new mongoose_1.Schema({
56
65
  cvrReports: { type: Boolean, default: true },
57
66
  manageExperiments: { type: Boolean, default: true },
58
67
  dashboard: { type: Boolean, default: true },
59
- }
68
+ },
60
69
  }, {
61
- timestamps: true
70
+ timestamps: true,
62
71
  });
63
72
  // IF role is CLIENT then defaultPermissions should be false for all modules except reporting, insights, documentsAndLinks, cvrReports, dashboard
64
- RoleSchema.pre('save', function (next) {
73
+ RoleSchema.pre("save", function (next) {
65
74
  const allTrue = {
66
75
  abTestingDefault: true,
67
76
  abTesting: true,
@@ -73,7 +82,7 @@ RoleSchema.pre('save', function (next) {
73
82
  cvrReports: true,
74
83
  dashboard: true,
75
84
  };
76
- if (this.name === 'CLIENT') {
85
+ if (this.name === "CLIENT") {
77
86
  this.defaultPermissions = Object.assign(Object.assign({}, allTrue), { abTesting: false });
78
87
  }
79
88
  else {
@@ -86,8 +95,8 @@ RoleSchema.index({ name: 1, isActive: 1 });
86
95
  RoleSchema.index({ organizationId: 1, name: 1 });
87
96
  // Add text index for search
88
97
  RoleSchema.index({
89
- name: 'text',
90
- description: 'text'
98
+ name: "text",
99
+ description: "text",
91
100
  });
92
101
  const Role = mongoose_1.default.models.role || (0, mongoose_1.model)("role", RoleSchema);
93
102
  exports.default = Role;
package/index.ts CHANGED
@@ -49,15 +49,15 @@ import Environment from "./src/models/Environment";
49
49
  import PrecalculationFilters from "./src/models/PrecalculationFilters";
50
50
  import BqPreCompiledData from "./src/models/BqPreCompiledData";
51
51
  import CustomQuery from "./src/models/CustomQuery";
52
- import { generateRandomIID } from "./src/constant";
52
+ import { generateRandomIID, RolesConstants } from "./src/constant";
53
53
  import TestTimeline from "./src/models/TestTimeline";
54
54
  import CronData from "./src/models/CronData";
55
55
  import CronConfig from "./src/models/CronConfig";
56
56
  async function seedRoles() {
57
57
  const checkRoles = await Role.countDocuments();
58
- if (checkRoles < 5) {
58
+ if (checkRoles < RolesConstants.length) {
59
59
  Promise.all(
60
- ["USER", "ADMIN", "EDITOR", "OPTIMIZER", "CLIENT", "EXTERNAL"].map((name) => {
60
+ RolesConstants.map((name: string) => {
61
61
  Role.bulkWrite([
62
62
  {
63
63
  updateOne: {
@@ -102,6 +102,7 @@ export async function connect(
102
102
 
103
103
  export {
104
104
  generateRandomIID,
105
+ RolesConstants,
105
106
  Client,
106
107
  ClientReportsTemp,
107
108
  QueryLog,
@@ -153,5 +154,5 @@ export {
153
154
  BqPreCompiledData,
154
155
  CronData,
155
156
  CronConfig,
156
- UserPermission
157
- };
157
+ UserPermission,
158
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "2.1.22",
3
+ "version": "2.1.24",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/constant.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { v4 as uuidv4 } from 'uuid';
1
+ import { v4 as uuidv4 } from "uuid";
2
2
 
3
3
  const HypothesisSheetConstants = {
4
4
  NO: 0,
@@ -13,6 +13,17 @@ const HypothesisSheetConstants = {
13
13
  GOOD: 2,
14
14
  };
15
15
 
16
+ const RolesConstants = [
17
+ "USER",
18
+ "ADMIN",
19
+ // "EDITOR",
20
+ // "COLLABORATOR",
21
+ "CLIENT",
22
+ "EXTERNAL",
23
+ "QA",
24
+ "OPTIMIZER",
25
+ ];
26
+
16
27
  /**
17
28
  * Generates a random unique identifier
18
29
  * @returns A 12-character uppercase string (increased from 8 for better uniqueness)
@@ -21,11 +32,15 @@ const HypothesisSheetConstants = {
21
32
  const generateRandomIID = (): string => {
22
33
  try {
23
34
  // Take first 12 characters instead of 8 for better uniqueness
24
- return uuidv4().replace(/-/g, '').substring(0, 12).toUpperCase();
35
+ return uuidv4().replace(/-/g, "").substring(0, 12).toUpperCase();
25
36
  } catch (error) {
26
- throw new Error(`Failed to generate random IID: ${error instanceof Error ? error.message : 'Unknown error'}`);
37
+ throw new Error(
38
+ `Failed to generate random IID: ${
39
+ error instanceof Error ? error.message : "Unknown error"
40
+ }`
41
+ );
27
42
  }
28
43
  };
29
44
 
30
- export { generateRandomIID };
45
+ export { generateRandomIID, RolesConstants };
31
46
  export default HypothesisSheetConstants;
@@ -2,83 +2,91 @@ import mongoose, { Document, Schema, model } from "mongoose";
2
2
  import { generateRandomIID } from "../constant";
3
3
 
4
4
  export interface ICronConfig extends Document {
5
- iid: string;
6
- organizationId?: mongoose.Schema.Types.ObjectId;
7
- jobName: string;
8
- description: string;
9
- client: mongoose.Schema.Types.ObjectId;
10
- test: mongoose.Schema.Types.ObjectId;
11
- active: boolean;
12
- lastRun: Date;
13
- nextRun: Date;
14
- schedule: string;
15
- metadata: mongoose.Schema.Types.Mixed;
16
- createdBy: mongoose.Schema.Types.ObjectId;
5
+ iid: string;
6
+ organizationId?: mongoose.Schema.Types.ObjectId;
7
+ jobName: string;
8
+ description: string;
9
+ client: mongoose.Schema.Types.ObjectId;
10
+ test: mongoose.Schema.Types.ObjectId;
11
+ active: boolean;
12
+ lastRun: Date;
13
+ nextRun: Date;
14
+ schedule: string;
15
+ metadata: mongoose.Schema.Types.Mixed;
16
+ createdBy: mongoose.Schema.Types.ObjectId;
17
17
  }
18
- const CronConfigSchema = new Schema<ICronConfig>({
19
- iid: {
20
- type: String,
21
- unique: true,
18
+ const CronConfigSchema = new Schema<ICronConfig>(
19
+ {
20
+ iid: {
21
+ type: String,
22
+ unique: true,
23
+ sparse: true, // ✅ avoids null duplication
24
+ default: () => generateRandomIID(), // ✅ auto-generate always
25
+ },
26
+ organizationId: {
27
+ type: mongoose.Schema.Types.ObjectId,
28
+ ref: "organization",
29
+ default: null,
30
+ },
31
+ jobName: {
32
+ type: String,
33
+ required: true,
34
+ },
35
+ description: {
36
+ type: String,
37
+ },
38
+ client: {
39
+ type: mongoose.Schema.Types.ObjectId,
40
+ ref: "client",
41
+ },
42
+ test: {
43
+ type: mongoose.Schema.Types.ObjectId,
44
+ ref: "test",
45
+ },
46
+ active: {
47
+ type: Boolean,
48
+ default: true,
49
+ },
50
+ lastRun: {
51
+ type: Date,
52
+ default: null,
53
+ },
54
+ nextRun: {
55
+ type: Date,
56
+ default: null,
57
+ },
58
+ schedule: {
59
+ type: String,
60
+ required: true,
61
+ },
62
+ metadata: {
63
+ type: mongoose.Schema.Types.Mixed,
64
+ default: null,
65
+ },
66
+ createdBy: {
67
+ type: mongoose.Schema.Types.ObjectId,
68
+ ref: "user",
69
+ default: null,
70
+ required: true,
71
+ },
22
72
  },
23
- organizationId: {
24
- type: mongoose.Schema.Types.ObjectId,
25
- ref: "organization",
26
- default: null,
27
- },
28
- jobName: {
29
- type: String,
30
- required: true,
31
- },
32
- description: {
33
- type: String,
34
- },
35
- client: {
36
- type: mongoose.Schema.Types.ObjectId,
37
- ref: "client",
38
- },
39
- test: {
40
- type: mongoose.Schema.Types.ObjectId,
41
- ref: "test",
42
- },
43
- active: {
44
- type: Boolean,
45
- default: true,
46
- },
47
- lastRun: {
48
- type: Date,
49
- default: null,
50
- },
51
- nextRun: {
52
- type: Date,
53
- default: null,
54
- },
55
- schedule: {
56
- type: String,
57
- required: true,
58
- },
59
- metadata: {
60
- type: mongoose.Schema.Types.Mixed,
61
- default: null,
62
- },
63
- createdBy: {
64
- type: mongoose.Schema.Types.ObjectId,
65
- ref: "user",
66
- default: null,
67
- required: true,
68
- },
69
- }, {
70
- timestamps: true
71
- });
73
+ {
74
+ timestamps: true,
75
+ }
76
+ );
72
77
 
73
78
  CronConfigSchema.pre("save", async function (next) {
74
- if (!this.iid) {
75
- this.iid = generateRandomIID();
76
- }
77
- next();
78
- });
79
+ if (!this.iid) {
80
+ this.iid = generateRandomIID();
81
+ }
82
+ next();
83
+ });
79
84
 
80
85
  CronConfigSchema.index({ test: 1 });
81
86
  CronConfigSchema.index({ client: 1 });
87
+ CronConfigSchema.index({ iid: 1 }, { unique: true, sparse: true });
82
88
 
83
- const CronConfig = mongoose.models.cronConfig || model<ICronConfig>("cronConfig", CronConfigSchema);
89
+ const CronConfig =
90
+ mongoose.models.cronConfig ||
91
+ model<ICronConfig>("cronConfig", CronConfigSchema);
84
92
  export default CronConfig;
@@ -20,44 +20,56 @@ export interface IRole extends Document {
20
20
  };
21
21
  }
22
22
 
23
- const RoleSchema = new Schema<IRole>({
24
- name: {
25
- type: String,
26
- unique: true,
27
- required: true,
28
- enum: ["USER", "ADMIN", "EDITOR", "COLLABORATOR", "CLIENT", "EXTERNAL"],
29
- trim: true,
30
- uppercase: true,
23
+ const RoleSchema = new Schema<IRole>(
24
+ {
25
+ name: {
26
+ type: String,
27
+ unique: true,
28
+ required: true,
29
+ enum: [
30
+ "USER",
31
+ "ADMIN",
32
+ "EDITOR",
33
+ "COLLABORATOR",
34
+ "CLIENT",
35
+ "EXTERNAL",
36
+ "QA",
37
+ "OPTIMIZER",
38
+ ],
39
+ trim: true,
40
+ uppercase: true,
41
+ },
42
+ description: {
43
+ type: String,
44
+ trim: true,
45
+ },
46
+ organizationId: {
47
+ type: mongoose.Schema.Types.ObjectId,
48
+ ref: "organization",
49
+ default: null,
50
+ },
51
+ isActive: {
52
+ type: Boolean,
53
+ default: true,
54
+ },
55
+ defaultPermissions: {
56
+ abTestingDefault: { type: Boolean, default: true },
57
+ abTesting: { type: Boolean, default: false },
58
+ preCalculations: { type: Boolean, default: true },
59
+ reporting: { type: Boolean, default: true },
60
+ insights: { type: Boolean, default: true },
61
+ documentsAndLinks: { type: Boolean, default: true },
62
+ cvrReports: { type: Boolean, default: true },
63
+ manageExperiments: { type: Boolean, default: true },
64
+ dashboard: { type: Boolean, default: true },
65
+ },
31
66
  },
32
- description: {
33
- type: String,
34
- trim: true,
35
- },
36
- organizationId: {
37
- type: mongoose.Schema.Types.ObjectId,
38
- ref: "organization",
39
- default: null,
40
- },
41
- isActive: {
42
- type: Boolean,
43
- default: true,
44
- },
45
- defaultPermissions: {
46
- abTestingDefault: { type: Boolean, default: true },
47
- abTesting: { type: Boolean, default: false },
48
- preCalculations: { type: Boolean, default: true },
49
- reporting: { type: Boolean, default: true },
50
- insights: { type: Boolean, default: true },
51
- documentsAndLinks: { type: Boolean, default: true },
52
- cvrReports: { type: Boolean, default: true },
53
- manageExperiments: { type: Boolean, default: true },
54
- dashboard: { type: Boolean, default: true },
67
+ {
68
+ timestamps: true,
55
69
  }
56
- }, {
57
- timestamps: true
58
- });
70
+ );
59
71
  // IF role is CLIENT then defaultPermissions should be false for all modules except reporting, insights, documentsAndLinks, cvrReports, dashboard
60
- RoleSchema.pre('save', function(next) {
72
+ RoleSchema.pre("save", function (next) {
61
73
  const allTrue = {
62
74
  abTestingDefault: true,
63
75
  abTesting: true,
@@ -69,7 +81,7 @@ RoleSchema.pre('save', function(next) {
69
81
  cvrReports: true,
70
82
  dashboard: true,
71
83
  };
72
- if (this.name === 'CLIENT') {
84
+ if (this.name === "CLIENT") {
73
85
  this.defaultPermissions = {
74
86
  ...allTrue,
75
87
  abTesting: false, // only this one is false
@@ -88,9 +100,9 @@ RoleSchema.index({ name: 1, isActive: 1 });
88
100
  RoleSchema.index({ organizationId: 1, name: 1 });
89
101
 
90
102
  // Add text index for search
91
- RoleSchema.index({
92
- name: 'text',
93
- description: 'text'
103
+ RoleSchema.index({
104
+ name: "text",
105
+ description: "text",
94
106
  });
95
107
 
96
108
  const Role = mongoose.models.role || model<IRole>("role", RoleSchema);