UNPKG

@speakr/speakr-module-services

Version:
24 lines (22 loc) 633 B
"use strict"; const db = require('../../db'); module.exports = { byId: byId }; function byId(options) { const id = options.req.params.id; const where = { id }; return db.reports_impressions.destroy({ where }) .then(impression => { if(!impression) throw new Error(`Err deleting/already deleted impression ID :: ${id}`) options.impression = impression; return options; }) .catch(err => Promise.reject({ code: 409, message: 'Could not delete Impression', purpose: err.message })) }