Fix order by (#2646)
* Order by createdAt desc if no sort provided * Fix '0' currency amounts * Code review returns
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import { isUndefined } from '@sniptt/guards';
|
||||
|
||||
export const convertCurrencyToCurrencyMicros = (
|
||||
currencyAmount: number | undefined,
|
||||
) => {
|
||||
@ -18,13 +20,12 @@ export const convertCurrencyToCurrencyMicros = (
|
||||
export const convertCurrencyMicrosToCurrency = (
|
||||
currencyAmountMicros: number | undefined,
|
||||
) => {
|
||||
if (!currencyAmountMicros) {
|
||||
if (isUndefined(currencyAmountMicros)) {
|
||||
return undefined;
|
||||
}
|
||||
const currencyAmountMicrosAsNumber = +currencyAmountMicros;
|
||||
if (isNaN(currencyAmountMicrosAsNumber)) {
|
||||
throw new Error(`Cannot convert ${currencyAmountMicros} to currency`);
|
||||
}
|
||||
const currencyAmount = currencyAmountMicrosAsNumber / 1000000;
|
||||
return currencyAmount;
|
||||
return currencyAmountMicrosAsNumber / 1000000;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user