{"size": 615, "ext": "js", "max_stars_repo_path": "server/utilities/getMeal.js", "max_stars_repo_name": "adex001/Fast-Food-Fast", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/utilities/getMeal.js", "max_issues_repo_name": "adex001/Fast-Food-Fast", "max_issues_repo_issues_event_min_datetime": "2018-09-15T23:35:16.000Z", "max_issues_repo_issues_event_max_datetime": "2018-09-28T03:43:19.000Z", "max_forks_repo_path": "server/utilities/getMeal.js", "max_forks_repo_name": "adex001/Fast-Food-Fast", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 8, "max_forks_count": null, "avg_line_length": 26.7391304348, "max_line_length": 66, "alphanum_fraction": 0.5902439024}
import pool from '../database/connectdatabase';

/**
 * Get Meal function retrieves a single meal from the menu
 * @param {string} mealid - The menu array
 */
const getMeal = (mealid) => {
  return new Promise((resolve) => {
    const query = `SELECT * FROM menu WHERE mealid = '${mealid}'`;
    pool.query(query, (err, result) => {
      if (result.rowCount > 0) {
        const obj = {
          mealName: result.rows[0].mealname,
          mealImageUrl: result.rows[0].mealimageurl,
          mealPrice: result.rows[0].mealprice,
        };
        resolve(obj);
      }
    });
  });
};
export default getMeal;
