/**
 * baseModel
 * - Provides shared db access helpers.
 */

const { getPool } = require('../config/db');

async function query(sql, params) {
  const pool = await getPool();
  const [rows] = await pool.query(sql, params);
  return rows;
}

async function execute(sql, params) {
  const pool = await getPool();
  const [result] = await pool.query(sql, params);
  return result;
}

module.exports = { query, execute };

