fix: worker new if not has provinceFk
gitea/salix/pipeline/pr-test This commit looks good
Details
gitea/salix/pipeline/pr-test This commit looks good
Details
This commit is contained in:
parent
945f20bfcf
commit
b871615e8f
|
@ -193,9 +193,13 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
await user.updateAttribute('email', email, myOptions);
|
||||
const {countryFk} = await Self.app.models.Province.findById(provinceFk, {
|
||||
fields: ['countryFk']
|
||||
});
|
||||
let countryFk;
|
||||
if (provinceFk) {
|
||||
const province = await Self.app.models.Province.findById(provinceFk, {
|
||||
fields: ['countryFk']
|
||||
});
|
||||
countryFk = province.countryFk;
|
||||
}
|
||||
await models.Worker.create({
|
||||
id: user.id,
|
||||
firstName,
|
||||
|
@ -205,7 +209,6 @@ module.exports = Self => {
|
|||
fi,
|
||||
birth,
|
||||
originCountryFk: countryFk
|
||||
|
||||
}, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
|
Loading…
Reference in New Issue