Domain implementation with branded types and observersFor pull request#8
Domain implementation with branded types and observersFor pull request#8sashatemereva13 wants to merge 15 commits into
Conversation
irinakiseleva0
left a comment
There was a problem hiding this comment.
Great work on the domain implementation!
The domain rules are clearly described and the use of smart constructors helps enforce validation. I also like the event-based approach which keeps the observers decoupled from the domain logic.
Overall the structure is clear and follows Domain-Driven Design principles well.
|
|
||
| ## Error Handling / Invalid Data | ||
| We intentionally feed wrong data (bad email, negavite price, invalid status transactions). | ||
| The app must not crash: all failures are caught with try/catch and logged. No newline at end of file |
There was a problem hiding this comment.
Nice domain description and clear explanation of the business rules.
It helps understand how the domain logic is reflected in the code.
| | { type: "ProjectDeployed"; projectId: ProjectId } | ||
| | { type: "DiscoveryCompleted"; projectId: ProjectId }; | ||
|
|
||
| type Observer = (event: ProjectEvent) => void; |
There was a problem hiding this comment.
The ProjectEvent type is clearly defined and helps keep observers
decoupled from the domain logic. Nice use of an event-based approach.
| observers: [], | ||
| }; | ||
|
|
||
| notify(project, { |
There was a problem hiding this comment.
Nice use of a domain event when creating a project.
Emitting events helps keep the domain logic decoupled from infrastructure concerns.
This pull request implements the domain layer using Domain-Driven Design principles.
Key features implemented:
Business rule enforced: