Merge pull request 'fix: worker new if not has provinceFk' (!2741) from warmFix_worker_new into test
Reviewed-on: #2741 Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
This commit is contained in:
commit
4795b1ad88
|
@ -193,9 +193,13 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
await user.updateAttribute('email', email, myOptions);
|
await user.updateAttribute('email', email, myOptions);
|
||||||
const {countryFk} = await Self.app.models.Province.findById(provinceFk, {
|
let countryFk;
|
||||||
fields: ['countryFk']
|
if (provinceFk) {
|
||||||
});
|
const province = await Self.app.models.Province.findById(provinceFk, {
|
||||||
|
fields: ['countryFk']
|
||||||
|
});
|
||||||
|
countryFk = province.countryFk;
|
||||||
|
}
|
||||||
await models.Worker.create({
|
await models.Worker.create({
|
||||||
id: user.id,
|
id: user.id,
|
||||||
firstName,
|
firstName,
|
||||||
|
@ -205,7 +209,6 @@ module.exports = Self => {
|
||||||
fi,
|
fi,
|
||||||
birth,
|
birth,
|
||||||
originCountryFk: countryFk
|
originCountryFk: countryFk
|
||||||
|
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
Loading…
Reference in New Issue