Built motion from commit d32f51f5.|2.6.31
[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 _0xfacc=['client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','stringify','UpdateWhatsappQueueReport','attributes','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x53cede,_0x47aad6){var _0x118acb=function(_0x514fa){while(--_0x514fa){_0x53cede['push'](_0x53cede['shift']());}};_0x118acb(++_0x47aad6);}(_0xfacc,0x10f));var _0xcfac=function(_0x137ae3,_0x4e93bf){_0x137ae3=_0x137ae3-0x0;var _0x3de34c=_0xfacc[_0x137ae3];return _0x3de34c;};'use strict';var _=require(_0xcfac('0x0'));var util=require(_0xcfac('0x1'));var moment=require(_0xcfac('0x2'));var BPromise=require('bluebird');var rs=require(_0xcfac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcfac('0x4'));var logger=require(_0xcfac('0x5'))(_0xcfac('0x6'));var config=require(_0xcfac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcfac('0x8')][_0xcfac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ede9e,_0x1f5f15,_0x57bb14){return new BPromise(function(_0x1c9d05,_0x40984c){return client[_0xcfac('0xa')](_0x3ede9e,_0x57bb14)[_0xcfac('0xb')](function(_0x229c7e){logger[_0xcfac('0xc')](_0xcfac('0xd'),_0x1f5f15,_0xcfac('0xe'));logger[_0xcfac('0xf')](_0xcfac('0x10'),_0x1f5f15,_0xcfac('0xe'),JSON['stringify'](_0x229c7e));if(_0x229c7e[_0xcfac('0x11')]){if(_0x229c7e[_0xcfac('0x11')][_0xcfac('0x12')]===0x1f4){logger[_0xcfac('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1f5f15,_0x229c7e[_0xcfac('0x11')][_0xcfac('0x13')]);return _0x40984c(_0x229c7e[_0xcfac('0x11')][_0xcfac('0x13')]);}logger['error'](_0xcfac('0xd'),_0x1f5f15,_0x229c7e['error'][_0xcfac('0x13')]);return _0x1c9d05(_0x229c7e[_0xcfac('0x11')][_0xcfac('0x13')]);}else{logger[_0xcfac('0xc')](_0xcfac('0xd'),_0x1f5f15,_0xcfac('0xe'));_0x1c9d05(_0x229c7e[_0xcfac('0x14')][_0xcfac('0x13')]);}})[_0xcfac('0x15')](function(_0x443e25){logger[_0xcfac('0x11')](_0xcfac('0xd'),_0x1f5f15,_0x443e25);_0x40984c(_0x443e25);});});}exports[_0xcfac('0x16')]=function(_0x15921c){var _0xdc133f=this;return new Promise(function(_0x4d7298,_0x535066){return db['WhatsappQueueReport'][_0xcfac('0x17')](_0x15921c[_0xcfac('0x18')],{'raw':_0x15921c[_0xcfac('0x19')]?_0x15921c[_0xcfac('0x19')][_0xcfac('0x1a')]===undefined?!![]:![]:!![]})[_0xcfac('0xb')](function(_0x56ec01){logger[_0xcfac('0xc')](_0xcfac('0x16'),_0x15921c);logger[_0xcfac('0xf')](_0xcfac('0x16'),_0x15921c,JSON[_0xcfac('0x1b')](_0x56ec01));_0x4d7298(_0x56ec01);})[_0xcfac('0x15')](function(_0x4ccda9){logger[_0xcfac('0x11')]('CreateWhatsappQueueReport',_0x4ccda9[_0xcfac('0x13')],_0x15921c);_0x535066(_0xdc133f[_0xcfac('0x11')](0x1f4,_0x4ccda9[_0xcfac('0x13')]));});});};exports[_0xcfac('0x1c')]=function(_0x3ea6a7){var _0xd543d8=this;return new Promise(function(_0x369da9,_0x329a8f){return db['WhatsappQueueReport']['update'](_0x3ea6a7[_0xcfac('0x18')],{'raw':_0x3ea6a7[_0xcfac('0x19')]?_0x3ea6a7[_0xcfac('0x19')][_0xcfac('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ea6a7['options']?_0x3ea6a7[_0xcfac('0x19')]['where']||null:null,'attributes':_0x3ea6a7[_0xcfac('0x19')]?_0x3ea6a7[_0xcfac('0x19')][_0xcfac('0x1d')]||null:null,'limit':_0x3ea6a7[_0xcfac('0x19')]?_0x3ea6a7['options'][_0xcfac('0x1e')]||null:null})[_0xcfac('0xb')](function(_0x52886a){logger[_0xcfac('0xc')]('UpdateWhatsappQueueReport',_0x3ea6a7);logger[_0xcfac('0xf')](_0xcfac('0x1c'),_0x3ea6a7,JSON[_0xcfac('0x1b')](_0x52886a));_0x369da9(_0x52886a);})['catch'](function(_0x22c289){logger['error']('UpdateWhatsappQueueReport',_0x22c289[_0xcfac('0x13')],_0x3ea6a7);_0x329a8f(_0xd543d8[_0xcfac('0x11')](0x1f4,_0x22c289['message']));});});};