const { fetchContacts, fetchCallList } = require('../services/apiService'); async function getContacts(req, res) { try { const data = await fetchContacts(); res.json(data); } catch (err) { res.status(500).json({ error: err.message }); } } async function getCallList(req, res) { const { caretaker_number, call_id } = req.body || {}; if (!caretaker_number && !call_id) { return res.status(400).json({ error: "Missing caretaker_number or call_id" }); } try { const data = await fetchCallList({ caretaker_number, call_id }); res.json(data); } catch (err) { res.status(500).json({ error: err.message }); } } module.exports = { getContacts, getCallList };