| 329 | } |
| 330 | |
| 331 | function _sendNotification(appId, res, reqType) { |
| 332 | try { |
| 333 | for (let i = 0; i < res.value.length; i++) { |
| 334 | if (res.value[i].state === 'fulfilled') { |
| 335 | if (reqType.save.indexOf(res.value[i].value._id) >= 0) { |
| 336 | config.realTime.sendObjectNotification(appId, res.value[i].value, 'created'); |
| 337 | } else { |
| 338 | config.realTime.sendObjectNotification(appId, res.value[i].value, 'updated'); |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | return ''; |
| 343 | } catch (err) { |
| 344 | winston.log('error', { |
| 345 | error: String(err), |
| 346 | stack: new Error().stack, |
| 347 | }); |
| 348 | return null; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | async function _isSchemaValid(appId, collectionName, document, accessList, isMasterKey, encryption_key) { |
| 353 | const mainPromise = q.defer(); |