refactoring: custom views service.

fix: constraints of delete item from storage.
fix: constraints of delete item category from storage.
fix: localize database seeds files.
fix: view meta data in accounts list response.
This commit is contained in:
Ahmed Bouhuolia
2020-10-05 19:09:56 +02:00
parent 0114ed9f8b
commit 99e6fe273f
64 changed files with 1593 additions and 1103 deletions

View File

@@ -8,6 +8,7 @@ import {
} from 'lib/ViewRolesBuilder';
import { flatToNestedArray } from 'utils';
import DependencyGraph from 'lib/DependencyGraph';
import TenantManagerSubscriber from 'subscribers/tenantManager';
export default class Account extends TenantModel {
/**
@@ -24,6 +25,13 @@ export default class Account extends TenantModel {
return ['createdAt', 'updatedAt'];
}
/**
*
*/
static get resourceable() {
return true;
}
/**
* Model modifiers.
*/
@@ -106,4 +114,55 @@ export default class Account extends TenantModel {
accounts, { itemId: 'id', parentItemId: 'parentAccountId' }
);
}
/**
* Model defined fields.
*/
static get fields() {
return {
name: {
label: 'Name',
column: 'name',
},
type: {
label: 'Account type',
column: 'account_type_id',
relation: 'account_types.id',
relationColumn: 'account_types.key',
},
description: {
label: 'Description',
column: 'description',
},
code: {
label: 'Account code',
column: 'code',
},
root_type: {
label: 'Type',
column: 'account_type_id',
relation: 'account_types.id',
relationColumn: 'account_types.root_type',
},
created_at: {
column: 'created_at',
columnType: 'date',
},
active: {
column: 'active',
},
balance: {
column: 'amount',
columnType: 'number'
},
currency: {
column: 'currency_code',
},
normal: {
column: 'account_type_id',
relation: 'account_types.id',
relationColumn: 'account_types.normal'
},
};
}
}