Skip to content

SERVER: Dashboard - Student view - Comment on post #29

@Kerem-1034003

Description

@Kerem-1034003

Problem Description

As a user that is logged in, I want to add comments to posts and view existing comments,
so that I can discuss with other users posts.

Required Changes

  • Implement POST endpoint to create comment /posts/{id}/comments
  • Validate that the comment content is not empty.
  • Store the comment in the database with: user_id (author), post_id, content
  • Implement GET endpoint to retrieve all comments for a post /posts/{id}/comments
  • Return all comments linked to the post.
  • Each comment should include: Author’s first name and last name (from profile), Comment content

Acceptance Criteria

Succes response:
201 with the newly created comment object. (POST)
200 with an array of all comments for the post. (GET)

Error response:

  • 400 if comment content is empty.
  • 404 if post does not exist.

Dependencies

  • Database table comments must exist (Database migration issue).
  • Verify the logged-in user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions