Built motion from commit e1760111.|2.6.18
[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 _0xa27f=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','lodash','util'];(function(_0x2a9434,_0x2dc921){var _0x51c091=function(_0x137310){while(--_0x137310){_0x2a9434['push'](_0x2a9434['shift']());}};_0x51c091(++_0x2dc921);}(_0xa27f,0x76));var _0xfa27=function(_0x4cf7a9,_0x42618f){_0x4cf7a9=_0x4cf7a9-0x0;var _0x53938d=_0xa27f[_0x4cf7a9];return _0x53938d;};'use strict';var _=require(_0xfa27('0x0'));var util=require(_0xfa27('0x1'));var moment=require('moment');var BPromise=require(_0xfa27('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa27('0x3'));var db=require(_0xfa27('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfa27('0x5'));var config=require(_0xfa27('0x6'));var jayson=require(_0xfa27('0x7'));var client=jayson[_0xfa27('0x8')][_0xfa27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x212696,_0xf7380a,_0x47f48c){return new BPromise(function(_0x138c1b,_0x2c6bd3){return client[_0xfa27('0xa')](_0x212696,_0x47f48c)[_0xfa27('0xb')](function(_0x7e4136){logger[_0xfa27('0xc')]('FaxApplication,\x20%s,\x20%s',_0xf7380a,'request\x20sent');logger[_0xfa27('0xd')](_0xfa27('0xe'),_0xf7380a,_0xfa27('0xf'),JSON[_0xfa27('0x10')](_0x7e4136));if(_0x7e4136['error']){if(_0x7e4136[_0xfa27('0x11')][_0xfa27('0x12')]===0x1f4){logger[_0xfa27('0x11')](_0xfa27('0x13'),_0xf7380a,_0x7e4136['error'][_0xfa27('0x14')]);return _0x2c6bd3(_0x7e4136[_0xfa27('0x11')]['message']);}logger[_0xfa27('0x11')](_0xfa27('0x13'),_0xf7380a,_0x7e4136['error'][_0xfa27('0x14')]);return _0x138c1b(_0x7e4136[_0xfa27('0x11')][_0xfa27('0x14')]);}else{logger[_0xfa27('0xc')](_0xfa27('0x13'),_0xf7380a,_0xfa27('0xf'));_0x138c1b(_0x7e4136[_0xfa27('0x15')][_0xfa27('0x14')]);}})[_0xfa27('0x16')](function(_0xee6777){logger['error'](_0xfa27('0x13'),_0xf7380a,_0xee6777);_0x2c6bd3(_0xee6777);});});}exports[_0xfa27('0x17')]=function(_0x32a39d){var _0x4cef68=this;return new Promise(function(_0x32201,_0x298647){return db['FaxApplication'][_0xfa27('0x18')](_0x32a39d[_0xfa27('0x19')],{'raw':_0x32a39d[_0xfa27('0x1a')]?_0x32a39d['options'][_0xfa27('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32a39d[_0xfa27('0x1a')]?_0x32a39d[_0xfa27('0x1a')][_0xfa27('0x1c')]||null:null,'attributes':_0x32a39d['options']?_0x32a39d[_0xfa27('0x1a')][_0xfa27('0x1d')]||null:null,'limit':_0x32a39d[_0xfa27('0x1a')]?_0x32a39d['options']['limit']||null:null})[_0xfa27('0xb')](function(_0x67d4bf){logger[_0xfa27('0xc')](_0xfa27('0x17'),_0x32a39d);logger[_0xfa27('0xd')](_0xfa27('0x17'),_0x32a39d,JSON[_0xfa27('0x10')](_0x67d4bf));_0x32201(_0x67d4bf);})[_0xfa27('0x16')](function(_0x2f5281){logger[_0xfa27('0x11')](_0xfa27('0x17'),_0x2f5281['message'],_0x32a39d);_0x298647(_0x4cef68[_0xfa27('0x11')](0x1f4,_0x2f5281[_0xfa27('0x14')]));});});};