UNPKG

@speakr/speakr-module-services

Version:
23 lines (21 loc) 649 B
"use strict"; const db = require('../../db'); module.exports = { newEngagement: newEngagement }; function newEngagement(options) { const body = options.req.body; return db.reports_engagements.create(body) .then(engagement => { if(!engagement) throw new Error('Error Creating Engagement'); options.engagement = engagement; return options }) .catch(err => { return Promise.reject({ code: 400, message: 'Could not create engagement', purpose: err.message }) }) }