@bluedot-innovation/models 7.11.0 → 7.11.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 7.11.1
2
+ - Removed unique index from Zone model for Config API testing
3
+
4
+ ## 7.11.1
5
+ - Added unique index to Destination model for Config API testing
6
+
1
7
  ## 7.11.0
2
8
  - Added Destination model
3
9
 
@@ -22,6 +22,20 @@ const DestinationSchema = new mongoose.Schema({
22
22
 
23
23
  DestinationSchema.plugin(patcher)
24
24
 
25
+ /*
26
+ This index is only used during testing to validate behaviour that relies on the index.
27
+ The real index is created by the script in utils/DbInitializer
28
+ */
29
+ DestinationSchema.index(
30
+ {
31
+ projectId: 1,
32
+ destinationId: 1
33
+ },
34
+ {
35
+ unique: true,
36
+ name: "destinationIdUniqueWithinProject"
37
+ })
38
+
25
39
  // optional mongoose
26
40
  const model = (mongooseInstance) => {
27
41
  let Destination
package/models/Zone.js CHANGED
@@ -121,17 +121,6 @@ let zoneSchema = new Schema({
121
121
  destinationId: {type: String, validate: { validator: helpers.validateDestinationIdLength, msg: 'destinationId must be less than 129 characters long' }},
122
122
  }, {collection: 'zone', autoIndex: false})
123
123
 
124
- zoneSchema.index(
125
- {
126
- projectId: 1,
127
- destinationId: 1
128
- },
129
- {
130
- unique: true,
131
- partialFilterExpression: { 'destinationId': { $exists:true, $type:"string" } },
132
- name: "destinationUniqueWithinProject"
133
- })
134
-
135
124
  // Mongoose-json-patch
136
125
  // https://www.npmjs.com/package/mongoose-json-patch
137
126
  // plugin for PATCH operations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "7.11.0",
3
+ "version": "7.11.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",