GTBitsOfGood / angels-among-us

Rescue one until there are none
https://staging--angels-among-us.netlify.app
MIT License
4 stars 0 forks source link

[Post view] [BE] Post deletion API route #91

Closed katsukixyz closed 1 year ago

katsukixyz commented 1 year ago

Context

We want to allow admins to delete posts. This can happen if the animal has found a permanent home, in which case the admins would like to clean up the feed by deleting posts they no longer want to keep on the platform.

Requirements

Build an API endpoint at post.delete that takes in an input of:

The API should do the following:

  1. Fetch the db to get the corresponding post document using the _id
  2. Use the attachments array to make a storage bucket call to delete the attachments associated with the post from our storage bucket (use the S3 API - you can try looking at getDirectUploadUrl for ideas on how to properly do this)
  3. If the deletion was successful, then delete the post document using the _id (writing the corresponding database action might be necessary)

Write an integration test to test your implementation of this API endpoint.

Acceptance Criteria

PM

EM