requested changes
gitea/salix/2076-item_tags_refactor There was a failure building this commit
Details
gitea/salix/2076-item_tags_refactor There was a failure building this commit
Details
This commit is contained in:
parent
f53217bc71
commit
b77f32a733
|
@ -184,9 +184,7 @@ export default class CrudModel extends ModelProxy {
|
|||
let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`;
|
||||
return this.$http.post(url, changes)
|
||||
.then(res => {
|
||||
const newData = res.data;
|
||||
const created = newData.created;
|
||||
const updated = newData.updated;
|
||||
const created = res.data;
|
||||
|
||||
// Apply new data to created instances
|
||||
for (let i = 0; i < orgCreates.length; i++) {
|
||||
|
@ -199,15 +197,6 @@ export default class CrudModel extends ModelProxy {
|
|||
}
|
||||
}
|
||||
|
||||
// Apply new data to updated instances
|
||||
for (let i = 0; i < orgUpdates.length; i++) {
|
||||
const row = orgUpdates[i];
|
||||
for (let prop in row) {
|
||||
if (prop.charAt(0) !== '$')
|
||||
row[prop] = updated[i][prop];
|
||||
}
|
||||
}
|
||||
|
||||
this.applyChanges();
|
||||
super.save();
|
||||
});
|
||||
|
|
|
@ -64,20 +64,16 @@ module.exports = function(Self) {
|
|||
try {
|
||||
let options = {transaction: tx};
|
||||
|
||||
let deleted;
|
||||
if (deletes) {
|
||||
let promises = [];
|
||||
for (let id of deletes)
|
||||
promises.push(this.destroyById(id, options));
|
||||
deleted = await Promise.all(promises);
|
||||
}
|
||||
|
||||
let updated;
|
||||
if (updates) {
|
||||
let promises = [];
|
||||
for (let update of updates)
|
||||
promises.push(this.upsertWithWhere(update.where, update.data, options));
|
||||
updated = await Promise.all(promises);
|
||||
}
|
||||
|
||||
let created;
|
||||
|
@ -91,7 +87,7 @@ module.exports = function(Self) {
|
|||
|
||||
await tx.commit();
|
||||
|
||||
return {deleted, created, updated};
|
||||
return created;
|
||||
} catch (error) {
|
||||
await tx.rollback();
|
||||
throw error;
|
||||
|
|
Loading…
Reference in New Issue