Social Media Domain Model Analysis
π¨ Missing Relationships (Immediate Issues)
Object
Issue
Fix
rm-post-details
No respondsToQueryIds
Needs a GetPostDetails query
cmd-flag-content
No emitsEventIds
Should emit ContentFlagged
cmd-send-push
No emitsEventIds
Should emit PushNotificationSent
evt-toxic-content-detected
No aggregateId
Should belong to agg-post or new aggregate
Actor
Rationale
Guest
Views public content but cannot interact (different permissions than User)
ContentOwner
Could be distinct from User for content lifecycle control (delete own posts vs admin delete)
Note: If User already covers content ownership, no new actor neededβjust more explicit commands.
β‘ Missing Commands (Write Side)
Command
Target
Events
Rationale
DeletePost
agg-post
PostDeleted
Users delete their own posts
EditPost
agg-post
PostEdited
Users edit their own posts
DeleteComment
agg-comment
CommentDeleted
Users delete their own comments
UnlikePost
agg-post
PostUnliked
Undo like action
ReportContent
agg-post
ContentReported
User-initiated (vs system FlagContent)
Moderator Commands (act-moderator)
Command
Target
Events
Rationale
RemoveContent
agg-post
ContentRemoved
After review, remove flagged content
ApproveContent
agg-post
ContentApproved
After review, mark as safe
BanUser
(new aggregate)
UserBanned
Temporary/permanent user ban
Event
Aggregate
Rationale
PostDeleted
agg-post
Track post lifecycle
PostEdited
agg-post
Audit trail for edits
CommentDeleted
agg-comment
Track comment lifecycle
PostUnliked
agg-post
Track engagement changes
ContentFlagged
agg-post
Missing from cmd-flag-content
ContentReported
agg-post
User reports
ContentRemoved
agg-post
Moderation action taken
ContentApproved
agg-post
Moderation action taken
Read Model
Consumers
Subscribes To
Query
ModerationQueue
act-moderator
ContentFlagged, ContentReported
GetModerationQueue
UserNotifications
act-user
CommentAdded, PostLiked, ContentRemoved
GetMyNotifications
UserProfile
act-user, act-moderator
PostPublished, PostDeleted
GetUserProfile
Query
Returns
Actors
Rationale
GetPostDetails
rm-post-details
act-user, act-moderator
Critical: ReadModel exists but no query!
GetModerationQueue
rm-moderation-queue
act-moderator
Moderators need work queue
GetMyNotifications
rm-user-notifications
act-user
Users check notifications
GetUserProfile
rm-user-profile
act-user, act-moderator
View user's posts
SearchPosts
(new)
act-user
Discovery feature
Policy
Trigger
Action
Rationale
NotifyOnContentRemoval
ContentRemoved
cmd-send-push
Notify user when their content is removed
UserReportEscalationPolicy
ContentReported
cmd-flag-content
Escalate user reports to moderation
High Priority (Broken Relationships):
Add GetPostDetails query β rm-post-details
Add emitsEventIds to cmd-flag-content and cmd-send-push
Add aggregateId to evt-toxic-content-detected
Medium Priority (Core User Flows):
Add DeletePost, EditPost, DeleteComment commands
Add ModerationQueue read model for moderators
Add RemoveContent, ApproveContent commands for moderation workflow
Lower Priority (Polish):
User notifications system
Content reporting (user-initiated)
Search functionality