Microservices - Migration from Monolith
A developer wrote this anti-corruption layer code snippet but it causes errors when legacy data is missing some fields:
function translateOrder(legacyOrder) {
return {
id: legacyOrder.orderId,
total: legacyOrder.amount.value,
status: legacyOrder.status.toUpperCase()
}
}
What is the main issue and how to fix it?