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

async function insertCardImage(image) {
  const { image_id, card_id, image_url } = image;
  await db.execute(`
    INSERT INTO card_images (image_id, card_id, image_url)
    VALUES (?, ?, ?)
    ON DUPLICATE KEY UPDATE image_url = VALUES(image_url)
  `, [image_id, card_id, image_url]);
}

module.exports = { insertCardImage };
