From aa0094762b8fa02df081cd67c7aab6891362a55e Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 6 Mar 2018 19:27:18 +0100 Subject: [PATCH] Now save only the username of the user in search history. --- seasoned_api/src/searchHistory/searchHistory.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seasoned_api/src/searchHistory/searchHistory.js b/seasoned_api/src/searchHistory/searchHistory.js index c51590e..2be86e7 100644 --- a/seasoned_api/src/searchHistory/searchHistory.js +++ b/seasoned_api/src/searchHistory/searchHistory.js @@ -15,7 +15,7 @@ class SearchHistory { * @returns {Promise} */ read(user) { - return this.database.all(this.queries.read, user) + return this.database.all(this.queries.read, user.username) .then(rows => rows.map(row => row.search_query)); } @@ -26,7 +26,7 @@ class SearchHistory { * @returns {Promise} */ create(user, searchQuery) { - return this.database.run(this.queries.create, [searchQuery, user]) + return this.database.run(this.queries.create, [searchQuery, user.username]) .catch((error) => { if (error.message.includes('FOREIGN')) { throw new Error('Could not create search history.');