const inspirationService = require('../services/inspiration.service'); exports.list = async (req, res, next) => { try { res.json({ items: await inspirationService.list(req.query) }); } catch (error) { next(error); } }; exports.create = async (req, res, next) => { try { res.status(201).json({ item: await inspirationService.create(req.body, req.admin._id, req.ip) }); } catch (error) { next(error); } }; exports.update = async (req, res, next) => { try { res.json({ item: await inspirationService.update(req.params.id, req.body, req.admin._id, req.ip) }); } catch (error) { next(error); } }; exports.remove = async (req, res, next) => { try { await inspirationService.remove(req.params.id, req.admin._id, req.ip); res.json({ message: 'Inspiration item deleted.' }); } catch (error) { next(error); } };