0299c0440f7ad56e40ee2d725a07529a2be84503
[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 _0x689f=['options','raw','debug','stringify','UpdateFaxQueueReport','body','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0x5ae1a1,_0x38c7c4){var _0x1034aa=function(_0x5d4bb8){while(--_0x5d4bb8){_0x5ae1a1['push'](_0x5ae1a1['shift']());}};_0x1034aa(++_0x38c7c4);}(_0x689f,0xaa));var _0xf689=function(_0x4de752,_0x48e4dc){_0x4de752=_0x4de752-0x0;var _0x56792d=_0x689f[_0x4de752];return _0x56792d;};'use strict';var _=require(_0xf689('0x0'));var util=require(_0xf689('0x1'));var moment=require(_0xf689('0x2'));var BPromise=require('bluebird');var rs=require(_0xf689('0x3'));var fs=require('fs');var Redis=require(_0xf689('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf689('0x5'));var logger=require(_0xf689('0x6'))(_0xf689('0x7'));var config=require(_0xf689('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf689('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3d6c8,_0x257a69,_0x4772bd){return new BPromise(function(_0xdefc8b,_0x23d3e3){return client[_0xf689('0xa')](_0xf3d6c8,_0x4772bd)['then'](function(_0x2bd9ea){logger[_0xf689('0xb')](_0xf689('0xc'),_0x257a69,_0xf689('0xd'));logger['debug'](_0xf689('0xe'),_0x257a69,_0xf689('0xd'),JSON['stringify'](_0x2bd9ea));if(_0x2bd9ea['error']){if(_0x2bd9ea[_0xf689('0xf')][_0xf689('0x10')]===0x1f4){logger['error'](_0xf689('0xc'),_0x257a69,_0x2bd9ea[_0xf689('0xf')][_0xf689('0x11')]);return _0x23d3e3(_0x2bd9ea[_0xf689('0xf')][_0xf689('0x11')]);}logger[_0xf689('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x257a69,_0x2bd9ea[_0xf689('0xf')]['message']);return _0xdefc8b(_0x2bd9ea[_0xf689('0xf')][_0xf689('0x11')]);}else{logger['info'](_0xf689('0xc'),_0x257a69,_0xf689('0xd'));_0xdefc8b(_0x2bd9ea[_0xf689('0x12')][_0xf689('0x11')]);}})['catch'](function(_0x4d1870){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x257a69,_0x4d1870);_0x23d3e3(_0x4d1870);});});}exports[_0xf689('0x13')]=function(_0x468a63){var _0x15d299=this;return new Promise(function(_0x380e0d,_0x15ac5c){return db[_0xf689('0x14')][_0xf689('0x15')](_0x468a63['body'],{'raw':_0x468a63[_0xf689('0x16')]?_0x468a63[_0xf689('0x16')][_0xf689('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3efc3a){logger[_0xf689('0xb')](_0xf689('0x13'),_0x468a63);logger[_0xf689('0x18')]('CreateFaxQueueReport',_0x468a63,JSON[_0xf689('0x19')](_0x3efc3a));_0x380e0d(_0x3efc3a);})['catch'](function(_0x245b3e){logger[_0xf689('0xf')](_0xf689('0x13'),_0x245b3e[_0xf689('0x11')],_0x468a63);_0x15ac5c(_0x15d299['error'](0x1f4,_0x245b3e[_0xf689('0x11')]));});});};exports[_0xf689('0x1a')]=function(_0xa2d901){var _0x17baaa=this;return new Promise(function(_0x957054,_0x447e42){return db['FaxQueueReport']['update'](_0xa2d901[_0xf689('0x1b')],{'raw':_0xa2d901['options']?_0xa2d901[_0xf689('0x16')][_0xf689('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa2d901[_0xf689('0x16')]?_0xa2d901[_0xf689('0x16')][_0xf689('0x1c')]||null:null,'attributes':_0xa2d901[_0xf689('0x16')]?_0xa2d901[_0xf689('0x16')][_0xf689('0x1d')]||null:null,'limit':_0xa2d901['options']?_0xa2d901[_0xf689('0x16')][_0xf689('0x1e')]||null:null})[_0xf689('0x1f')](function(_0x14f991){logger[_0xf689('0xb')](_0xf689('0x1a'),_0xa2d901);logger['debug'](_0xf689('0x1a'),_0xa2d901,JSON[_0xf689('0x19')](_0x14f991));_0x957054(_0x14f991);})['catch'](function(_0x6b38da){logger[_0xf689('0xf')](_0xf689('0x1a'),_0x6b38da[_0xf689('0x11')],_0xa2d901);_0x447e42(_0x17baaa[_0xf689('0xf')](0x1f4,_0x6b38da[_0xf689('0x11')]));});});};