-
Couldn't load subscription status.
- Fork 19
Description
Description:
Currently, PostController handles both public post display (listing, single post) and authenticated post management (my posts, create, amend, delete). This mixes responsibilities and can be cleaner.
Proposed Refactor:
1. Controllers:
-
PostController→ handles public-facing post display only:posts()– paginated list of postspost()– single post view
-
PostManagementController→ handles authenticated management only:myPosts()createFrom(),create()amendForm(),amend()delete(),deleteImage()
2. Service:
Keep a single PostService class to handle all post operations, both read and write.
Methods can stay logically grouped as read vs write internally.
3. Routes:
Public routes remain in PostController.
Authenticated routes are moved to PostManagementController with proper middlewares (Editor, Owner).