Built motion from commit b5413ace.|2.6.9
[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 _0xa3be=['code','message','info','request\x20sent','result','catch','CreateSmsQueueReport','body','options','stringify','update','raw','where','limit','debug','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','error'];(function(_0x438ef0,_0x4431ec){var _0x4046ce=function(_0x5ae15e){while(--_0x5ae15e){_0x438ef0['push'](_0x438ef0['shift']());}};_0x4046ce(++_0x4431ec);}(_0xa3be,0x1b0));var _0xea3b=function(_0x125176,_0x43317e){_0x125176=_0x125176-0x0;var _0x982b88=_0xa3be[_0x125176];return _0x982b88;};'use strict';var _=require(_0xea3b('0x0'));var util=require(_0xea3b('0x1'));var moment=require(_0xea3b('0x2'));var BPromise=require(_0xea3b('0x3'));var rs=require(_0xea3b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea3b('0x5'))['db'];var utils=require(_0xea3b('0x6'));var logger=require(_0xea3b('0x7'))(_0xea3b('0x8'));var config=require('../../config/environment');var jayson=require(_0xea3b('0x9'));var client=jayson[_0xea3b('0xa')][_0xea3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21304b,_0x28faf6,_0x288fce){return new BPromise(function(_0x43228e,_0xbfa4){return client[_0xea3b('0xc')](_0x21304b,_0x288fce)[_0xea3b('0xd')](function(_0x45fbdb){logger['info'](_0xea3b('0xe'),_0x28faf6,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x28faf6,'request\x20sent',JSON['stringify'](_0x45fbdb));if(_0x45fbdb[_0xea3b('0xf')]){if(_0x45fbdb[_0xea3b('0xf')][_0xea3b('0x10')]===0x1f4){logger[_0xea3b('0xf')](_0xea3b('0xe'),_0x28faf6,_0x45fbdb[_0xea3b('0xf')][_0xea3b('0x11')]);return _0xbfa4(_0x45fbdb[_0xea3b('0xf')][_0xea3b('0x11')]);}logger[_0xea3b('0xf')](_0xea3b('0xe'),_0x28faf6,_0x45fbdb[_0xea3b('0xf')][_0xea3b('0x11')]);return _0x43228e(_0x45fbdb[_0xea3b('0xf')][_0xea3b('0x11')]);}else{logger[_0xea3b('0x12')](_0xea3b('0xe'),_0x28faf6,_0xea3b('0x13'));_0x43228e(_0x45fbdb[_0xea3b('0x14')][_0xea3b('0x11')]);}})[_0xea3b('0x15')](function(_0x39c3dd){logger[_0xea3b('0xf')](_0xea3b('0xe'),_0x28faf6,_0x39c3dd);_0xbfa4(_0x39c3dd);});});}exports[_0xea3b('0x16')]=function(_0x7f8189){var _0x8351f2=this;return new Promise(function(_0x3a6ab3,_0x10d8c7){return db['SmsQueueReport']['create'](_0x7f8189[_0xea3b('0x17')],{'raw':_0x7f8189[_0xea3b('0x18')]?_0x7f8189[_0xea3b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xea3b('0xd')](function(_0x39f9ce){logger[_0xea3b('0x12')](_0xea3b('0x16'),_0x7f8189);logger['debug'](_0xea3b('0x16'),_0x7f8189,JSON[_0xea3b('0x19')](_0x39f9ce));_0x3a6ab3(_0x39f9ce);})[_0xea3b('0x15')](function(_0x1d5069){logger[_0xea3b('0xf')](_0xea3b('0x16'),_0x1d5069[_0xea3b('0x11')],_0x7f8189);_0x10d8c7(_0x8351f2['error'](0x1f4,_0x1d5069[_0xea3b('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x41ff10){var _0x385350=this;return new Promise(function(_0x5c49a9,_0x52e757){return db['SmsQueueReport'][_0xea3b('0x1a')](_0x41ff10[_0xea3b('0x17')],{'raw':_0x41ff10[_0xea3b('0x18')]?_0x41ff10[_0xea3b('0x18')][_0xea3b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41ff10[_0xea3b('0x18')]?_0x41ff10[_0xea3b('0x18')][_0xea3b('0x1c')]||null:null,'attributes':_0x41ff10[_0xea3b('0x18')]?_0x41ff10[_0xea3b('0x18')]['attributes']||null:null,'limit':_0x41ff10[_0xea3b('0x18')]?_0x41ff10['options'][_0xea3b('0x1d')]||null:null})[_0xea3b('0xd')](function(_0x1d6bac){logger['info']('UpdateSmsQueueReport',_0x41ff10);logger[_0xea3b('0x1e')](_0xea3b('0x1f'),_0x41ff10,JSON[_0xea3b('0x19')](_0x1d6bac));_0x5c49a9(_0x1d6bac);})['catch'](function(_0x10b245){logger[_0xea3b('0xf')](_0xea3b('0x1f'),_0x10b245[_0xea3b('0x11')],_0x41ff10);_0x52e757(_0x385350[_0xea3b('0xf')](0x1f4,_0x10b245[_0xea3b('0x11')]));});});};