Album covers added
This commit is contained in:
@@ -114,6 +114,11 @@ async def photo_delete(id: str, current_user: User = Security(get_current_active
|
||||
except InvalidId:
|
||||
return HTTPException(status_code=HTTP_404_NOT_FOUND, detail="Could not find an image with such id.")
|
||||
|
||||
album = col_albums.find_one( {"name": image["album"]} )
|
||||
|
||||
if album is not None and album["cover"] == image["_id"].__str__():
|
||||
col_albums.update_one( {"name": image["album"]}, {"$set": {"cover": None}} )
|
||||
|
||||
remove(path.join("data", "users", current_user.user, "albums", image["album"], image["filename"]))
|
||||
|
||||
return Response(status_code=HTTP_204_NO_CONTENT)
|
||||
|
Reference in New Issue
Block a user