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:
postOid: (use string or a zodOidType - the string length is fixed to 24 characters)
The API should do the following:
Fetch the db to get the corresponding post document using the _id
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)
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
[ ] The post should be deleted from the DB upon calling this API
[ ] All associated data with an ID should be deleted (photos, videos, post details, etc.)
[ ] A clear error message will be interpretable if the delete fails for whatever reason
EM
[ ] Errors thrown where necessary
[ ] Use bulk-deletion if possible
[ ] Integration tests (actually hitting the storage bucket) written
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:
getDirectUploadUrl
for ideas on how to properly do this)Write an integration test to test your implementation of this API endpoint.
Acceptance Criteria
PM
EM