create(username, searchQuery) {
      return this.database.run(this.queries.create, [searchQuery, username])
         .catch(error => {
            if (error.message.includes('FOREIGN')) {
               throw new Error('Could not create search history.');
            }

            throw {
               success: false,
               status: 500,
               message: 'An unexpected error occured',
               source: 'database'
            }
         });
   }
/**
   * Creates a new search entry in the database.
   * @param {String} username logged in user doing the search
   * @param {String} searchQuery the query the user searched for
   * @returns {Promise}
   */
Creates a new search entry in the database.
@param {String} username logged in user doing the search
@param {String} searchQuery the query the user searched for
@returns {Promise}
Creates a new search entry in the database . @param { String } username logged in user doing the search @param { String } searchQuery the query the user searched for @returns { Promise }
create(username, searchQuery) {
      return this.database.run(this.queries.create, [searchQuery, username])
         .catch(error => {
            if (error.message.includes('FOREIGN')) {
               throw new Error('Could not create search history.');
            }
            throw {
               success: false,
               status: 500,
               message: 'An unexpected error occured',
               source: 'database'
            }
         });
   }
create ( username , searchQuery ) { return this . database . run ( this . queries . create , [ searchQuery , username ] ) . catch ( error => { if ( error . message . includes ( 'FOREIGN' ) ) { throw new Error ( 'Could not create search history.' ) ; } throw { success : false , status : 500 , message : 'An unexpected error occured' , source : 'database' } } ) ; }
Creates a new search entry in the database.
Creates a new search entry in the database .