codebase-models 2.1.18 → 2.1.20

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.
@@ -35,7 +35,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
35
35
  const mongoose_1 = __importStar(require("mongoose"));
36
36
  const constant_1 = require("../constant");
37
37
  const VariationsSchema = new mongoose_1.Schema({
38
- iid: { type: String, unique: true },
38
+ iid: { type: String,
39
+ trim: true,
40
+ unique: true,
41
+ },
39
42
  name: { type: String, required: true },
40
43
  css_code: { type: String, default: "" },
41
44
  baseline: { type: Boolean, default: false },
@@ -50,7 +53,7 @@ const VariationsSchema = new mongoose_1.Schema({
50
53
  changesets: { type: String, default: "[]" }
51
54
  });
52
55
  const TestSchema = new mongoose_1.Schema({
53
- iid: { type: String, unique: true },
56
+ iid: { type: String, trim: true },
54
57
  organizationId: {
55
58
  type: mongoose_1.default.Schema.Types.ObjectId,
56
59
  ref: "organization",
@@ -59,7 +62,7 @@ const TestSchema = new mongoose_1.Schema({
59
62
  status: {
60
63
  type: String,
61
64
  default: "draft",
62
- enum: ["live", "draft", "ended", "paused", "preview", "running", "discard"]
65
+ enum: ["live", "draft", "ended", "paused", "preview", "running", "archive"]
63
66
  },
64
67
  name: { type: String, required: true },
65
68
  traffic_allocation: { type: Number, default: 100 },
@@ -67,6 +67,5 @@ const UserSchema = new mongoose_1.Schema({
67
67
  // Add compound indexes for common query patterns
68
68
  UserSchema.index({ organizationId: 1, role: 1 });
69
69
  UserSchema.index({ organizationId: 1, client: 1 });
70
- UserSchema.index({ email: 1 }, { unique: true });
71
70
  const User = mongoose_1.default.models.user || (0, mongoose_1.model)("user", UserSchema);
72
71
  exports.default = User;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "2.1.18",
3
+ "version": "2.1.20",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -81,7 +81,10 @@ export interface ITest extends Document {
81
81
  }
82
82
 
83
83
  const VariationsSchema = new Schema<IVariations>({
84
- iid: { type: String, unique: true },
84
+ iid: { type: String,
85
+ trim: true,
86
+ unique: true,
87
+ },
85
88
  name: { type: String, required: true },
86
89
  css_code: { type: String, default: "" },
87
90
  baseline: { type: Boolean, default: false },
@@ -98,7 +101,7 @@ const VariationsSchema = new Schema<IVariations>({
98
101
 
99
102
  const TestSchema = new Schema<ITest>(
100
103
  {
101
- iid: { type: String, unique: true },
104
+ iid: { type: String, trim: true },
102
105
  organizationId: {
103
106
  type: mongoose.Schema.Types.ObjectId,
104
107
  ref: "organization",
@@ -107,7 +110,7 @@ const TestSchema = new Schema<ITest>(
107
110
  status: {
108
111
  type: String,
109
112
  default: "draft",
110
- enum: ["live", "draft", "ended", "paused", "preview", "running", "discard"]
113
+ enum: ["live", "draft", "ended", "paused", "preview", "running", "archive"]
111
114
  },
112
115
  name: { type: String, required: true },
113
116
  traffic_allocation: { type: Number, default: 100 },
@@ -65,7 +65,6 @@ const UserSchema = new Schema<IUser>(
65
65
  // Add compound indexes for common query patterns
66
66
  UserSchema.index({ organizationId: 1, role: 1 });
67
67
  UserSchema.index({ organizationId: 1, client: 1 });
68
- UserSchema.index({ email: 1 }, { unique: true });
69
68
 
70
69
  const User = mongoose.models.user || model<IUser>("user", UserSchema);
71
70
  export default User;