Built motion from commit (unavailable).|2.5.19
[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 _0xf38e=['../../config/environment','jayson/promise','client','info','request\x20sent','debug','error','code','FaxApplication,\x20%s,\x20%s','message','catch','FaxApplication','update','body','options','raw','where','attributes','limit','then','UpdateFaxApplication','stringify','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x15074f,_0x1e4594){var _0x534536=function(_0x256ffa){while(--_0x256ffa){_0x15074f['push'](_0x15074f['shift']());}};_0x534536(++_0x1e4594);}(_0xf38e,0x8a));var _0xef38=function(_0x19d98e,_0x50ac52){_0x19d98e=_0x19d98e-0x0;var _0xb0f25e=_0xf38e[_0x19d98e];return _0xb0f25e;};'use strict';var _=require(_0xef38('0x0'));var util=require(_0xef38('0x1'));var moment=require(_0xef38('0x2'));var BPromise=require('bluebird');var rs=require(_0xef38('0x3'));var fs=require('fs');var Redis=require(_0xef38('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef38('0x5'))(_0xef38('0x6'));var config=require(_0xef38('0x7'));var jayson=require(_0xef38('0x8'));var client=jayson[_0xef38('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x149ac5,_0x5a3a60,_0x39dd82){return new BPromise(function(_0x5025d2,_0x4f9dd4){return client['request'](_0x149ac5,_0x39dd82)['then'](function(_0x16c5fa){logger[_0xef38('0xa')]('FaxApplication,\x20%s,\x20%s',_0x5a3a60,_0xef38('0xb'));logger[_0xef38('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5a3a60,'request\x20sent',JSON['stringify'](_0x16c5fa));if(_0x16c5fa[_0xef38('0xd')]){if(_0x16c5fa[_0xef38('0xd')][_0xef38('0xe')]===0x1f4){logger[_0xef38('0xd')](_0xef38('0xf'),_0x5a3a60,_0x16c5fa[_0xef38('0xd')][_0xef38('0x10')]);return _0x4f9dd4(_0x16c5fa['error'][_0xef38('0x10')]);}logger[_0xef38('0xd')](_0xef38('0xf'),_0x5a3a60,_0x16c5fa[_0xef38('0xd')][_0xef38('0x10')]);return _0x5025d2(_0x16c5fa[_0xef38('0xd')]['message']);}else{logger[_0xef38('0xa')](_0xef38('0xf'),_0x5a3a60,_0xef38('0xb'));_0x5025d2(_0x16c5fa['result'][_0xef38('0x10')]);}})[_0xef38('0x11')](function(_0x1ab987){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5a3a60,_0x1ab987);_0x4f9dd4(_0x1ab987);});});}exports['UpdateFaxApplication']=function(_0x55cd6e){var _0x51fd34=this;return new Promise(function(_0x33b7e7,_0x46e712){return db[_0xef38('0x12')][_0xef38('0x13')](_0x55cd6e[_0xef38('0x14')],{'raw':_0x55cd6e[_0xef38('0x15')]?_0x55cd6e[_0xef38('0x15')][_0xef38('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55cd6e[_0xef38('0x15')]?_0x55cd6e[_0xef38('0x15')][_0xef38('0x17')]||null:null,'attributes':_0x55cd6e[_0xef38('0x15')]?_0x55cd6e['options'][_0xef38('0x18')]||null:null,'limit':_0x55cd6e[_0xef38('0x15')]?_0x55cd6e[_0xef38('0x15')][_0xef38('0x19')]||null:null})[_0xef38('0x1a')](function(_0x32c49f){logger['info']('UpdateFaxApplication',_0x55cd6e);logger[_0xef38('0xc')](_0xef38('0x1b'),_0x55cd6e,JSON[_0xef38('0x1c')](_0x32c49f));_0x33b7e7(_0x32c49f);})['catch'](function(_0x2284e8){logger[_0xef38('0xd')](_0xef38('0x1b'),_0x2284e8[_0xef38('0x10')],_0x55cd6e);_0x46e712(_0x51fd34[_0xef38('0xd')](0x1f4,_0x2284e8['message']));});});};