Closed novofeels closed 5 months ago
33 and 34
update_post and delete_post function added to post.py, functions exported as package and called in do_PUT and do_DELETE respectively
first make sure you have a post object in your database with an id of 1.
test update_post by making a PUT request using postman to address http://localhost:8088/posts/1 ,
and in the body
{ "user_id": 1, "category_id": 2, "title": "awwwwwww shit its a test", "publication_date": "2024-05-29", "image_url": "http://example.com/image.jpg", "content": "Updated content of the post.", "approved": 1 }
check to see the title changed
to test delete make a DELETE request using postman to
http://localhost:8088/posts/1
make sure the the post with an id of 1 has been deleted
Ticket:
33 and 34
What Changed:
update_post and delete_post function added to post.py, functions exported as package and called in do_PUT and do_DELETE respectively
Testing Steps:
first make sure you have a post object in your database with an id of 1.
test update_post by making a PUT request using postman to address http://localhost:8088/posts/1 ,
and in the body
{ "user_id": 1, "category_id": 2, "title": "awwwwwww shit its a test", "publication_date": "2024-05-29", "image_url": "http://example.com/image.jpg", "content": "Updated content of the post.", "approved": 1 }
check to see the title changed
to test delete make a DELETE request using postman to
http://localhost:8088/posts/1
make sure the the post with an id of 1 has been deleted