commit 2 refactor

This commit is contained in:
Boki 2026-10-20 14:35:45 -04:00
parent 588f666943
commit 32e43c9243
310 changed files with 33318 additions and 31189 deletions

View file

@ -1,4 +1,4 @@
import { CreateExchangeRequest, CreateProviderMappingRequest } from '../types/exchange.types';
import type { CreateExchangeRequest, CreateProviderMappingRequest } from '../types/exchange.types';
export class ValidationError extends Error {
constructor(
@ -85,14 +85,15 @@ export function validateCreateProviderMapping(data: unknown): CreateProviderMapp
}
// Validate currency is 3 characters or null
const cleanCurrency = currency && currency.length <= 3 ? currency : null;
const cleanCurrency = typeof currency === 'string' && currency.length <= 3 ? currency : undefined;
return {
provider: provider.trim(),
provider_exchange_code: provider_exchange_code.trim(),
provider_exchange_name: provider_exchange_name?.trim(),
provider_exchange_name:
typeof provider_exchange_name === 'string' ? provider_exchange_name.trim() : undefined,
master_exchange_id: master_exchange_id.trim(),
country_code: country_code?.trim() || null,
country_code: typeof country_code === 'string' ? country_code.trim() || undefined : undefined,
currency: cleanCurrency,
confidence: Number(confidence),
active: Boolean(active),