Api request #84

Merged
KevinMidboe merged 39 commits from api_request into master 2018-03-19 14:46:19 +00:00
Showing only changes of commit aa0094762b - Show all commits

View File

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