- feat: Optimize tenancy software architecture.

This commit is contained in:
Ahmed Bouhuolia
2020-08-30 22:11:14 +02:00
parent 74321a2886
commit ca251a2d28
53 changed files with 1581 additions and 1055 deletions

View File

@@ -25,8 +25,7 @@ export default class Vendor extends TenantModel {
static async changeBalance(vendorId, amount) {
const changeMethod = amount > 0 ? 'increment' : 'decrement';
return this.tenant()
.query()
return this.query()
.where('id', vendorId)
[changeMethod]('balance', Math.abs(amount));
}