Chagned from using user.username, to just the variable user.

This commit is contained in:
2017-10-22 17:01:58 +02:00
parent 6574c087bc
commit 8d248135e0

View File

@@ -16,7 +16,7 @@ class SearchHistory {
* @returns {Promise}
*/
read(user) {
return this.database.all(this.queries.read, user.username)
return this.database.all(this.queries.read, user)
.then(rows => rows.map(row => row.search_query));
}
@@ -27,7 +27,7 @@ class SearchHistory {
* @returns {Promise}
*/
create(user, searchQuery) {
return this.database.run(this.queries.create, [searchQuery, user.username]).catch((error) => {
return this.database.run(this.queries.create, [searchQuery, user]).catch((error) => {
if (error.message.includes('FOREIGN')) {
throw new Error('Could not create search history.');
}