Built motion from commit 19a84241.|2.5.34
[motion2.git] / server / api / whatsappQueueReport / whatsappQueueReport.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x06e3=['error','code','message','result','CreateWhatsappQueueReport','create','body','options','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4f4d4a,_0x21bdaa){var _0x20b807=function(_0x496ef9){while(--_0x496ef9){_0x4f4d4a['push'](_0x4f4d4a['shift']());}};_0x20b807(++_0x21bdaa);}(_0x06e3,0x16c));var _0x306e=function(_0x4452f3,_0x1c19a3){_0x4452f3=_0x4452f3-0x0;var _0x14ae51=_0x06e3[_0x4452f3];return _0x14ae51;};'use strict';var _=require('lodash');var util=require(_0x306e('0x0'));var moment=require(_0x306e('0x1'));var BPromise=require(_0x306e('0x2'));var rs=require(_0x306e('0x3'));var fs=require('fs');var Redis=require(_0x306e('0x4'));var db=require(_0x306e('0x5'))['db'];var utils=require(_0x306e('0x6'));var logger=require(_0x306e('0x7'))(_0x306e('0x8'));var config=require(_0x306e('0x9'));var jayson=require(_0x306e('0xa'));var client=jayson[_0x306e('0xb')][_0x306e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fcc34,_0xe6b0e0,_0x5ca1b6){return new BPromise(function(_0x3de7ee,_0x321912){return client[_0x306e('0xd')](_0x1fcc34,_0x5ca1b6)[_0x306e('0xe')](function(_0x5c7397){logger[_0x306e('0xf')](_0x306e('0x10'),_0xe6b0e0,_0x306e('0x11'));logger[_0x306e('0x12')](_0x306e('0x13'),_0xe6b0e0,_0x306e('0x11'),JSON[_0x306e('0x14')](_0x5c7397));if(_0x5c7397[_0x306e('0x15')]){if(_0x5c7397['error'][_0x306e('0x16')]===0x1f4){logger['error'](_0x306e('0x10'),_0xe6b0e0,_0x5c7397[_0x306e('0x15')][_0x306e('0x17')]);return _0x321912(_0x5c7397[_0x306e('0x15')][_0x306e('0x17')]);}logger[_0x306e('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0xe6b0e0,_0x5c7397[_0x306e('0x15')][_0x306e('0x17')]);return _0x3de7ee(_0x5c7397[_0x306e('0x15')][_0x306e('0x17')]);}else{logger['info'](_0x306e('0x10'),_0xe6b0e0,_0x306e('0x11'));_0x3de7ee(_0x5c7397[_0x306e('0x18')]['message']);}})['catch'](function(_0x3cd6a3){logger[_0x306e('0x15')](_0x306e('0x10'),_0xe6b0e0,_0x3cd6a3);_0x321912(_0x3cd6a3);});});}exports[_0x306e('0x19')]=function(_0x5e6308){var _0x483f20=this;return new Promise(function(_0x415315,_0x1859e6){return db['WhatsappQueueReport'][_0x306e('0x1a')](_0x5e6308[_0x306e('0x1b')],{'raw':_0x5e6308[_0x306e('0x1c')]?_0x5e6308[_0x306e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x306e('0xe')](function(_0x1f606a){logger['info'](_0x306e('0x19'),_0x5e6308);logger[_0x306e('0x12')](_0x306e('0x19'),_0x5e6308,JSON[_0x306e('0x14')](_0x1f606a));_0x415315(_0x1f606a);})[_0x306e('0x1d')](function(_0x155d50){logger[_0x306e('0x15')](_0x306e('0x19'),_0x155d50[_0x306e('0x17')],_0x5e6308);_0x1859e6(_0x483f20[_0x306e('0x15')](0x1f4,_0x155d50[_0x306e('0x17')]));});});};exports[_0x306e('0x1e')]=function(_0x51bd60){var _0x5678d6=this;return new Promise(function(_0x466ecb,_0xf38b83){return db[_0x306e('0x1f')]['update'](_0x51bd60[_0x306e('0x1b')],{'raw':_0x51bd60['options']?_0x51bd60[_0x306e('0x1c')][_0x306e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51bd60[_0x306e('0x1c')]?_0x51bd60['options']['where']||null:null,'attributes':_0x51bd60[_0x306e('0x1c')]?_0x51bd60[_0x306e('0x1c')][_0x306e('0x21')]||null:null,'limit':_0x51bd60['options']?_0x51bd60['options'][_0x306e('0x22')]||null:null})['then'](function(_0x445bf1){logger[_0x306e('0xf')](_0x306e('0x1e'),_0x51bd60);logger[_0x306e('0x12')]('UpdateWhatsappQueueReport',_0x51bd60,JSON[_0x306e('0x14')](_0x445bf1));_0x466ecb(_0x445bf1);})['catch'](function(_0x4ce9c3){logger[_0x306e('0x15')]('UpdateWhatsappQueueReport',_0x4ce9c3['message'],_0x51bd60);_0xf38b83(_0x5678d6[_0x306e('0x15')](0x1f4,_0x4ce9c3[_0x306e('0x17')]));});});};