kgrzybek / modular-monolith-with-ddd

Full Modular Monolith application with Domain-Driven Design approach.
MIT License
11.09k stars 1.74k forks source link

Check for MeetingGroupProposal status to be accepted before creating MeetingGroup #198

Open shamil-sadigov opened 3 years ago

shamil-sadigov commented 3 years ago

First of all, thank you for this masterpiece, I gained a lot of insights and knowledge from this repo!

Don't you think we should add a rule check to make sure that proposal has been accepted by the Administration module?

https://github.com/kgrzybek/modular-monolith-with-ddd/blob/37de06228f3f6f49de20a510d5349c784903b01f/src/Modules/Meetings/Domain/MeetingGroupProposals/MeetingGroupProposal.cs#L27-L30

I mean something like this

public MeetingGroup CreateMeetingGroup()
{
    CheckRule(new MeetingGroupProposalMustBeAcceptedRule(_status));
    return MeetingGroup.CreateBasedOnProposal(Id, _name, _description, _location, _proposalUserId);
}

PS: I may create a PR. But just wanted to be sure that I understand business logic correctly 😅

kgrzybek commented 3 years ago

@shamil-sadigov yes, you are right.

Even from the current implementation of the Application layer this kind of situation is not possible, it might be possible in the future so this rule should be checked.