mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 18:48:11 +00:00
Merge pull request #343 from Tria-plc/alpha
Currency enum runtime issue resolution
This commit is contained in:
@@ -4,14 +4,14 @@ import { Type } from 'class-transformer';
|
|||||||
import { Currency } from '@prisma/client';
|
import { Currency } from '@prisma/client';
|
||||||
|
|
||||||
// Nationality → home currency mapping (keys are uppercase for case-insensitive lookup)
|
// Nationality → home currency mapping (keys are uppercase for case-insensitive lookup)
|
||||||
export const NATIONALITY_CURRENCY_MAP: Record<string, Currency> = {
|
export const NATIONALITY_CURRENCY_MAP: Record<string, string> = {
|
||||||
ETHIOPIAN: Currency.ETB,
|
ETHIOPIAN: 'ETB',
|
||||||
DJIBOUTIAN: Currency.DJF,
|
DJIBOUTIAN: 'DJF',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function resolveCurrencyFromNationality(nationality?: string): Currency {
|
export function resolveCurrencyFromNationality(nationality?: string): Currency {
|
||||||
if (!nationality) return Currency.ETB;
|
if (!nationality) return 'ETB' as Currency;
|
||||||
return NATIONALITY_CURRENCY_MAP[nationality.toUpperCase()] ?? Currency.USD;
|
return (NATIONALITY_CURRENCY_MAP[nationality.toUpperCase()] ?? 'USD') as Currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FareCalculateDto {
|
export class FareCalculateDto {
|
||||||
|
|||||||
Reference in New Issue
Block a user