Skip to content

Fix1#89

Open
divyansh-v15-06 wants to merge 8 commits into
ayush00git:mainfrom
divyansh-v15-06:fix1
Open

Fix1#89
divyansh-v15-06 wants to merge 8 commits into
ayush00git:mainfrom
divyansh-v15-06:fix1

Conversation

@divyansh-v15-06

Copy link
Copy Markdown
Collaborator

Description
This PR resolves Issue #41 by implementing the missing API endpoints for editing, deleting, and fetching admin comments. As requested, these endpoints exclusively handle the comment logic and do not interact with or change the status of the posts.

Changes Included:
Added AdminEditComment Handler (PATCH):
Endpoint: PATCH /api/admin/comment/:type/:id/:comment_id
Allows admins to update the text content of their own comments.
Includes authorization checks to verify that the logged-in admin is the author of the comment (matched via email).
Added AdminDeleteComment Handler (DELETE):
Endpoint: DELETE /api/admin/comment/:type/:id/:comment_id
Allows admins to delete their own comments.
Includes the same authorization checks to prevent admins from deleting comments authored by others.
Added AdminGetComments Handler (GET):
Endpoint: GET /api/admin/comments
Fetches all comments authored by the currently logged-in admin across all posts. This resolves the AdminGetComments TODO left in the code.
Routing Updates: Successfully wired up the PATCH, DELETE, and GET endpoints in routes/admin.go and verified they are protected by the IsAuthenticated middleware.
Testing:
Passed the entire existing backend test suite (go test -v ./test/...).
Verified that comment ownership logic correctly restricts access to PATCH and DELETE actions.

@ayush00git

Copy link
Copy Markdown
Owner

@divyansh-v15-06 remove docs/ dir for now, api naming refactoring is planned so these docs would not make sense after that. And also update these apis in the frontend app/ dir.

@divyansh-v15-06

Copy link
Copy Markdown
Collaborator Author

done

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.

2 participants