Built motion from commit 9d0783e6.|2.6.13
[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 _0xe54d=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','then','lodash','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe54d,0xbe));var _0xde54=function(_0x33de54,_0x5434b9){_0x33de54=_0x33de54-0x0;var _0x18fe1f=_0xe54d[_0x33de54];return _0x18fe1f;};'use strict';var _=require(_0xde54('0x0'));var util=require(_0xde54('0x1'));var moment=require('moment');var BPromise=require(_0xde54('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde54('0x3'));var db=require(_0xde54('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde54('0x5'))(_0xde54('0x6'));var config=require(_0xde54('0x7'));var jayson=require(_0xde54('0x8'));var client=jayson[_0xde54('0x9')][_0xde54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e37f8,_0x1c3e07,_0x353c26){return new BPromise(function(_0x2c0414,_0x21bb11){return client[_0xde54('0xb')](_0x2e37f8,_0x353c26)['then'](function(_0x8e2891){logger[_0xde54('0xc')](_0xde54('0xd'),_0x1c3e07,_0xde54('0xe'));logger[_0xde54('0xf')](_0xde54('0x10'),_0x1c3e07,'request\x20sent',JSON[_0xde54('0x11')](_0x8e2891));if(_0x8e2891[_0xde54('0x12')]){if(_0x8e2891[_0xde54('0x12')][_0xde54('0x13')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x1c3e07,_0x8e2891[_0xde54('0x12')][_0xde54('0x14')]);return _0x21bb11(_0x8e2891[_0xde54('0x12')][_0xde54('0x14')]);}logger['error'](_0xde54('0xd'),_0x1c3e07,_0x8e2891[_0xde54('0x12')]['message']);return _0x2c0414(_0x8e2891[_0xde54('0x12')]['message']);}else{logger['info'](_0xde54('0xd'),_0x1c3e07,_0xde54('0xe'));_0x2c0414(_0x8e2891[_0xde54('0x15')][_0xde54('0x14')]);}})[_0xde54('0x16')](function(_0x13b48b){logger['error'](_0xde54('0xd'),_0x1c3e07,_0x13b48b);_0x21bb11(_0x13b48b);});});}exports[_0xde54('0x17')]=function(_0x38c68f){var _0x885f79=this;return new Promise(function(_0x42ab22,_0x4b90c5){return db[_0xde54('0x18')][_0xde54('0x19')](_0x38c68f[_0xde54('0x1a')],{'raw':_0x38c68f[_0xde54('0x1b')]?_0x38c68f[_0xde54('0x1b')][_0xde54('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38c68f['options']?_0x38c68f['options'][_0xde54('0x1d')]||null:null,'attributes':_0x38c68f['options']?_0x38c68f[_0xde54('0x1b')][_0xde54('0x1e')]||null:null,'limit':_0x38c68f[_0xde54('0x1b')]?_0x38c68f[_0xde54('0x1b')]['limit']||null:null})[_0xde54('0x1f')](function(_0x36f594){logger[_0xde54('0xc')](_0xde54('0x17'),_0x38c68f);logger['debug'](_0xde54('0x17'),_0x38c68f,JSON[_0xde54('0x11')](_0x36f594));_0x42ab22(_0x36f594);})[_0xde54('0x16')](function(_0x2fe191){logger[_0xde54('0x12')](_0xde54('0x17'),_0x2fe191[_0xde54('0x14')],_0x38c68f);_0x4b90c5(_0x885f79[_0xde54('0x12')](0x1f4,_0x2fe191[_0xde54('0x14')]));});});};