af01769c48f2fb902efc294e9c9f7093f35b138c
[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 _0xb7cf=['FaxApplication,\x20%s,\x20%s','debug','stringify','error','code','message','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','then','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x5d60ac,_0x55ed24){var _0x37120e=function(_0x436ebb){while(--_0x436ebb){_0x5d60ac['push'](_0x5d60ac['shift']());}};_0x37120e(++_0x55ed24);}(_0xb7cf,0xca));var _0xfb7c=function(_0x5be3cc,_0x3b5c7d){_0x5be3cc=_0x5be3cc-0x0;var _0x1162a2=_0xb7cf[_0x5be3cc];return _0x1162a2;};'use strict';var _=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var moment=require(_0xfb7c('0x2'));var BPromise=require(_0xfb7c('0x3'));var rs=require(_0xfb7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb7c('0x5'))['db'];var utils=require(_0xfb7c('0x6'));var logger=require(_0xfb7c('0x7'))(_0xfb7c('0x8'));var config=require(_0xfb7c('0x9'));var jayson=require(_0xfb7c('0xa'));var client=jayson[_0xfb7c('0xb')][_0xfb7c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41dcce,_0x2fd757,_0x3c21f3){return new BPromise(function(_0x34b889,_0x289874){return client[_0xfb7c('0xd')](_0x41dcce,_0x3c21f3)['then'](function(_0x13dcc3){logger[_0xfb7c('0xe')](_0xfb7c('0xf'),_0x2fd757,'request\x20sent');logger[_0xfb7c('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2fd757,'request\x20sent',JSON[_0xfb7c('0x11')](_0x13dcc3));if(_0x13dcc3[_0xfb7c('0x12')]){if(_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x13')]===0x1f4){logger[_0xfb7c('0x12')](_0xfb7c('0xf'),_0x2fd757,_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);return _0x289874(_0x13dcc3['error'][_0xfb7c('0x14')]);}logger[_0xfb7c('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2fd757,_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);return _0x34b889(_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);}else{logger[_0xfb7c('0xe')](_0xfb7c('0xf'),_0x2fd757,'request\x20sent');_0x34b889(_0x13dcc3['result'][_0xfb7c('0x14')]);}})['catch'](function(_0xa66d3a){logger[_0xfb7c('0x12')](_0xfb7c('0xf'),_0x2fd757,_0xa66d3a);_0x289874(_0xa66d3a);});});}exports[_0xfb7c('0x15')]=function(_0x493d7b){var _0x20115a=this;return new Promise(function(_0x4f0c3b,_0xa29a57){return db[_0xfb7c('0x16')][_0xfb7c('0x17')](_0x493d7b[_0xfb7c('0x18')],{'raw':_0x493d7b[_0xfb7c('0x19')]?_0x493d7b[_0xfb7c('0x19')][_0xfb7c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d7b['options']?_0x493d7b[_0xfb7c('0x19')]['where']||null:null,'attributes':_0x493d7b[_0xfb7c('0x19')]?_0x493d7b[_0xfb7c('0x19')][_0xfb7c('0x1b')]||null:null,'limit':_0x493d7b[_0xfb7c('0x19')]?_0x493d7b[_0xfb7c('0x19')][_0xfb7c('0x1c')]||null:null})[_0xfb7c('0x1d')](function(_0x4875b8){logger[_0xfb7c('0xe')]('UpdateFaxApplication',_0x493d7b);logger[_0xfb7c('0x10')]('UpdateFaxApplication',_0x493d7b,JSON['stringify'](_0x4875b8));_0x4f0c3b(_0x4875b8);})[_0xfb7c('0x1e')](function(_0x37ee79){logger['error'](_0xfb7c('0x15'),_0x37ee79['message'],_0x493d7b);_0xa29a57(_0x20115a['error'](0x1f4,_0x37ee79[_0xfb7c('0x14')]));});});};