From 18092789346a0f7e7c7a84a237935ea6b28a8137 Mon Sep 17 00:00:00 2001 From: David Todd Date: Sat, 18 Jan 2020 21:47:57 -0600 Subject: [PATCH] Add bookmark deletion --- api/api.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/api.py b/api/api.py index 1f5cefd..03f48f1 100644 --- a/api/api.py +++ b/api/api.py @@ -83,7 +83,7 @@ class API: 'uri': bookmark[1], 'title': bookmark[2], 'date_created': self.format_date(bookmark[3], self.dt_fmt), - 'date_updated': self.format_date(bookmark[4], self.dt_fmt) if bookmark[4] != None else '' + 'date_updated': self.format_date(bookmark[4], self.dt_fmt) if bookmark[4] != None else '', } for bookmark in bookmarks ] @@ -91,5 +91,13 @@ class API: def delete_bookmark(self, bookmark_id): """ + Deletes the bookmark that is associated with `bookmark_id` + + Returns a JSON object containing the bookmark's UUID, + and the status as to whether or not it was successfully deleted """ response.content_type = self.response_type + return json.dumps({ + 'uuid': bookmark_id, + 'bookmark_deleted': self.database.delete_bookmark(UUID(bookmark_id)), + })