Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid usage of Schedule / Appointment? #77

Open
ekallaur opened this issue Aug 23, 2024 · 0 comments
Open

Invalid usage of Schedule / Appointment? #77

ekallaur opened this issue Aug 23, 2024 · 0 comments

Comments

@ekallaur
Copy link

In the FrontDesk/src/FrontDesk.Core/Handlers/EmailConfirmationHandler.cs

var appointmentToConfirm = schedule.Appointments.FirstOrDefault(a => a.Id == appointmentConfirmedEvent.AppointmentId);

appointmentToConfirm.Confirm(appointmentConfirmedEvent.DateOccurred);

This looks like manipulation of the Aggregate internals by bypassing Aggregate itself.
In this way Schedule aggregate can not guarantee data integrity.
I'm afraid that such example can lead to incorrect understanding of the Aggregate and its purpose.

Shouldn't be:

schedule.ConfirmAppointment(appointmentConfirmedEvent.AppointmentId, appointmentConfirmedEvent.DateOccurred);

OR

schedule.MarkAppointmentAsConfirmed(appointmentConfirmedEvent.AppointmentId, appointmentConfirmedEvent.DateOccurred);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant