Built motion from commit (unavailable).|2.4.8
[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 _0x9f89=['attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','stringify','UpdateSmsQueueReport','where'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9f89,0xac));var _0x99f8=function(_0x26c132,_0x104b47){_0x26c132=_0x26c132-0x0;var _0x5ab720=_0x9f89[_0x26c132];return _0x5ab720;};'use strict';var _=require(_0x99f8('0x0'));var util=require(_0x99f8('0x1'));var moment=require(_0x99f8('0x2'));var BPromise=require(_0x99f8('0x3'));var rs=require(_0x99f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x99f8('0x6'))(_0x99f8('0x7'));var config=require(_0x99f8('0x8'));var jayson=require(_0x99f8('0x9'));var client=jayson['client'][_0x99f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x173eb1,_0x2836fa,_0x301dc5){return new BPromise(function(_0x28883b,_0x5d27f6){return client[_0x99f8('0xb')](_0x173eb1,_0x301dc5)['then'](function(_0x54bc57){logger[_0x99f8('0xc')](_0x99f8('0xd'),_0x2836fa,_0x99f8('0xe'));logger[_0x99f8('0xf')](_0x99f8('0x10'),_0x2836fa,'request\x20sent',JSON['stringify'](_0x54bc57));if(_0x54bc57['error']){if(_0x54bc57['error'][_0x99f8('0x11')]===0x1f4){logger[_0x99f8('0x12')](_0x99f8('0xd'),_0x2836fa,_0x54bc57[_0x99f8('0x12')][_0x99f8('0x13')]);return _0x5d27f6(_0x54bc57[_0x99f8('0x12')][_0x99f8('0x13')]);}logger['error'](_0x99f8('0xd'),_0x2836fa,_0x54bc57['error'][_0x99f8('0x13')]);return _0x28883b(_0x54bc57[_0x99f8('0x12')][_0x99f8('0x13')]);}else{logger[_0x99f8('0xc')](_0x99f8('0xd'),_0x2836fa,_0x99f8('0xe'));_0x28883b(_0x54bc57[_0x99f8('0x14')][_0x99f8('0x13')]);}})[_0x99f8('0x15')](function(_0x25c6c8){logger[_0x99f8('0x12')](_0x99f8('0xd'),_0x2836fa,_0x25c6c8);_0x5d27f6(_0x25c6c8);});});}exports[_0x99f8('0x16')]=function(_0x403492){var _0x2ba7ee=this;return new Promise(function(_0x510b3f,_0xde1052){return db[_0x99f8('0x17')][_0x99f8('0x18')](_0x403492[_0x99f8('0x19')],{'raw':_0x403492[_0x99f8('0x1a')]?_0x403492[_0x99f8('0x1a')][_0x99f8('0x1b')]===undefined?!![]:![]:!![]})[_0x99f8('0x1c')](function(_0x4f5cf3){logger['info']('CreateSmsQueueReport',_0x403492);logger[_0x99f8('0xf')](_0x99f8('0x16'),_0x403492,JSON[_0x99f8('0x1d')](_0x4f5cf3));_0x510b3f(_0x4f5cf3);})[_0x99f8('0x15')](function(_0xdfec0a){logger[_0x99f8('0x12')](_0x99f8('0x16'),_0xdfec0a[_0x99f8('0x13')],_0x403492);_0xde1052(_0x2ba7ee[_0x99f8('0x12')](0x1f4,_0xdfec0a[_0x99f8('0x13')]));});});};exports[_0x99f8('0x1e')]=function(_0x2290a1){var _0x4646f2=this;return new Promise(function(_0x51cfcb,_0xeb81ce){return db[_0x99f8('0x17')]['update'](_0x2290a1[_0x99f8('0x19')],{'raw':_0x2290a1[_0x99f8('0x1a')]?_0x2290a1[_0x99f8('0x1a')][_0x99f8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2290a1[_0x99f8('0x1a')]?_0x2290a1[_0x99f8('0x1a')][_0x99f8('0x1f')]||null:null,'attributes':_0x2290a1[_0x99f8('0x1a')]?_0x2290a1[_0x99f8('0x1a')][_0x99f8('0x20')]||null:null,'limit':_0x2290a1['options']?_0x2290a1[_0x99f8('0x1a')][_0x99f8('0x21')]||null:null})[_0x99f8('0x1c')](function(_0x5b2b95){logger[_0x99f8('0xc')](_0x99f8('0x1e'),_0x2290a1);logger[_0x99f8('0xf')](_0x99f8('0x1e'),_0x2290a1,JSON[_0x99f8('0x1d')](_0x5b2b95));_0x51cfcb(_0x5b2b95);})[_0x99f8('0x15')](function(_0x44cb5c){logger[_0x99f8('0x12')](_0x99f8('0x1e'),_0x44cb5c[_0x99f8('0x13')],_0x2290a1);_0xeb81ce(_0x4646f2[_0x99f8('0x12')](0x1f4,_0x44cb5c['message']));});});};