I am a DDD amateur, and I'm not sure I phrased the question correctly, or whether this even concerns DDD, but here is what has been bugging me about trying to implement DDD in my project.
Let's say my system is a sales order management system, where user can input sales orders with multiple lines for each order. Now the line amount can be in the base currency (of our client) or in a foreign currency, in which case it needs to be converted to the base currency by multiplying with a pre-determined exchange rate varying from month to month.
I think this amount conversion is a business rule and therefore should be in the domain layer. However I also want my user to be able to enter the amount in foreign currency and then have the amount in base currency automatically calculated and filled out in the form without the need to explicitly submit any data. This looks like it needs to be carried out on the frontend, and therefore violates the "no business rule in the frontend" rule.
How would you go about implementing this?
question from:
https://stackoverflow.com/questions/65898705/how-to-avoid-business-logic-in-frontend-while-keeping-frontend-interactive 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…