Browse Source

fix updateContact

push-params
Evan Feenstra 5 years ago
parent
commit
ce273842c5
  1. 3
      api/controllers/contacts.ts
  2. 3
      dist/api/controllers/contacts.js
  3. 2
      dist/api/controllers/contacts.js.map

3
api/controllers/contacts.ts

@ -81,6 +81,9 @@ export const updateContact = async (req, res) => {
let attrs = extractAttrs(req.body)
const contact = await models.Contact.findOne({ where: { id: req.params.id }})
if(!contact) {
return failure(res, 'no contact found')
}
// update self
const owner = await contact.update(jsonUtils.jsonToContact(attrs))

3
dist/api/controllers/contacts.js

@ -78,6 +78,9 @@ exports.updateContact = (req, res) => __awaiter(void 0, void 0, void 0, function
console.log('=> updateContact called', { body: req.body, params: req.params, query: req.query });
let attrs = extractAttrs(req.body);
const contact = yield models_1.models.Contact.findOne({ where: { id: req.params.id } });
if (!contact) {
return res_1.failure(res, 'no contact found');
}
// update self
const owner = yield contact.update(jsonUtils.jsonToContact(attrs));
res_1.success(res, jsonUtils.contactToJson(owner));

2
dist/api/controllers/contacts.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save