Audriusa83
Programmer
Hi,
I have an application where some events trigger email notification to some users. At the moment, the User object contains information of what kind of events he would like to receive. When someone triggers the event (from UI) then the controller action iterates trough all users and sends emails depending on user settings. In all cases the event is a change in my domain model, i.e. object state change or object is created. I think it is something similar to the forum application where user is able to select which thread notifications to receive.
I don't like my current solution because the user must contain separate fields for different types of events. It is not flexible and new type of event would cause in user object change. As well the controller makes a decision who gets a notification and who doesn't. I don't like this approach, it doesn't look right.
What would be the best pattern in this situation? How forum notifications work?
I have an application where some events trigger email notification to some users. At the moment, the User object contains information of what kind of events he would like to receive. When someone triggers the event (from UI) then the controller action iterates trough all users and sends emails depending on user settings. In all cases the event is a change in my domain model, i.e. object state change or object is created. I think it is something similar to the forum application where user is able to select which thread notifications to receive.
I don't like my current solution because the user must contain separate fields for different types of events. It is not flexible and new type of event would cause in user object change. As well the controller makes a decision who gets a notification and who doesn't. I don't like this approach, it doesn't look right.
What would be the best pattern in this situation? How forum notifications work?