mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
add server to monorepo.
This commit is contained in:
34
packages/server/src/services/Cashflow/utils.ts
Normal file
34
packages/server/src/services/Cashflow/utils.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { upperFirst, camelCase } from 'lodash';
|
||||
import {
|
||||
CASHFLOW_TRANSACTION_TYPE,
|
||||
CASHFLOW_TRANSACTION_TYPE_META,
|
||||
ICashflowTransactionTypeMeta,
|
||||
} from './constants';
|
||||
|
||||
/**
|
||||
* Ensures the given transaction type to transformed to properiate format.
|
||||
* @param {string} type
|
||||
* @returns {string}
|
||||
*/
|
||||
export const transformCashflowTransactionType = (type) => {
|
||||
return upperFirst(camelCase(type));
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve the cashflow transaction type meta.
|
||||
* @param {CASHFLOW_TRANSACTION_TYPE} transactionType
|
||||
* @returns {ICashflowTransactionTypeMeta}
|
||||
*/
|
||||
export function getCashflowTransactionType(
|
||||
transactionType: CASHFLOW_TRANSACTION_TYPE
|
||||
): ICashflowTransactionTypeMeta {
|
||||
return CASHFLOW_TRANSACTION_TYPE_META[transactionType];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve cashflow accounts transactions types
|
||||
* @returns {string}
|
||||
*/
|
||||
export const getCashflowAccountTransactionsTypes = () => {
|
||||
return Object.values(CASHFLOW_TRANSACTION_TYPE_META).map((meta) => meta.type);
|
||||
};
|
||||
Reference in New Issue
Block a user