e37ed0402b0185f046b5d0214f831976f6abbfc5
[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 _0x2b49=['jayson/promise','client','http','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x59c4b8,_0x222a43){var _0x42389d=function(_0x1a9661){while(--_0x1a9661){_0x59c4b8['push'](_0x59c4b8['shift']());}};_0x42389d(++_0x222a43);}(_0x2b49,0x1d3));var _0x92b4=function(_0x1ba5e3,_0xe2464a){_0x1ba5e3=_0x1ba5e3-0x0;var _0x407e38=_0x2b49[_0x1ba5e3];return _0x407e38;};'use strict';var _=require(_0x92b4('0x0'));var util=require(_0x92b4('0x1'));var moment=require(_0x92b4('0x2'));var BPromise=require(_0x92b4('0x3'));var rs=require(_0x92b4('0x4'));var fs=require('fs');var Redis=require(_0x92b4('0x5'));var db=require(_0x92b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x92b4('0x7'))('rpc');var config=require(_0x92b4('0x8'));var jayson=require(_0x92b4('0x9'));var client=jayson[_0x92b4('0xa')][_0x92b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa02782,_0x4c0c09,_0x52fed1){return new BPromise(function(_0x31da58,_0x1bb980){return client['request'](_0xa02782,_0x52fed1)[_0x92b4('0xc')](function(_0x4ecdc9){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4c0c09,_0x92b4('0xd'));logger[_0x92b4('0xe')](_0x92b4('0xf'),_0x4c0c09,_0x92b4('0xd'),JSON[_0x92b4('0x10')](_0x4ecdc9));if(_0x4ecdc9[_0x92b4('0x11')]){if(_0x4ecdc9[_0x92b4('0x11')][_0x92b4('0x12')]===0x1f4){logger[_0x92b4('0x11')](_0x92b4('0x13'),_0x4c0c09,_0x4ecdc9[_0x92b4('0x11')]['message']);return _0x1bb980(_0x4ecdc9[_0x92b4('0x11')][_0x92b4('0x14')]);}logger[_0x92b4('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4c0c09,_0x4ecdc9[_0x92b4('0x11')][_0x92b4('0x14')]);return _0x31da58(_0x4ecdc9['error'][_0x92b4('0x14')]);}else{logger[_0x92b4('0x15')](_0x92b4('0x13'),_0x4c0c09,'request\x20sent');_0x31da58(_0x4ecdc9[_0x92b4('0x16')][_0x92b4('0x14')]);}})[_0x92b4('0x17')](function(_0x24a6b8){logger[_0x92b4('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4c0c09,_0x24a6b8);_0x1bb980(_0x24a6b8);});});}exports[_0x92b4('0x18')]=function(_0xebea9f){var _0x4bf13c=this;return new Promise(function(_0x592949,_0x52ed36){return db[_0x92b4('0x19')][_0x92b4('0x1a')](_0xebea9f[_0x92b4('0x1b')],{'raw':_0xebea9f[_0x92b4('0x1c')]?_0xebea9f[_0x92b4('0x1c')][_0x92b4('0x1d')]===undefined?!![]:![]:!![]})[_0x92b4('0xc')](function(_0x43b684){logger['info']('CreateFaxQueueReport',_0xebea9f);logger[_0x92b4('0xe')](_0x92b4('0x18'),_0xebea9f,JSON[_0x92b4('0x10')](_0x43b684));_0x592949(_0x43b684);})['catch'](function(_0x1f17f8){logger[_0x92b4('0x11')](_0x92b4('0x18'),_0x1f17f8[_0x92b4('0x14')],_0xebea9f);_0x52ed36(_0x4bf13c[_0x92b4('0x11')](0x1f4,_0x1f17f8['message']));});});};exports[_0x92b4('0x1e')]=function(_0x2b48c1){var _0x81bf43=this;return new Promise(function(_0x5f526b,_0x640a73){return db[_0x92b4('0x19')][_0x92b4('0x1f')](_0x2b48c1[_0x92b4('0x1b')],{'raw':_0x2b48c1[_0x92b4('0x1c')]?_0x2b48c1[_0x92b4('0x1c')][_0x92b4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b48c1[_0x92b4('0x1c')]?_0x2b48c1[_0x92b4('0x1c')]['where']||null:null,'attributes':_0x2b48c1[_0x92b4('0x1c')]?_0x2b48c1[_0x92b4('0x1c')][_0x92b4('0x20')]||null:null,'limit':_0x2b48c1[_0x92b4('0x1c')]?_0x2b48c1['options'][_0x92b4('0x21')]||null:null})[_0x92b4('0xc')](function(_0x580e20){logger[_0x92b4('0x15')](_0x92b4('0x1e'),_0x2b48c1);logger[_0x92b4('0xe')](_0x92b4('0x1e'),_0x2b48c1,JSON[_0x92b4('0x10')](_0x580e20));_0x5f526b(_0x580e20);})[_0x92b4('0x17')](function(_0x1fb7da){logger[_0x92b4('0x11')](_0x92b4('0x1e'),_0x1fb7da[_0x92b4('0x14')],_0x2b48c1);_0x640a73(_0x81bf43[_0x92b4('0x11')](0x1f4,_0x1fb7da[_0x92b4('0x14')]));});});};