perf: update state ticket
This commit is contained in:
parent
62cb5d0d57
commit
2719a9dea6
|
@ -43,8 +43,16 @@ module.exports = Self => {
|
|||
const {code} = await models.State.findById(params.stateFk, {fields: ['code']}, myOptions);
|
||||
params.code = code;
|
||||
} else {
|
||||
const state = await models.State.findOne({where: {id: params.code}}, myOptions);
|
||||
params.stateFk = state.id;
|
||||
const {id, code} = await models.State.findOne({
|
||||
where: {
|
||||
or: [
|
||||
{code: params.code},
|
||||
{id: params.code}
|
||||
]
|
||||
}
|
||||
}, myOptions);
|
||||
params.stateFk = id;
|
||||
params.code = code;
|
||||
}
|
||||
|
||||
if (!params.userFk) {
|
||||
|
|
Loading…
Reference in New Issue