9e134685ca8cabca46b6e4f7041eba8415a293d2
[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 _0x01e7=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','where','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s'];(function(_0x4a3746,_0x37b7a8){var _0x3916c4=function(_0x3d8b1a){while(--_0x3d8b1a){_0x4a3746['push'](_0x4a3746['shift']());}};_0x3916c4(++_0x37b7a8);}(_0x01e7,0x125));var _0x701e=function(_0x55d694,_0x5bb69d){_0x55d694=_0x55d694-0x0;var _0x5c9d3e=_0x01e7[_0x55d694];return _0x5c9d3e;};'use strict';var _=require(_0x701e('0x0'));var util=require(_0x701e('0x1'));var moment=require(_0x701e('0x2'));var BPromise=require(_0x701e('0x3'));var rs=require(_0x701e('0x4'));var fs=require('fs');var Redis=require(_0x701e('0x5'));var db=require(_0x701e('0x6'))['db'];var utils=require(_0x701e('0x7'));var logger=require(_0x701e('0x8'))(_0x701e('0x9'));var config=require(_0x701e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x701e('0xb')][_0x701e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9ab603,_0x4cf450,_0x5984de){return new BPromise(function(_0x3dc407,_0xe9b695){return client[_0x701e('0xd')](_0x9ab603,_0x5984de)[_0x701e('0xe')](function(_0x3aea34){logger[_0x701e('0xf')](_0x701e('0x10'),_0x4cf450,'request\x20sent');logger[_0x701e('0x11')](_0x701e('0x12'),_0x4cf450,_0x701e('0x13'),JSON['stringify'](_0x3aea34));if(_0x3aea34['error']){if(_0x3aea34[_0x701e('0x14')][_0x701e('0x15')]===0x1f4){logger[_0x701e('0x14')](_0x701e('0x10'),_0x4cf450,_0x3aea34[_0x701e('0x14')]['message']);return _0xe9b695(_0x3aea34[_0x701e('0x14')][_0x701e('0x16')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x4cf450,_0x3aea34['error'][_0x701e('0x16')]);return _0x3dc407(_0x3aea34[_0x701e('0x14')][_0x701e('0x16')]);}else{logger['info'](_0x701e('0x10'),_0x4cf450,'request\x20sent');_0x3dc407(_0x3aea34[_0x701e('0x17')][_0x701e('0x16')]);}})['catch'](function(_0x40b85b){logger['error'](_0x701e('0x10'),_0x4cf450,_0x40b85b);_0xe9b695(_0x40b85b);});});}exports[_0x701e('0x18')]=function(_0x3d8a39){var _0xbe878=this;return new Promise(function(_0x43a1d3,_0x3cbe65){return db[_0x701e('0x19')][_0x701e('0x1a')](_0x3d8a39[_0x701e('0x1b')],{'raw':_0x3d8a39[_0x701e('0x1c')]?_0x3d8a39[_0x701e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d8a39[_0x701e('0x1c')]?_0x3d8a39['options'][_0x701e('0x1d')]||null:null,'attributes':_0x3d8a39[_0x701e('0x1c')]?_0x3d8a39['options']['attributes']||null:null,'limit':_0x3d8a39[_0x701e('0x1c')]?_0x3d8a39[_0x701e('0x1c')]['limit']||null:null})['then'](function(_0x3328e7){logger[_0x701e('0xf')](_0x701e('0x18'),_0x3d8a39);logger[_0x701e('0x11')](_0x701e('0x18'),_0x3d8a39,JSON[_0x701e('0x1e')](_0x3328e7));_0x43a1d3(_0x3328e7);})['catch'](function(_0x181b7c){logger[_0x701e('0x14')](_0x701e('0x18'),_0x181b7c[_0x701e('0x16')],_0x3d8a39);_0x3cbe65(_0xbe878['error'](0x1f4,_0x181b7c[_0x701e('0x16')]));});});};