421e8a90a0ec386b127cdc4ab58d0053ab554d21
[motion2.git] / server / api / faxApplication / faxApplication.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 _0x26f5=['code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4f1c38,_0x366066){var _0x3bfa77=function(_0x102801){while(--_0x102801){_0x4f1c38['push'](_0x4f1c38['shift']());}};_0x3bfa77(++_0x366066);}(_0x26f5,0x16d));var _0x526f=function(_0x466d95,_0x2841c6){_0x466d95=_0x466d95-0x0;var _0x32a82c=_0x26f5[_0x466d95];return _0x32a82c;};'use strict';var _=require(_0x526f('0x0'));var util=require(_0x526f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x526f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x526f('0x3'));var logger=require(_0x526f('0x4'))('rpc');var config=require(_0x526f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x526f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2565b6,_0x3e96db,_0x5cbd27){return new BPromise(function(_0x14b108,_0xbc9f68){return client[_0x526f('0x7')](_0x2565b6,_0x5cbd27)['then'](function(_0x2ee773){logger[_0x526f('0x8')](_0x526f('0x9'),_0x3e96db,_0x526f('0xa'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3e96db,_0x526f('0xa'),JSON[_0x526f('0xb')](_0x2ee773));if(_0x2ee773['error']){if(_0x2ee773[_0x526f('0xc')][_0x526f('0xd')]===0x1f4){logger[_0x526f('0xc')](_0x526f('0x9'),_0x3e96db,_0x2ee773[_0x526f('0xc')]['message']);return _0xbc9f68(_0x2ee773['error']['message']);}logger[_0x526f('0xc')]('FaxApplication,\x20%s,\x20%s',_0x3e96db,_0x2ee773['error'][_0x526f('0xe')]);return _0x14b108(_0x2ee773[_0x526f('0xc')]['message']);}else{logger[_0x526f('0x8')]('FaxApplication,\x20%s,\x20%s',_0x3e96db,_0x526f('0xa'));_0x14b108(_0x2ee773[_0x526f('0xf')]['message']);}})[_0x526f('0x10')](function(_0x4425b4){logger[_0x526f('0xc')](_0x526f('0x9'),_0x3e96db,_0x4425b4);_0xbc9f68(_0x4425b4);});});}exports[_0x526f('0x11')]=function(_0x1f5b4b){var _0x279c98=this;return new Promise(function(_0x4a160d,_0x3a9520){return db[_0x526f('0x12')][_0x526f('0x13')](_0x1f5b4b[_0x526f('0x14')],{'raw':_0x1f5b4b[_0x526f('0x15')]?_0x1f5b4b[_0x526f('0x15')][_0x526f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f5b4b[_0x526f('0x15')]?_0x1f5b4b[_0x526f('0x15')][_0x526f('0x17')]||null:null,'attributes':_0x1f5b4b[_0x526f('0x15')]?_0x1f5b4b[_0x526f('0x15')][_0x526f('0x18')]||null:null,'limit':_0x1f5b4b[_0x526f('0x15')]?_0x1f5b4b[_0x526f('0x15')][_0x526f('0x19')]||null:null})[_0x526f('0x1a')](function(_0x6a59c3){logger[_0x526f('0x8')](_0x526f('0x11'),_0x1f5b4b);logger['debug'](_0x526f('0x11'),_0x1f5b4b,JSON[_0x526f('0xb')](_0x6a59c3));_0x4a160d(_0x6a59c3);})[_0x526f('0x10')](function(_0x4e7eaa){logger[_0x526f('0xc')]('UpdateFaxApplication',_0x4e7eaa[_0x526f('0xe')],_0x1f5b4b);_0x3a9520(_0x279c98['error'](0x1f4,_0x4e7eaa[_0x526f('0xe')]));});});};