refs #2051 feat: uploadFile approach
This commit is contained in:
parent
6b70f8b3eb
commit
6334431d2b
|
@ -96,8 +96,21 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
const promises = [];
|
||||
const {model, create} = myOptions;
|
||||
addedDms.forEach(dms => {
|
||||
const newDms = models[model].create({
|
||||
...create,
|
||||
dmsFk: dms.id
|
||||
}, myOptions);
|
||||
|
||||
return addedDms;
|
||||
promises.push(newDms);
|
||||
});
|
||||
const resolvedPromises = await Promise.all(promises);
|
||||
|
||||
// if (tx) await tx.commit();
|
||||
|
||||
return resolvedPromises;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
|
||||
|
|
Loading…
Reference in New Issue