Chagned from using user.username, to just the variable user.
This commit is contained in:
@@ -16,7 +16,7 @@ class SearchHistory {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
read(user) {
|
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));
|
.then(rows => rows.map(row => row.search_query));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ class SearchHistory {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
create(user, searchQuery) {
|
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')) {
|
if (error.message.includes('FOREIGN')) {
|
||||||
throw new Error('Could not create search history.');
|
throw new Error('Could not create search history.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user