alaska-field-relationship
Advanced tools
Comparing version 0.11.0 to 0.11.2
30
index.js
@@ -29,3 +29,3 @@ // @flow | ||
model: string; | ||
ref: void| Class<Alaska$Model>; | ||
ref: void | Class < Alaska$Model > ; | ||
optional: boolean; | ||
@@ -112,16 +112,18 @@ | ||
let field = this; | ||
schema.pre('save', function (next) { | ||
let record = this; | ||
if (!record.isModified(field.path)) { | ||
if (ref === model) { | ||
let field = this; | ||
schema.pre('save', function (next) { | ||
let record = this; | ||
if (!record.isModified(field.path)) { | ||
next(); | ||
return; | ||
} | ||
let id = record.id; | ||
if (id && String(id) === String(record.get(field.path))) { | ||
next(new Error('Can not relate to record self, ' + model.path + '#' + field.path)); | ||
return; | ||
} | ||
next(); | ||
return; | ||
} | ||
let id = record.id; | ||
if (id && String(id) === String(record.get(field.path))) { | ||
next(new Error('Can not relate to record self, ' + model.path + '#' + field.path)); | ||
return; | ||
} | ||
next(); | ||
}); | ||
}); | ||
} | ||
} | ||
@@ -128,0 +130,0 @@ |
{ | ||
"name": "alaska-field-relationship", | ||
"version": "0.11.0", | ||
"version": "0.11.2", | ||
"description": "Alaska relationship field", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14341
486
0