@bluedot-innovation/models 6.1.2-alpha.1 → 6.1.2-alpha.2

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.
Files changed (2) hide show
  1. package/models/Zone.js +13 -1
  2. package/package.json +1 -1
package/models/Zone.js CHANGED
@@ -121,7 +121,19 @@ let zoneSchema = new Schema({
121
121
  state: {type: String, default: StateEnum.ACTIVE, select: false},
122
122
  accountId: {type: String, required: true, validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'default error message'}},
123
123
  eta: zoneEtaSchema
124
- }, {collection: 'zone'})
124
+ }, {collection: 'zone', autoIndex: false})
125
+
126
+ zoneSchema.index(
127
+ {
128
+ projectId: 1,
129
+ 'eta.destinationId': 1
130
+ },
131
+ {
132
+ unique: true,
133
+ partialFilterExpression: { 'eta.destinationId': { $exists:true, $type:"string" } },
134
+ name: "destinationUniqueWithinProject"
135
+ })
136
+
125
137
 
126
138
  // Mongoose-json-patch
127
139
  // https://www.npmjs.com/package/mongoose-json-patch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "6.1.2-alpha.1",
3
+ "version": "6.1.2-alpha.2",
4
4
  "main": "Models.js",
5
5
  "scripts": {
6
6
  "lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/*.js ./__tests__/**/**/*.js ./schemas/*.js",