Built motion from commit (unavailable).|2.2.4
[motion2.git] / server / api / faxQueueReport / faxQueueReport.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 _0x2f68=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','FaxQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','where','attributes','limit','util'];(function(_0x3151ba,_0x5325ef){var _0x4206cd=function(_0x4ec733){while(--_0x4ec733){_0x3151ba['push'](_0x3151ba['shift']());}};_0x4206cd(++_0x5325ef);}(_0x2f68,0x12b));var _0x82f6=function(_0x3685aa,_0xe9bfd0){_0x3685aa=_0x3685aa-0x0;var _0x5dfb2b=_0x2f68[_0x3685aa];return _0x5dfb2b;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require(_0x82f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82f6('0x5'));var logger=require(_0x82f6('0x6'))(_0x82f6('0x7'));var config=require(_0x82f6('0x8'));var jayson=require(_0x82f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ad1f,_0x4fa10f,_0x282bc8){return new BPromise(function(_0x3fd6ef,_0x159ea8){return client['request'](_0x9ad1f,_0x282bc8)[_0x82f6('0xa')](function(_0x415226){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,'request\x20sent');logger[_0x82f6('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4fa10f,'request\x20sent',JSON[_0x82f6('0xe')](_0x415226));if(_0x415226['error']){if(_0x415226[_0x82f6('0xf')][_0x82f6('0x10')]===0x1f4){logger['error'](_0x82f6('0xc'),_0x4fa10f,_0x415226['error'][_0x82f6('0x11')]);return _0x159ea8(_0x415226['error']['message']);}logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);return _0x3fd6ef(_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);}else{logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,_0x82f6('0x12'));_0x3fd6ef(_0x415226[_0x82f6('0x13')][_0x82f6('0x11')]);}})[_0x82f6('0x14')](function(_0x412d1f){logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x412d1f);_0x159ea8(_0x412d1f);});});}exports[_0x82f6('0x15')]=function(_0x59333a){var _0x2a16e2=this;return new Promise(function(_0x39dea8,_0x32b458){return db[_0x82f6('0x16')]['create'](_0x59333a[_0x82f6('0x17')],{'raw':_0x59333a[_0x82f6('0x18')]?_0x59333a[_0x82f6('0x18')][_0x82f6('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3abb44){logger[_0x82f6('0xb')]('CreateFaxQueueReport',_0x59333a);logger[_0x82f6('0xd')](_0x82f6('0x15'),_0x59333a,JSON[_0x82f6('0xe')](_0x3abb44));_0x39dea8(_0x3abb44);})['catch'](function(_0x2099dc){logger['error'](_0x82f6('0x15'),_0x2099dc['message'],_0x59333a);_0x32b458(_0x2a16e2[_0x82f6('0xf')](0x1f4,_0x2099dc[_0x82f6('0x11')]));});});};exports[_0x82f6('0x1a')]=function(_0x219101){var _0x390681=this;return new Promise(function(_0x4b9384,_0x6aa93d){return db[_0x82f6('0x16')]['update'](_0x219101[_0x82f6('0x17')],{'raw':_0x219101['options']?_0x219101[_0x82f6('0x18')][_0x82f6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x219101[_0x82f6('0x18')]?_0x219101['options'][_0x82f6('0x1b')]||null:null,'attributes':_0x219101[_0x82f6('0x18')]?_0x219101['options'][_0x82f6('0x1c')]||null:null,'limit':_0x219101[_0x82f6('0x18')]?_0x219101[_0x82f6('0x18')][_0x82f6('0x1d')]||null:null})[_0x82f6('0xa')](function(_0x4fde1b){logger[_0x82f6('0xb')](_0x82f6('0x1a'),_0x219101);logger[_0x82f6('0xd')](_0x82f6('0x1a'),_0x219101,JSON[_0x82f6('0xe')](_0x4fde1b));_0x4b9384(_0x4fde1b);})['catch'](function(_0x18b21a){logger['error'](_0x82f6('0x1a'),_0x18b21a['message'],_0x219101);_0x6aa93d(_0x390681[_0x82f6('0xf')](0x1f4,_0x18b21a['message']));});});};