c3202dcb6bd79cd7568e319b6c34961ba7077c0d
[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 _0x1f3a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','catch','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3659e7,_0x5de13e){var _0x387a64=function(_0x2cc792){while(--_0x2cc792){_0x3659e7['push'](_0x3659e7['shift']());}};_0x387a64(++_0x5de13e);}(_0x1f3a,0x132));var _0xa1f3=function(_0x57aff0,_0x2049d4){_0x57aff0=_0x57aff0-0x0;var _0x4a145f=_0x1f3a[_0x57aff0];return _0x4a145f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa1f3('0x0'));var rs=require(_0xa1f3('0x1'));var fs=require('fs');var Redis=require(_0xa1f3('0x2'));var db=require(_0xa1f3('0x3'))['db'];var utils=require(_0xa1f3('0x4'));var logger=require(_0xa1f3('0x5'))('rpc');var config=require(_0xa1f3('0x6'));var jayson=require(_0xa1f3('0x7'));var client=jayson[_0xa1f3('0x8')][_0xa1f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57fd3d,_0x38f746,_0x4a1e05){return new BPromise(function(_0x3076da,_0x530c5a){return client[_0xa1f3('0xa')](_0x57fd3d,_0x4a1e05)[_0xa1f3('0xb')](function(_0x443f72){logger[_0xa1f3('0xc')](_0xa1f3('0xd'),_0x38f746,_0xa1f3('0xe'));logger[_0xa1f3('0xf')](_0xa1f3('0x10'),_0x38f746,'request\x20sent',JSON[_0xa1f3('0x11')](_0x443f72));if(_0x443f72[_0xa1f3('0x12')]){if(_0x443f72[_0xa1f3('0x12')][_0xa1f3('0x13')]===0x1f4){logger['error'](_0xa1f3('0xd'),_0x38f746,_0x443f72['error'][_0xa1f3('0x14')]);return _0x530c5a(_0x443f72[_0xa1f3('0x12')]['message']);}logger[_0xa1f3('0x12')](_0xa1f3('0xd'),_0x38f746,_0x443f72[_0xa1f3('0x12')][_0xa1f3('0x14')]);return _0x3076da(_0x443f72[_0xa1f3('0x12')][_0xa1f3('0x14')]);}else{logger[_0xa1f3('0xc')](_0xa1f3('0xd'),_0x38f746,_0xa1f3('0xe'));_0x3076da(_0x443f72[_0xa1f3('0x15')]['message']);}})['catch'](function(_0x2ec244){logger['error'](_0xa1f3('0xd'),_0x38f746,_0x2ec244);_0x530c5a(_0x2ec244);});});}exports[_0xa1f3('0x16')]=function(_0x3d604a){var _0x187dbe=this;return new Promise(function(_0x1982e9,_0x12c423){return db[_0xa1f3('0x17')][_0xa1f3('0x18')](_0x3d604a[_0xa1f3('0x19')],{'raw':_0x3d604a['options']?_0x3d604a[_0xa1f3('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d604a[_0xa1f3('0x1a')]?_0x3d604a[_0xa1f3('0x1a')][_0xa1f3('0x1b')]||null:null,'attributes':_0x3d604a[_0xa1f3('0x1a')]?_0x3d604a[_0xa1f3('0x1a')][_0xa1f3('0x1c')]||null:null,'limit':_0x3d604a[_0xa1f3('0x1a')]?_0x3d604a[_0xa1f3('0x1a')][_0xa1f3('0x1d')]||null:null})[_0xa1f3('0xb')](function(_0xf89e8e){logger[_0xa1f3('0xc')](_0xa1f3('0x16'),_0x3d604a);logger[_0xa1f3('0xf')](_0xa1f3('0x16'),_0x3d604a,JSON[_0xa1f3('0x11')](_0xf89e8e));_0x1982e9(_0xf89e8e);})[_0xa1f3('0x1e')](function(_0x26b5f6){logger[_0xa1f3('0x12')]('UpdateFaxApplication',_0x26b5f6['message'],_0x3d604a);_0x12c423(_0x187dbe[_0xa1f3('0x12')](0x1f4,_0x26b5f6['message']));});});};