refs #2051 feat: uploadFile approach

This commit is contained in:
Javier Segarra 2023-12-12 14:00:35 +01:00
parent 6b70f8b3eb
commit 6334431d2b
1 changed files with 14 additions and 1 deletions

View File

@ -96,8 +96,21 @@ module.exports = Self => {
} }
if (tx) await tx.commit(); 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) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();