Built motion from commit 10af8726.|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 _0xdb73=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateFaxApplication','FaxApplication','update','body','options','attributes','limit','catch','lodash'];(function(_0x314e22,_0x891517){var _0x4ac0f5=function(_0x43aa65){while(--_0x43aa65){_0x314e22['push'](_0x314e22['shift']());}};_0x4ac0f5(++_0x891517);}(_0xdb73,0xe7));var _0x3db7=function(_0x275daa,_0x46e44a){_0x275daa=_0x275daa-0x0;var _0x3af8d0=_0xdb73[_0x275daa];return _0x3af8d0;};'use strict';var _=require(_0x3db7('0x0'));var util=require(_0x3db7('0x1'));var moment=require(_0x3db7('0x2'));var BPromise=require(_0x3db7('0x3'));var rs=require(_0x3db7('0x4'));var fs=require('fs');var Redis=require(_0x3db7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3db7('0x6'));var logger=require(_0x3db7('0x7'))(_0x3db7('0x8'));var config=require(_0x3db7('0x9'));var jayson=require(_0x3db7('0xa'));var client=jayson['client'][_0x3db7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af7a2,_0x1b6c09,_0x2284d4){return new BPromise(function(_0x5b19ff,_0x177fa0){return client['request'](_0x3af7a2,_0x2284d4)[_0x3db7('0xc')](function(_0x30dd59){logger[_0x3db7('0xd')](_0x3db7('0xe'),_0x1b6c09,_0x3db7('0xf'));logger[_0x3db7('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1b6c09,_0x3db7('0xf'),JSON[_0x3db7('0x11')](_0x30dd59));if(_0x30dd59[_0x3db7('0x12')]){if(_0x30dd59[_0x3db7('0x12')][_0x3db7('0x13')]===0x1f4){logger[_0x3db7('0x12')]('FaxApplication,\x20%s,\x20%s',_0x1b6c09,_0x30dd59[_0x3db7('0x12')][_0x3db7('0x14')]);return _0x177fa0(_0x30dd59['error'][_0x3db7('0x14')]);}logger[_0x3db7('0x12')](_0x3db7('0xe'),_0x1b6c09,_0x30dd59[_0x3db7('0x12')][_0x3db7('0x14')]);return _0x5b19ff(_0x30dd59[_0x3db7('0x12')][_0x3db7('0x14')]);}else{logger[_0x3db7('0xd')]('FaxApplication,\x20%s,\x20%s',_0x1b6c09,_0x3db7('0xf'));_0x5b19ff(_0x30dd59['result'][_0x3db7('0x14')]);}})['catch'](function(_0x1cb1d7){logger[_0x3db7('0x12')](_0x3db7('0xe'),_0x1b6c09,_0x1cb1d7);_0x177fa0(_0x1cb1d7);});});}exports[_0x3db7('0x15')]=function(_0x4bdf95){var _0x3c18a2=this;return new Promise(function(_0x537a4f,_0x60ea46){return db[_0x3db7('0x16')][_0x3db7('0x17')](_0x4bdf95[_0x3db7('0x18')],{'raw':_0x4bdf95[_0x3db7('0x19')]?_0x4bdf95[_0x3db7('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bdf95['options']?_0x4bdf95['options']['where']||null:null,'attributes':_0x4bdf95['options']?_0x4bdf95[_0x3db7('0x19')][_0x3db7('0x1a')]||null:null,'limit':_0x4bdf95[_0x3db7('0x19')]?_0x4bdf95[_0x3db7('0x19')][_0x3db7('0x1b')]||null:null})['then'](function(_0x39916e){logger[_0x3db7('0xd')](_0x3db7('0x15'),_0x4bdf95);logger[_0x3db7('0x10')]('UpdateFaxApplication',_0x4bdf95,JSON[_0x3db7('0x11')](_0x39916e));_0x537a4f(_0x39916e);})[_0x3db7('0x1c')](function(_0x5f319e){logger['error']('UpdateFaxApplication',_0x5f319e[_0x3db7('0x14')],_0x4bdf95);_0x60ea46(_0x3c18a2[_0x3db7('0x12')](0x1f4,_0x5f319e[_0x3db7('0x14')]));});});};