fix: make sale invoices resource-able.

This commit is contained in:
Ahmed Bouhuolia
2020-10-26 16:36:22 +02:00
parent 61f2eda50f
commit dea6cdd245
3 changed files with 21 additions and 1 deletions

View File

@@ -8,7 +8,6 @@ import {
} from 'lib/ViewRolesBuilder'; } from 'lib/ViewRolesBuilder';
import { flatToNestedArray } from 'utils'; import { flatToNestedArray } from 'utils';
import DependencyGraph from 'lib/DependencyGraph'; import DependencyGraph from 'lib/DependencyGraph';
import TenantManagerSubscriber from 'subscribers/tenantManager';
export default class Account extends TenantModel { export default class Account extends TenantModel {
/** /**

View File

@@ -16,6 +16,10 @@ export default class PaymentReceive extends TenantModel {
return ['created_at', 'updated_at']; return ['created_at', 'updated_at'];
} }
static get resourceable() {
return true;
}
/** /**
* Relationship mapping. * Relationship mapping.
*/ */

View File

@@ -24,6 +24,10 @@ export default class SaleInvoice extends TenantModel {
return ['created_at', 'updated_at']; return ['created_at', 'updated_at'];
} }
static get resourceable() {
return true;
}
/** /**
* Model modifiers. * Model modifiers.
*/ */
@@ -123,4 +127,17 @@ export default class SaleInvoice extends TenantModel {
.where('id', invoiceId) .where('id', invoiceId)
[changeMethod]('payment_amount', Math.abs(amount)); [changeMethod]('payment_amount', Math.abs(amount));
} }
/**
* Model defined fields.
*/
static get fields() {
return {
created_at: {
label: 'Created at',
column: 'created_at',
columnType: 'date',
},
};
}
} }