codebase-models 2.0.8 → 2.1.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.
@@ -42,7 +42,8 @@ mongoose_1.default.plugin(mongoose_slug_updater_1.default);
42
42
  const UrltargetingsSchema = new mongoose_1.Schema({
43
43
  iid: {
44
44
  type: String,
45
- unique: true,
45
+ required: true,
46
+ trim: true,
46
47
  },
47
48
  type: {
48
49
  type: String,
@@ -63,7 +64,7 @@ const UrltargetingsSchema = new mongoose_1.Schema({
63
64
  const PageSchema = new mongoose_1.Schema({
64
65
  iid: {
65
66
  type: String,
66
- unique: true,
67
+ trim: true,
67
68
  },
68
69
  name: {
69
70
  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,8 +198,6 @@ 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
202
  TestSchema.index({ enddate: 1 });
205
203
  const Test = mongoose_1.default.models.test || (0, mongoose_1.model)("test", TestSchema);
@@ -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.8",
3
+ "version": "2.1.0",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -31,7 +31,8 @@ export interface IPage extends Document {
31
31
  const UrltargetingsSchema = new Schema<IUrltargetings>({
32
32
  iid: {
33
33
  type: String,
34
- unique: true,
34
+ required: true,
35
+ trim: true,
35
36
  },
36
37
  type: {
37
38
  type: String,
@@ -53,7 +54,7 @@ const UrltargetingsSchema = new Schema<IUrltargetings>({
53
54
  const PageSchema = new Schema<IPage>({
54
55
  iid: {
55
56
  type: String,
56
- unique: true,
57
+ trim: true,
57
58
  },
58
59
  name: {
59
60
  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,9 +250,6 @@ 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
254
  TestSchema.index({ enddate: 1 });
259
255
 
@@ -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: {