Skip to content

[FEAT] Comment - Edit comment endpoint #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
6 tasks
Pius-aaron04 opened this issue Jul 18, 2024 · 1 comment
Open
6 tasks

[FEAT] Comment - Edit comment endpoint #45

Pius-aaron04 opened this issue Jul 18, 2024 · 1 comment
Labels

Comments

@Pius-aaron04
Copy link

Description

This API endpoint allows an authorized user to edit a comment. This endpoint will validate input data and update the comment securely in the database.

Acceptance Criteria

  • The endpoint allows a user to update a comment it created.
  • The endpoint must be accessible via /api/v1/comments/edit/{comment_id}
  • The endpoint should accept HTTP PUT request
  • The endpoint should ensure that the comment content field necessarily provided
  • On successful validation of input data, the comment data should be updated.
  • Returns 200 OK status code on success

Request Body application/json

{
    "content": "string"
}

Success load

{
    "message": "Comment successful updated",
    "data": {
        "id": "string",
        "content": "string",
        "update_at": "datetime"
    }
}

Error load

{
    "message": "Unauthorized request",
    "status_code": 401
}

Purpose

The purpose of the endpoint is to give authorized users the ability to edit/update their comments.

Requirements

  • Implement backend logic to handle comment edit submission
  • Validate and sanitize input data
  • Update comment data securely in the database
  • Return appropriate response on success or failure

Expected Outcome

The endpoint should allow users to edit their comments successfully

Test

  • Write unit tests to ensure the comment edit endpoint validates input correctly and updates the post securely.
  • Perform a security test to ensure an unauthorized user can not update a comment.
@Pius-aaron04
Copy link
Author

This links to the issue approved here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants