Built motion from commit 1ea47bf4.|2.6.34
[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 _0x4283=['info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxApplication,\x20%s,\x20%s','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x22d4b5,_0x15f709){var _0x433423=function(_0x44c82a){while(--_0x44c82a){_0x22d4b5['push'](_0x22d4b5['shift']());}};_0x433423(++_0x15f709);}(_0x4283,0x119));var _0x3428=function(_0x249b61,_0xc7895b){_0x249b61=_0x249b61-0x0;var _0x5bbf8e=_0x4283[_0x249b61];return _0x5bbf8e;};'use strict';var _=require(_0x3428('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3428('0x1'));var rs=require(_0x3428('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3428('0x3'))['db'];var utils=require(_0x3428('0x4'));var logger=require(_0x3428('0x5'))('rpc');var config=require(_0x3428('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3428('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45dd0c,_0x5d1e5e,_0x443d07){return new BPromise(function(_0x28b47d,_0x481239){return client[_0x3428('0x8')](_0x45dd0c,_0x443d07)['then'](function(_0x2b5310){logger[_0x3428('0x9')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x3428('0xa'));logger[_0x3428('0xb')](_0x3428('0xc'),_0x5d1e5e,'request\x20sent',JSON[_0x3428('0xd')](_0x2b5310));if(_0x2b5310['error']){if(_0x2b5310[_0x3428('0xe')][_0x3428('0xf')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);return _0x481239(_0x2b5310['error'][_0x3428('0x10')]);}logger[_0x3428('0xe')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);return _0x28b47d(_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);}else{logger[_0x3428('0x9')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x3428('0xa'));_0x28b47d(_0x2b5310['result']['message']);}})[_0x3428('0x11')](function(_0x1df926){logger['error'](_0x3428('0x12'),_0x5d1e5e,_0x1df926);_0x481239(_0x1df926);});});}exports[_0x3428('0x13')]=function(_0x215bd8){var _0x4b5f74=this;return new Promise(function(_0x2f1538,_0x32758b){return db[_0x3428('0x14')][_0x3428('0x15')](_0x215bd8[_0x3428('0x16')],{'raw':_0x215bd8[_0x3428('0x17')]?_0x215bd8[_0x3428('0x17')][_0x3428('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x215bd8['options']?_0x215bd8[_0x3428('0x17')][_0x3428('0x19')]||null:null,'attributes':_0x215bd8[_0x3428('0x17')]?_0x215bd8[_0x3428('0x17')][_0x3428('0x1a')]||null:null,'limit':_0x215bd8[_0x3428('0x17')]?_0x215bd8['options'][_0x3428('0x1b')]||null:null})[_0x3428('0x1c')](function(_0x26847f){logger['info'](_0x3428('0x13'),_0x215bd8);logger[_0x3428('0xb')](_0x3428('0x13'),_0x215bd8,JSON[_0x3428('0xd')](_0x26847f));_0x2f1538(_0x26847f);})[_0x3428('0x11')](function(_0xf115){logger[_0x3428('0xe')](_0x3428('0x13'),_0xf115[_0x3428('0x10')],_0x215bd8);_0x32758b(_0x4b5f74[_0x3428('0xe')](0x1f4,_0xf115[_0x3428('0x10')]));});});};