feat(server): categorize the synced bank transactions

This commit is contained in:
Ahmed Bouhuolia
2024-03-01 17:12:56 +02:00
parent ea8c5458ff
commit 5b4ddadcf6
6 changed files with 82 additions and 14 deletions

View File

@@ -22,23 +22,42 @@ export default class UncategorizedCashflowTransaction extends TenantModel {
* Retrieves the withdrawal amount.
* @returns {number}
*/
public withdrawal() {
return this.amount > 0 ? Math.abs(this.amount) : 0;
public get withdrawal() {
return this.amount < 0 ? Math.abs(this.amount) : 0;
}
/**
* Retrieves the deposit amount.
* @returns {number}
*/
public deposit() {
return this.amount < 0 ? Math.abs(this.amount) : 0;
public get deposit(): number {
return this.amount > 0 ? Math.abs(this.amount) : 0;
}
/**
* Detarmines whether the transaction is deposit transaction.
*/
public get isDepositTransaction(): boolean {
return 0 < this.deposit;
}
/**
* Detarmines whether the transaction is withdrawal transaction.
*/
public get isWithdrawalTransaction(): boolean {
return 0 < this.withdrawal;
}
/**
* Virtual attributes.
*/
static get virtualAttributes() {
return ['withdrawal', 'deposit'];
return [
'withdrawal',
'deposit',
'isDepositTransaction',
'isWithdrawalTransaction',
];
}
/**