|
@ -80,6 +80,9 @@ exports.updateContact = (req, res) => __awaiter(void 0, void 0, void 0, function |
|
|
if (!contact) { |
|
|
if (!contact) { |
|
|
return res_1.failure(res, 'no contact found'); |
|
|
return res_1.failure(res, 'no contact found'); |
|
|
} |
|
|
} |
|
|
|
|
|
const contactKeyChanged = attrs['contact_key'] && contact.contactKey !== attrs['contact_key']; |
|
|
|
|
|
const aliasChanged = attrs['alias'] && contact.alias !== attrs['alias']; |
|
|
|
|
|
const photoChanged = attrs['photo_url'] && contact.photoUrl !== attrs['photo_url']; |
|
|
// update contact
|
|
|
// update contact
|
|
|
const owner = yield contact.update(jsonUtils.jsonToContact(attrs)); |
|
|
const owner = yield contact.update(jsonUtils.jsonToContact(attrs)); |
|
|
res_1.success(res, jsonUtils.contactToJson(owner)); |
|
|
res_1.success(res, jsonUtils.contactToJson(owner)); |
|
@ -88,10 +91,6 @@ exports.updateContact = (req, res) => __awaiter(void 0, void 0, void 0, function |
|
|
if (!(attrs['contact_key'] || attrs['alias'] || attrs['photo_url'])) { |
|
|
if (!(attrs['contact_key'] || attrs['alias'] || attrs['photo_url'])) { |
|
|
return; // skip if not at least one of these
|
|
|
return; // skip if not at least one of these
|
|
|
} |
|
|
} |
|
|
console.log("PHOTO URL", attrs["photo_url"], contact.photoUrl); |
|
|
|
|
|
const contactKeyChanged = attrs['contact_key'] && contact.contactKey !== attrs['contact_key']; |
|
|
|
|
|
const aliasChanged = attrs['alias'] && contact.alias !== attrs['alias']; |
|
|
|
|
|
const photoChanged = attrs['photo_url'] && contact.photoUrl !== attrs['photo_url']; |
|
|
|
|
|
if (!(contactKeyChanged || aliasChanged || photoChanged)) { |
|
|
if (!(contactKeyChanged || aliasChanged || photoChanged)) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|