refactor(client): added restriction to change the credit amount from zero set by a manager #731

Merged
carlosjr merged 2 commits from 3087-client_credit into dev 2021-09-09 14:49:54 +00:00
1 changed files with 2 additions and 2 deletions
Showing only changes of commit b0d291e49c - Show all commits

View File

@ -336,8 +336,8 @@ module.exports = Self => {
order: 'id DESC'
}, ctx.options);
const lastAmount = lastCredit.amount;
const lastWorkerId = lastCredit.workerFk;
const lastAmount = lastCredit && lastCredit.amount;
const lastWorkerId = lastCredit && lastCredit.workerFk;
const lastWorkerIsManager = await models.Account.hasRole(lastWorkerId, 'manager', ctx.options);
if (lastAmount == 0 && lastWorkerIsManager)