Built motion from commit 15aa0e42.|2.6.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 _0x819a=['../../config/logger','rpc','../../config/environment','client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxApplication','update','raw','options','attributes','limit','then','UpdateFaxApplication','stringify','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1ba2de,_0x3b3ac9){var _0x5295da=function(_0x1b9576){while(--_0x1b9576){_0x1ba2de['push'](_0x1ba2de['shift']());}};_0x5295da(++_0x3b3ac9);}(_0x819a,0xaf));var _0xa819=function(_0x31fb52,_0xded904){_0x31fb52=_0x31fb52-0x0;var _0x3fc244=_0x819a[_0x31fb52];return _0x3fc244;};'use strict';var _=require(_0xa819('0x0'));var util=require('util');var moment=require(_0xa819('0x1'));var BPromise=require(_0xa819('0x2'));var rs=require(_0xa819('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa819('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa819('0x5'))(_0xa819('0x6'));var config=require(_0xa819('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa819('0x8')][_0xa819('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51a277,_0xeafdf9,_0x5b8519){return new BPromise(function(_0x53e7a2,_0x18a552){return client[_0xa819('0xa')](_0x51a277,_0x5b8519)['then'](function(_0x44d4ca){logger[_0xa819('0xb')](_0xa819('0xc'),_0xeafdf9,'request\x20sent');logger[_0xa819('0xd')](_0xa819('0xe'),_0xeafdf9,_0xa819('0xf'),JSON['stringify'](_0x44d4ca));if(_0x44d4ca['error']){if(_0x44d4ca[_0xa819('0x10')][_0xa819('0x11')]===0x1f4){logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x18a552(_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);}logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x53e7a2(_0x44d4ca['error'][_0xa819('0x12')]);}else{logger['info'](_0xa819('0xc'),_0xeafdf9,'request\x20sent');_0x53e7a2(_0x44d4ca[_0xa819('0x13')][_0xa819('0x12')]);}})[_0xa819('0x14')](function(_0x1fa750){logger['error']('FaxApplication,\x20%s,\x20%s',_0xeafdf9,_0x1fa750);_0x18a552(_0x1fa750);});});}exports['UpdateFaxApplication']=function(_0x4c3a17){var _0x354c5a=this;return new Promise(function(_0x4f72c2,_0x4096ee){return db[_0xa819('0x15')][_0xa819('0x16')](_0x4c3a17['body'],{'raw':_0x4c3a17['options']?_0x4c3a17['options'][_0xa819('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')]['where']||null:null,'attributes':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')][_0xa819('0x19')]||null:null,'limit':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')][_0xa819('0x1a')]||null:null})[_0xa819('0x1b')](function(_0x2e15e8){logger[_0xa819('0xb')](_0xa819('0x1c'),_0x4c3a17);logger['debug']('UpdateFaxApplication',_0x4c3a17,JSON[_0xa819('0x1d')](_0x2e15e8));_0x4f72c2(_0x2e15e8);})[_0xa819('0x14')](function(_0x4050f0){logger[_0xa819('0x10')](_0xa819('0x1c'),_0x4050f0[_0xa819('0x12')],_0x4c3a17);_0x4096ee(_0x354c5a['error'](0x1f4,_0x4050f0[_0xa819('0x12')]));});});};