shotvibe / shotvibe-web

ShotVibe REST API webservice
1 stars 0 forks source link

Add new endpoint for users to delete photos from an album #50

Closed benny-shotvibe closed 10 years ago

benny-shotvibe commented 10 years ago

This should support deleting multiple photos in a single batch.

I think for the input it is enough to take a list of photo_ids.

So probably something like:

POST /photos/delete/

[
    { "photo_id": "f3j8jf8jse8fj8j...38fj38afsf" },
    { "photo_id": "skjgje2ij8j48gj...284j23wgje" }
]

Permissions: Only the user who uploaded the photo can delete the photo. In the future we may extend this so that the album creator can also delete any photo.

Can return an empty response body on success

prudnikov commented 10 years ago

1) What if user requests to delete 2 photos and one of them was not uploaded by him? Should I delete just one or fail whole request? If delete just one what should I return in response? 2) There is no information about the album. I'd suggest DELETE /albums/{album_id}/photos/ with request body from your example. 3) Adding the endpoint /albums/{album_id}/photos/ makes sense because we can also use it to add photos to the album later. There is an issue #52 which is related to this one I think. Currently you can add members and photos using /albums/{album_id}/ endpoint. #52 will extract adding members to /albums/{album_id}/members/, it makes sense to extract adding photos to /albums/{album_id}/photos/ as well, which will be the same endpoint that could be added in this task to delete photos from album.

benny-shotvibe commented 10 years ago

1) If the photo was not uploaded by the user, or the photoId does not exist then ignore this photo

The other 2 points you mention make sense, but let's leave this at POST /photos/delete/ for now, since it will make it simpler for the app code. Later on we can revisit this decision, but we need a simple way to delete urgently

prudnikov commented 10 years ago

There is no album #ID..

prudnikov commented 10 years ago

"let's leave this at POST /photos/delete/ for now, since it will make it simpler for the app code." — do you mean simpler code in Android and iOS app? The difference is POST vs DELETE requests which is just different constant in the code.

benny-shotvibe commented 10 years ago

It should be POST. The album_id isn't needed, the server can figure it out on its own.

prudnikov commented 10 years ago

Does this mean that I should remove photo from the system or just set Photo.album = None? Should I modify shema? Currently Photo.album is not allowed to be None.

Also, according to schema it seems like

benny-shotvibe commented 10 years ago

Those are all good points, but we will have to take care of them later. For now please just completely delete the row fron the database. So no need for a schema change