refactor(client): added restriction to change the credit amount from zero set by a manager #731
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue