Built motion from commit (unavailable).|2.5.14
[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 _0x6333=['client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','limit','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x181915,_0x38f19e){var _0x5e350a=function(_0x224936){while(--_0x224936){_0x181915['push'](_0x181915['shift']());}};_0x5e350a(++_0x38f19e);}(_0x6333,0x104));var _0x3633=function(_0x3fe2e8,_0x1f42d8){_0x3fe2e8=_0x3fe2e8-0x0;var _0x3f246e=_0x6333[_0x3fe2e8];return _0x3f246e;};'use strict';var _=require(_0x3633('0x0'));var util=require('util');var moment=require(_0x3633('0x1'));var BPromise=require(_0x3633('0x2'));var rs=require(_0x3633('0x3'));var fs=require('fs');var Redis=require(_0x3633('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3633('0x5'));var logger=require(_0x3633('0x6'))(_0x3633('0x7'));var config=require(_0x3633('0x8'));var jayson=require(_0x3633('0x9'));var client=jayson[_0x3633('0xa')][_0x3633('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58cc0c,_0x35fa5c,_0xa324ea){return new BPromise(function(_0x4656ad,_0x2824be){return client['request'](_0x58cc0c,_0xa324ea)['then'](function(_0x8d7832){logger[_0x3633('0xc')](_0x3633('0xd'),_0x35fa5c,_0x3633('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x35fa5c,_0x3633('0xe'),JSON[_0x3633('0xf')](_0x8d7832));if(_0x8d7832[_0x3633('0x10')]){if(_0x8d7832[_0x3633('0x10')][_0x3633('0x11')]===0x1f4){logger[_0x3633('0x10')](_0x3633('0xd'),_0x35fa5c,_0x8d7832[_0x3633('0x10')][_0x3633('0x12')]);return _0x2824be(_0x8d7832['error']['message']);}logger[_0x3633('0x10')]('FaxApplication,\x20%s,\x20%s',_0x35fa5c,_0x8d7832[_0x3633('0x10')][_0x3633('0x12')]);return _0x4656ad(_0x8d7832[_0x3633('0x10')][_0x3633('0x12')]);}else{logger[_0x3633('0xc')](_0x3633('0xd'),_0x35fa5c,'request\x20sent');_0x4656ad(_0x8d7832[_0x3633('0x13')]['message']);}})[_0x3633('0x14')](function(_0xad0b50){logger[_0x3633('0x10')]('FaxApplication,\x20%s,\x20%s',_0x35fa5c,_0xad0b50);_0x2824be(_0xad0b50);});});}exports[_0x3633('0x15')]=function(_0x471ade){var _0x20e21d=this;return new Promise(function(_0x3c61ee,_0x5ac871){return db[_0x3633('0x16')][_0x3633('0x17')](_0x471ade[_0x3633('0x18')],{'raw':_0x471ade[_0x3633('0x19')]?_0x471ade[_0x3633('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x471ade['options']?_0x471ade[_0x3633('0x19')][_0x3633('0x1a')]||null:null,'attributes':_0x471ade['options']?_0x471ade['options']['attributes']||null:null,'limit':_0x471ade[_0x3633('0x19')]?_0x471ade[_0x3633('0x19')][_0x3633('0x1b')]||null:null})[_0x3633('0x1c')](function(_0x4c857e){logger[_0x3633('0xc')]('UpdateFaxApplication',_0x471ade);logger[_0x3633('0x1d')](_0x3633('0x15'),_0x471ade,JSON['stringify'](_0x4c857e));_0x3c61ee(_0x4c857e);})[_0x3633('0x14')](function(_0x5b2cb7){logger[_0x3633('0x10')](_0x3633('0x15'),_0x5b2cb7[_0x3633('0x12')],_0x471ade);_0x5ac871(_0x20e21d[_0x3633('0x10')](0x1f4,_0x5b2cb7[_0x3633('0x12')]));});});};