diff --git a/db/__init__.py b/api/db/__init__.py similarity index 100% rename from db/__init__.py rename to api/db/__init__.py diff --git a/db/db.py b/api/db/db.py similarity index 97% rename from db/db.py rename to api/db/db.py index 5273305..27bd771 100644 --- a/db/db.py +++ b/api/db/db.py @@ -95,13 +95,13 @@ class Database: exist in the database adding a new entry if that is the case. If the `uri` is already stored (based on the generated UUID), the existing - entry will be returned instead. + entry's UUID will be returned instead. """ uri_uuid = uuid.uuid5(uuid.NAMESPACE_URL, uri) bookmark_exists = self.get_bookmark(uri_uuid) if bookmark_exists != None: - return bookmark_exists + return bookmark_exists[0] query = """ INSERT INTO bookmarks ( @@ -125,6 +125,10 @@ class Database: query = "DELETE FROM bookmarks WHERE bookmark_id = ?" self.cursor.execute(query, (bookmark_id, )) + if self.get_bookmark(bookmark_id) == None: + return True + return False + def update_bookmark_title(self, bookmark_id, new_title): """ Takes the provided `bookmark_id`, searches the