feat: apply new cards design system.

feat: empty status datatables.
fix: edit account.
This commit is contained in:
Ahmed Bouhuolia
2020-11-18 21:55:17 +02:00
parent 0b386a7cb2
commit 128feb73f8
64 changed files with 869 additions and 688 deletions

View File

@@ -198,7 +198,11 @@ export default class AccountsController extends BaseController{
try {
const account = await this.accountsService.editAccount(tenantId, accountId, accountDTO);
return res.status(200).send({ id: account.id });
return res.status(200).send({
id: account.id,
message: 'The account has been edited successfully',
});
} catch (error) {
next(error);
}

View File

@@ -107,10 +107,12 @@ export default class AccountRepository extends TenantRepository {
* @param {IAccount} account
* @return {void}
*/
async edit(accountId: number, account: IAccount): Promise<void> {
async edit(accountId: number, accountInput: IAccount): Promise<void> {
const { Account } = this.models;
await Account.query().findById(accountId).patch({ ...account });
const account = await Account.query().patchAndFetchById(accountId, { ...accountInput });
this.flushCache();
return account;
}
/**

View File

@@ -203,6 +203,8 @@ export default class AccountsService {
* @param {IAccountDTO} accountDTO
*/
public async editAccount(tenantId: number, accountId: number, accountDTO: IAccountDTO) {
this.logger.info('[account] trying to edit account.', { tenantId, accountId });
const { accountRepository } = this.tenancy.repositories(tenantId);
const oldAccount = await this.getAccountOrThrowError(tenantId, accountId);

View File

@@ -407,6 +407,7 @@ export default class ManualJournalsService implements IManualJournalsService {
this.logger.info('[manual_journals] trying to get manual journals list.', { tenantId, filter });
const { results, pagination } = await ManualJournal.query().onBuild((builder) => {
dynamicList.buildQuery()(builder);
builder.withGraphFetched('entries.account');
}).pagination(filter.page - 1, filter.pageSize);
return {