UNPKG

@speakr/speakr-module-services

Version:
29 lines (23 loc) 524 B
"use strict"; const db = require('../../db'); module.exports = { byId }; function byId(options) { let where = { id: options.users.id }; return db.users.update(options.update, { where }) .then(users => { return db.users.findOne({ where }).then(users => { options.users = users; return Promise.resolve(options) }); }) .catch((err) => { return Promise.reject({ error: { code:400, message: "could not update user" } }) }); }