cd2f75384868e499dc30a7cb5d7a7863378b9035
[motion2.git] / server / api / smsQueueReport / smsQueueReport.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 _0xa914=['SmsQueueReport,\x20%s,\x20%s','message','request\x20sent','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0xa914,0x97));var _0x4a91=function(_0x2264e1,_0x4c5c1c){_0x2264e1=_0x2264e1-0x0;var _0x508ab2=_0xa914[_0x2264e1];return _0x508ab2;};'use strict';var _=require(_0x4a91('0x0'));var util=require(_0x4a91('0x1'));var moment=require(_0x4a91('0x2'));var BPromise=require(_0x4a91('0x3'));var rs=require(_0x4a91('0x4'));var fs=require('fs');var Redis=require(_0x4a91('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a91('0x6'));var logger=require(_0x4a91('0x7'))('rpc');var config=require(_0x4a91('0x8'));var jayson=require(_0x4a91('0x9'));var client=jayson[_0x4a91('0xa')][_0x4a91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x545c76,_0x25f4c7,_0x2d5999){return new BPromise(function(_0x2047fc,_0x2a3cfd){return client[_0x4a91('0xc')](_0x545c76,_0x2d5999)[_0x4a91('0xd')](function(_0x3208be){logger[_0x4a91('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x25f4c7,'request\x20sent');logger['debug'](_0x4a91('0xf'),_0x25f4c7,'request\x20sent',JSON[_0x4a91('0x10')](_0x3208be));if(_0x3208be['error']){if(_0x3208be[_0x4a91('0x11')][_0x4a91('0x12')]===0x1f4){logger['error'](_0x4a91('0x13'),_0x25f4c7,_0x3208be[_0x4a91('0x11')]['message']);return _0x2a3cfd(_0x3208be[_0x4a91('0x11')][_0x4a91('0x14')]);}logger[_0x4a91('0x11')](_0x4a91('0x13'),_0x25f4c7,_0x3208be[_0x4a91('0x11')][_0x4a91('0x14')]);return _0x2047fc(_0x3208be[_0x4a91('0x11')][_0x4a91('0x14')]);}else{logger['info'](_0x4a91('0x13'),_0x25f4c7,_0x4a91('0x15'));_0x2047fc(_0x3208be['result'][_0x4a91('0x14')]);}})[_0x4a91('0x16')](function(_0x643b90){logger['error'](_0x4a91('0x13'),_0x25f4c7,_0x643b90);_0x2a3cfd(_0x643b90);});});}exports[_0x4a91('0x17')]=function(_0x3f910b){var _0x42d8f5=this;return new Promise(function(_0x212f52,_0xffda32){return db[_0x4a91('0x18')][_0x4a91('0x19')](_0x3f910b[_0x4a91('0x1a')],{'raw':_0x3f910b[_0x4a91('0x1b')]?_0x3f910b[_0x4a91('0x1b')][_0x4a91('0x1c')]===undefined?!![]:![]:!![]})[_0x4a91('0xd')](function(_0x29e75f){logger[_0x4a91('0xe')](_0x4a91('0x17'),_0x3f910b);logger[_0x4a91('0x1d')](_0x4a91('0x17'),_0x3f910b,JSON[_0x4a91('0x10')](_0x29e75f));_0x212f52(_0x29e75f);})[_0x4a91('0x16')](function(_0x2d4671){logger['error'](_0x4a91('0x17'),_0x2d4671[_0x4a91('0x14')],_0x3f910b);_0xffda32(_0x42d8f5[_0x4a91('0x11')](0x1f4,_0x2d4671[_0x4a91('0x14')]));});});};exports[_0x4a91('0x1e')]=function(_0x25baac){var _0x4993ec=this;return new Promise(function(_0x139716,_0x4dc770){return db[_0x4a91('0x18')][_0x4a91('0x1f')](_0x25baac[_0x4a91('0x1a')],{'raw':_0x25baac[_0x4a91('0x1b')]?_0x25baac[_0x4a91('0x1b')][_0x4a91('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25baac[_0x4a91('0x1b')]?_0x25baac[_0x4a91('0x1b')]['where']||null:null,'attributes':_0x25baac[_0x4a91('0x1b')]?_0x25baac[_0x4a91('0x1b')][_0x4a91('0x20')]||null:null,'limit':_0x25baac[_0x4a91('0x1b')]?_0x25baac[_0x4a91('0x1b')][_0x4a91('0x21')]||null:null})[_0x4a91('0xd')](function(_0x2d60ec){logger[_0x4a91('0xe')](_0x4a91('0x1e'),_0x25baac);logger[_0x4a91('0x1d')]('UpdateSmsQueueReport',_0x25baac,JSON['stringify'](_0x2d60ec));_0x139716(_0x2d60ec);})['catch'](function(_0x7ce5c9){logger[_0x4a91('0x11')](_0x4a91('0x1e'),_0x7ce5c9[_0x4a91('0x14')],_0x25baac);_0x4dc770(_0x4993ec[_0x4a91('0x11')](0x1f4,_0x7ce5c9[_0x4a91('0x14')]));});});};