const db = require('../db/config');

exports.getAllCategories = () => {
    return db.query('SELECT * FROM categories');
};

exports.createCategory = (name) => {
    return db.query('INSERT INTO categories (name) VALUES (?)', [name]);
};
exports.updateCategory = (id, name) => {
    return db.query('UPDATE categories SET name = ? WHERE id = ?', [name, id]);
};
exports.getAllBrands = () => {
    return db.query('SELECT * FROM brands');
};

exports.createBrand = (name) => {
    return db.query('INSERT INTO brands (name) VALUES (?)', [name]);
};
exports.updateBrand = (id, name) => {
    return db.query('UPDATE brands SET name = ? WHERE id = ?', [name, id]);
  };
exports.updateUnit = (id, name) => {
    return db.query('UPDATE units SET name = ? WHERE id = ?', [name, id]);
  };
exports.updateSize = (id, name) => {
    return db.query('UPDATE sizes SET name = ? WHERE id = ?', [name, id]);
  };