think-model
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -42,3 +42,3 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
case 'UPDATE': | ||
yield model.getSchema(); | ||
yield model.db().getSchema(); | ||
const { pk } = model; | ||
@@ -45,0 +45,0 @@ |
@@ -89,3 +89,6 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
const promises = Object.keys(_this.relation).map(function (key) { | ||
if (helper.isArray(_this.relationName) && _this.relationName.indexOf(key) === -1) return; | ||
if (helper.isArray(_this.relationName) && _this.relationName.indexOf(key) === -1) { | ||
return; | ||
} | ||
const instance = _this.getRelationInstance(key, data, type); | ||
@@ -149,2 +152,3 @@ if (helper.isEmpty(instance)) return; | ||
if (!type) { | ||
// get relation data | ||
const itemData = helper.isArray(data) ? data[0] : data; | ||
@@ -155,2 +159,7 @@ const relData = itemData[opts.name]; | ||
} | ||
} else { | ||
// set relation data | ||
if (type !== 'DELETE' && helper.isEmpty(data[opts.name])) { | ||
return; | ||
} | ||
} | ||
@@ -157,0 +166,0 @@ |
{ | ||
"name": "think-model", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "An adapter-based ORM for ThinkJS 3.x", | ||
@@ -35,4 +35,3 @@ "scripts": { | ||
"think-helper": "^1.0.22", | ||
"think-model-abstract": "^1.2.0", | ||
"think-mysql": "^1.1.0" | ||
"think-model-abstract": "^1.2.0" | ||
}, | ||
@@ -39,0 +38,0 @@ "devDependencies": { |
@@ -107,8 +107,8 @@ const {test} = require('ava'); | ||
}, | ||
getSchema() { | ||
} | ||
}; | ||
}; | ||
model.getSchema = function() { | ||
}; | ||
model.where = function(where) { | ||
@@ -115,0 +115,0 @@ t.deepEqual(where, {user_id: 3}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
176831
4
32
6367
1
- Removedthink-mysql@^1.1.0
- Removedbignumber.js@9.0.0(transitive)
- Removeddebug@2.6.9(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedms@2.0.0(transitive)
- Removedmysql@2.18.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.7(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsqlstring@2.3.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedthink-instance@1.0.2(transitive)
- Removedthink-mysql@1.4.4(transitive)
- Removedutil-deprecate@1.0.2(transitive)