fix(client): check businesTypeFk before clientCredit insert
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
2e604f61d9
commit
6a78ac46c7
|
@ -374,11 +374,14 @@ module.exports = Self => {
|
||||||
throw new UserError(`You don't have enough privileges to set this credit amount`);
|
throw new UserError(`You don't have enough privileges to set this credit amount`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const client = await models.Client.findById(finalState.id, null, ctx.options);
|
||||||
|
if (client.businessTypeFk) {
|
||||||
await models.ClientCredit.create({
|
await models.ClientCredit.create({
|
||||||
amount: changes.credit,
|
amount: changes.credit,
|
||||||
clientFk: finalState.id,
|
clientFk: finalState.id,
|
||||||
workerFk: userId
|
workerFk: userId
|
||||||
}, ctx.options);
|
}, ctx.options);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
Loading…
Reference in New Issue