boolean-uk / team-dev-server-ex-2410-team3

0 stars 0 forks source link

Create PUT for post #42

Closed LudwigJL closed 1 month ago

LudwigJL commented 1 month ago

When editing a post the changes are not saved to the database.

We need to create a PUT request for post going trough the post domain that saves the edited one in the database. Further, the endpoint for updating a post will be /posts/{id} and sending a PUT request to this endpoint. The data in the request body which will be send from frontend to backend will look accordingly:

{
    "content": "New content"
}

The response will look like:

{
    "id": 1,
    "content": "New content",
    "createdAt": "2024-10-30T13:43:38.440Z",
    "updatedAt": "2024-10-30T13:45:38.440Z", // Will be changed according to when it was updated
    "author": {
      "id": 1,
      "cohortId": 0,
      "role": "string",
      "firstName": "string",
      "lastName": "string",
      "bio": "string",
      "githubUrl": "string",
      "profileImageUrl": "string"
    }
}
amos1969 commented 1 month ago

Approved