Browse Source

logz

hosting-provider
Evan Feenstra 5 years ago
parent
commit
d3734989a8
  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

@ -70,6 +70,7 @@ const updateContact = async (req, res) => {
console.log('=> updateContact called', { body: req.body, params: req.params, query: req.query })
let attrs = extractAttrs(req.body)
console.log("TO UPDATE",attrs)
const contact = await models.Contact.findOne({ where: { id: req.params.id }})
let shouldSendUpdatedSelf = (
@ -78,6 +79,7 @@ const updateContact = async (req, res) => {
attrs["contact_key"]==null // OR NO NEW CONTACT KEY
)
)
console.log('shouldSendUPdatedSelf',shouldSendUpdatedSelf)
// update self
const owner = await contact.update(jsonUtils.jsonToContact(attrs))
@ -89,6 +91,7 @@ const updateContact = async (req, res) => {
const contactIds = await models.Contact.findAll({
where:{deleted:false,fromGroup:false}
}).map(c => c.id)
console.log('contactIds',contactIds)
if (contactIds.length == 0) return
helpers.sendContactKeys({

3
dist/api/controllers/contacts.js

@ -69,10 +69,12 @@ exports.generateToken = generateToken;
const 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);
console.log("TO UPDATE", attrs);
const contact = yield models_1.models.Contact.findOne({ where: { id: req.params.id } });
let shouldSendUpdatedSelf = (contact.isOwner && ((contact.contactKey == null && attrs["contact_key"] != null) || // CREATE CONTACT KEY!
attrs["contact_key"] == null // OR NO NEW CONTACT KEY
));
console.log('shouldSendUPdatedSelf', shouldSendUpdatedSelf);
// update self
const owner = yield contact.update(jsonUtils.jsonToContact(attrs));
res_1.success(res, jsonUtils.contactToJson(owner));
@ -82,6 +84,7 @@ const updateContact = (req, res) => __awaiter(void 0, void 0, void 0, function*
const contactIds = yield models_1.models.Contact.findAll({
where: { deleted: false, fromGroup: false }
}).map(c => c.id);
console.log('contactIds', contactIds);
if (contactIds.length == 0)
return;
helpers.sendContactKeys({

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

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