File size: 822 Bytes
10821c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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); }
};