I'm working on a project which utilizes DDD, Hexagonal Architecture and Microservices.
While working on StorageService, the implementation was quite easy since the features were:
- CRUD of media files
- automated backups
There was just one aggregate root, and nothing fancy about it.
.. but now, I'm digging into ContentService which contains: Articles, Posts, Comments, Categories, Tags and Users (fetched and cached from AuthService) - and I'm having a hard time NOT sticking all the functionality into User (aggregate root).
I mean, all of the methods I will possibly implement will have to check whether the person calling for creation of article, deletion of tag, update of post or whatever has the neccessary permissions.
Is it a "proper" thing to have it all packed into User, just because he's the "executor" of functionality? All of the methods, like:
- user.postComment(article, post, content)
- user.submitArticle(string title, string content)
- user.setArticleTag(article, tag)
- user.deletePost(post)
- ... you get the idea