read(user) {
      return new Promise((resolve, reject) => this.database.all(this.queries.read, user)
         .then((result, error) => {
            if (error) throw new Error(error);
            resolve(result.map(row => row.search_query));
         })
         .catch((error) => {
            console.log('Error when fetching history from database:', error)
            reject('Unable to get history.');
         }));
   }
/**
   * Retrive a search queries for a user from the database.
   * @param {User} user existing user
   * @returns {Promise}
   */
Retrive a search queries for a user from the database.
@param {User} user existing user
@returns {Promise}
Retrive a search queries for a user from the database . @param { User } user existing user @returns { Promise }
read(user) {
      return new Promise((resolve, reject) => this.database.all(this.queries.read, user)
         .then((result, error) => {
            if (error) throw new Error(error);
            resolve(result.map(row => row.search_query));
         })
         .catch((error) => {
            console.log('Error when fetching history from database:', error)
            reject('Unable to get history.');
         }));
   }
read ( user ) { return new Promise ( ( resolve , reject ) => this . database . all ( this . queries . read , user ) . then ( ( result , error ) => { if ( error ) throw new Error ( error ) ; resolve ( result . map ( row => row . search_query ) ) ; } ) . catch ( ( error ) => { console . log ( 'Error when fetching history from database:' , error ) reject ( 'Unable to get history.' ) ; } ) ) ; }
Retrive a search queries for a user from the database.
Retrive a search queries for a user from the database .