Now save only the username of the user in search history.
This commit is contained in:
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user