-
-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #339 from bigcapitalhq/big-122-bug-expense-details…
…-amount-should-not-be-rounded fix: Expense amounts should not be rounded
- Loading branch information
Showing
5 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/server/src/services/Expenses/CRUD/ExpenseCategoryTransformer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Transformer } from '@/lib/Transformer/Transformer'; | ||
import { ExpenseCategory } from '@/models'; | ||
import { formatNumber } from '@/utils'; | ||
|
||
export class ExpenseCategoryTransformer extends Transformer { | ||
/** | ||
* Include these attributes to expense object. | ||
* @returns {Array} | ||
*/ | ||
public includeAttributes = (): string[] => { | ||
return ['amountFormatted']; | ||
}; | ||
|
||
/** | ||
* Retrieves the formatted amount. | ||
* @param {ExpenseCategory} category | ||
* @returns {string} | ||
*/ | ||
protected amountFormatted(category: ExpenseCategory) { | ||
return formatNumber(category.amount, { | ||
currencyCode: this.context.currencyCode, | ||
money: false, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters