codebase-models 2.0.7 → 2.0.9

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.
@@ -47,6 +47,6 @@ CVRReportSchema.index({ client: 1 });
47
47
  // Sparse index for reportLink
48
48
  CVRReportSchema.index({ reportLink: 1 }, { sparse: true });
49
49
  // TTL index for automatic cleanup of old reports (1 year)
50
- CVRReportSchema.index({ createdAt: 1 }, { expireAfterSeconds: 31536000 });
50
+ CVRReportSchema.index({ createdAt: 1 });
51
51
  const CVRReport = mongoose_1.default.models.cvrreport || (0, mongoose_1.model)("cvrreport", CVRReportSchema);
52
52
  exports.default = CVRReport;
@@ -78,6 +78,6 @@ ClientReportsTempSchema.index({ viewId: 1 }, { sparse: true });
78
78
  ClientReportsTempSchema.index({ organisationId: 1 }, { sparse: true });
79
79
  ClientReportsTempSchema.index({ test: 1 }, { sparse: true });
80
80
  // TTL index for automatic cleanup of old reports
81
- ClientReportsTempSchema.index({ date: 1 }, { expireAfterSeconds: 86400 }); // 24 hours
81
+ ClientReportsTempSchema.index({ date: 1 }); // 24 hours
82
82
  const ClientReportsTemp = mongoose_1.default.models.clientreportstemp || (0, mongoose_1.model)("clientreportstemp", ClientReportsTempSchema);
83
83
  exports.default = ClientReportsTemp;
@@ -63,7 +63,7 @@ const UrltargetingsSchema = new mongoose_1.Schema({
63
63
  const PageSchema = new mongoose_1.Schema({
64
64
  iid: {
65
65
  type: String,
66
- unique: true,
66
+ trim: true,
67
67
  },
68
68
  name: {
69
69
  type: String,
@@ -42,7 +42,7 @@ mongoose_1.default.plugin(mongoose_slug_updater_1.default);
42
42
  const StageInCustomerJourneySchema = new mongoose_1.Schema({
43
43
  iid: {
44
44
  type: String,
45
- unique: true,
45
+ trim: true,
46
46
  },
47
47
  name: {
48
48
  type: String,
@@ -187,7 +187,7 @@ TestSchema.pre('save', function (next) {
187
187
  next();
188
188
  });
189
189
  });
190
- TestSchema.index({ iid: 1 }, { unique: true });
190
+ TestSchema.index({ iid: 1 });
191
191
  // Add compound indexes for better query performance
192
192
  TestSchema.index({ client: 1, status: 1 });
193
193
  TestSchema.index({ client: 1, status: 1, livedate: 1 });
@@ -198,9 +198,7 @@ TestSchema.index({ "variations._id": 1 });
198
198
  TestSchema.index({ status: 1, livedate: 1 });
199
199
  TestSchema.index({ status: 1, enddate: 1 });
200
200
  // Add partial indexes for better performance
201
- TestSchema.index({ status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
202
- TestSchema.index({ client: 1, status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
203
201
  // Add TTL index for automatic cleanup of ended tests after 1 year
204
- TestSchema.index({ enddate: 1 }, { expireAfterSeconds: 31536000 });
202
+ TestSchema.index({ enddate: 1 });
205
203
  const Test = mongoose_1.default.models.test || (0, mongoose_1.model)("test", TestSchema);
206
204
  exports.default = Test;
@@ -28,7 +28,6 @@ const UserSchema = new mongoose_1.Schema({
28
28
  name: String,
29
29
  email: {
30
30
  type: String,
31
- unique: true,
32
31
  required: true,
33
32
  },
34
33
  password: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -35,7 +35,7 @@ CVRReportSchema.index({ client: 1 });
35
35
  CVRReportSchema.index({ reportLink: 1 }, { sparse: true });
36
36
 
37
37
  // TTL index for automatic cleanup of old reports (1 year)
38
- CVRReportSchema.index({ createdAt: 1 }, { expireAfterSeconds: 31536000 });
38
+ CVRReportSchema.index({ createdAt: 1 });
39
39
 
40
40
  const CVRReport = mongoose.models.cvrreport || model<ICVRReport>("cvrreport", CVRReportSchema);
41
41
  export default CVRReport;
@@ -73,7 +73,7 @@ ClientReportsTempSchema.index({ organisationId: 1 }, { sparse: true });
73
73
  ClientReportsTempSchema.index({ test: 1 }, { sparse: true });
74
74
 
75
75
  // TTL index for automatic cleanup of old reports
76
- ClientReportsTempSchema.index({ date: 1 }, { expireAfterSeconds: 86400 }); // 24 hours
76
+ ClientReportsTempSchema.index({ date: 1 }); // 24 hours
77
77
 
78
78
  const ClientReportsTemp = mongoose.models.clientreportstemp || model<IClientReportsTemp>(
79
79
  "clientreportstemp",
@@ -53,7 +53,7 @@ const UrltargetingsSchema = new Schema<IUrltargetings>({
53
53
  const PageSchema = new Schema<IPage>({
54
54
  iid: {
55
55
  type: String,
56
- unique: true,
56
+ trim: true,
57
57
  },
58
58
  name: {
59
59
  type: String,
@@ -17,7 +17,7 @@ const StageInCustomerJourneySchema = new Schema<IStageInCustomerJourney>(
17
17
  {
18
18
  iid: {
19
19
  type: String,
20
- unique: true,
20
+ trim: true,
21
21
  },
22
22
  name: {
23
23
  type: String,
@@ -238,8 +238,7 @@ TestSchema.pre('save', async function(next) {
238
238
  next();
239
239
  });
240
240
 
241
-
242
- TestSchema.index({ iid: 1 }, { unique: true });
241
+ TestSchema.index({ iid: 1 });
243
242
  // Add compound indexes for better query performance
244
243
  TestSchema.index({ client: 1, status: 1 });
245
244
  TestSchema.index({ client: 1, status: 1, livedate: 1 });
@@ -251,11 +250,8 @@ TestSchema.index({ status: 1, livedate: 1 });
251
250
  TestSchema.index({ status: 1, enddate: 1 });
252
251
 
253
252
  // Add partial indexes for better performance
254
- TestSchema.index({ status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
255
- TestSchema.index({ client: 1, status: 1 }, { partialFilterExpression: { status: { $in: ['live', 'running', 'draft', 'paused', 'preview', 'ended'] } } });
256
-
257
253
  // Add TTL index for automatic cleanup of ended tests after 1 year
258
- TestSchema.index({ enddate: 1 }, { expireAfterSeconds: 31536000 });
254
+ TestSchema.index({ enddate: 1 });
259
255
 
260
256
  const Test = mongoose.models.test || model<ITest>("test", TestSchema);
261
257
 
@@ -19,7 +19,6 @@ const UserSchema = new Schema<IUser>({
19
19
  name: String,
20
20
  email: {
21
21
  type: String,
22
- unique: true,
23
22
  required: true,
24
23
  },
25
24
  password: {