Rontim / MyCampus-backend

Backend for the MyCampus project
1 stars 0 forks source link

4 adding comment feature #8

Closed Rontim closed 6 months ago

Rontim commented 6 months ago

I chose to remove the mentions attribute from the comments' models after comparing them with a few blogging sites

Rontim commented 6 months ago

the following endpoints with thier respective request and response:

  1. POST: /api/v1/comment/

request

{
  "blog_slug": "test-blog",
  "comment": "Great Blog there"
}

Response

{
  "unique_id": "7d8f2686805547cbbac7901ee943d72d",
  "comment": "Great Blog there",
  "commentor": "gitonga",
  "blog": "test-blog",
  "created_at": "2024-03-07T20:07:59.444104Z",
  "updated_at": "2024-03-07T20:07:59.444156Z"
}
  1. POST /api/v1/comment//reply

request

{
"reply": "Thanks"
}

Response

{
"id": 1,
"unique_id": "18c96991a0854e21925d697119eadf83",
"reply": "Thanks",
"created_at": "2024-03-07T20:11:28.458031Z",
"updated_at": "2024-03-07T20:11:28.459126Z",
"comment": "7d8f2686805547cbbac7901ee943d72d",
"replier": "soni"
}
  1. GET /api/v1/comment//

No request body

Response

{
"unique_id": "7d8f2686805547cbbac7901ee943d72d",
"comment": "Great Blog there",
"commentor": "gitonga",
"replies": [
{
"reply": "Thanks",
"replier": "soni",
"created_at": "2024-03-07T20:11:28.458031Z",
"updated_at": "2024-03-07T20:11:28.459126Z"
}
],
"created_at": "2024-03-07T20:07:59.444104Z",
"updated_at": "2024-03-07T20:07:59.444156Z"
}