Skip to content

feat: Untangle some logic#196

Open
commonpike wants to merge 10 commits intodevelopfrom
feature/untangle
Open

feat: Untangle some logic#196
commonpike wants to merge 10 commits intodevelopfrom
feature/untangle

Conversation

@commonpike
Copy link
Copy Markdown
Owner

@commonpike commonpike commented May 3, 2026

In general, move the responsibility of post actions to the post model, so the Platform models become simpler.
The post is not a simple child of a platform, it is a join of a platform and a source. Also, models should not have static methods.

  • Most importantly, create a PostFactory.resolve(platform,source) instead of static Post.getPost and Platform.getPost or Source.getPost mess. A post does not belong to a platform or a source, but to both
  • add a user property to post, because it is neither this.platform.user nor this.source.feed.user
  • removing all other static methods from models into their container; because a model is a model
  • Move Platform.super.preparePost to post.prepare(); because it didnt add much value and was confusing
  • Move plugin.process to Post.prepare - now Platform.preparePost can be empty if all is handled by plugins

Comment thread src/models/Platform.ts Outdated
Comment thread src/models/Post.ts Outdated
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

Successfully merging this pull request may close these issues.

1 participant