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.');