Can Domain Layer and Application Layer be aware of application state? By application state, I mean the state of the an individual app instance.
If I'm making an food delivery for example, and the user logs in to his account and places an order. Now I'll need to add this order under this currently logged in user.
The part where I'm confused is if the application layers service that has a function to add the ordered item to this users list of ordered items, can know which user is currently logged in, which is going to be an info of an individual app instance.
class MakeOrderService {
void makeOrder() {
// Here order is being made assuming this function can get the
// id of the currently logged in user without it being passed
// in as a parameter from the controller where its being called.
}
}
Thanks.