import { getJob, listJobs } from '../models/jobModel.js';

export function index(req, res) {
  res.json(listJobs(req.user.id, req.user.role === 'admin'));
}

export function show(req, res) {
  const job = getJob(req.params.id, req.user.id, req.user.role === 'admin');
  if (!job) return res.status(404).json({ error: 'Job not found' });
  res.json(job);
}
