Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / mailApplication / mailApplication.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 _0x6f67=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','MailApplication,\x20%s,\x20%s','result','MailApplication','body','options','raw','where','attributes','limit','UpdateMailApplication','debug','catch'];(function(_0x5f4fc0,_0x30de12){var _0x1fe751=function(_0x597580){while(--_0x597580){_0x5f4fc0['push'](_0x5f4fc0['shift']());}};_0x1fe751(++_0x30de12);}(_0x6f67,0xf0));var _0x76f6=function(_0x595682,_0x23fd00){_0x595682=_0x595682-0x0;var _0x2eceac=_0x6f67[_0x595682];return _0x2eceac;};'use strict';var _=require(_0x76f6('0x0'));var util=require(_0x76f6('0x1'));var moment=require(_0x76f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x76f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f6('0x5'))(_0x76f6('0x6'));var config=require(_0x76f6('0x7'));var jayson=require(_0x76f6('0x8'));var client=jayson['client'][_0x76f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x352550,_0x2b74d8,_0x2c8884){return new BPromise(function(_0x20e27d,_0x4adf60){return client[_0x76f6('0xa')](_0x352550,_0x2c8884)[_0x76f6('0xb')](function(_0x3b6b96){logger[_0x76f6('0xc')]('MailApplication,\x20%s,\x20%s',_0x2b74d8,_0x76f6('0xd'));logger['debug'](_0x76f6('0xe'),_0x2b74d8,'request\x20sent',JSON['stringify'](_0x3b6b96));if(_0x3b6b96[_0x76f6('0xf')]){if(_0x3b6b96[_0x76f6('0xf')][_0x76f6('0x10')]===0x1f4){logger[_0x76f6('0xf')]('MailApplication,\x20%s,\x20%s',_0x2b74d8,_0x3b6b96[_0x76f6('0xf')][_0x76f6('0x11')]);return _0x4adf60(_0x3b6b96['error'][_0x76f6('0x11')]);}logger[_0x76f6('0xf')](_0x76f6('0x12'),_0x2b74d8,_0x3b6b96[_0x76f6('0xf')]['message']);return _0x20e27d(_0x3b6b96[_0x76f6('0xf')][_0x76f6('0x11')]);}else{logger[_0x76f6('0xc')](_0x76f6('0x12'),_0x2b74d8,_0x76f6('0xd'));_0x20e27d(_0x3b6b96[_0x76f6('0x13')][_0x76f6('0x11')]);}})['catch'](function(_0x442a85){logger[_0x76f6('0xf')](_0x76f6('0x12'),_0x2b74d8,_0x442a85);_0x4adf60(_0x442a85);});});}exports['UpdateMailApplication']=function(_0x2ed64c){var _0x2af9af=this;return new Promise(function(_0x414d66,_0x1c6730){return db[_0x76f6('0x14')]['update'](_0x2ed64c[_0x76f6('0x15')],{'raw':_0x2ed64c[_0x76f6('0x16')]?_0x2ed64c[_0x76f6('0x16')][_0x76f6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ed64c[_0x76f6('0x16')]?_0x2ed64c[_0x76f6('0x16')][_0x76f6('0x18')]||null:null,'attributes':_0x2ed64c[_0x76f6('0x16')]?_0x2ed64c[_0x76f6('0x16')][_0x76f6('0x19')]||null:null,'limit':_0x2ed64c[_0x76f6('0x16')]?_0x2ed64c[_0x76f6('0x16')][_0x76f6('0x1a')]||null:null})[_0x76f6('0xb')](function(_0x4e8f13){logger['info'](_0x76f6('0x1b'),_0x2ed64c);logger[_0x76f6('0x1c')](_0x76f6('0x1b'),_0x2ed64c,JSON['stringify'](_0x4e8f13));_0x414d66(_0x4e8f13);})[_0x76f6('0x1d')](function(_0xc98d1){logger[_0x76f6('0xf')](_0x76f6('0x1b'),_0xc98d1[_0x76f6('0x11')],_0x2ed64c);_0x1c6730(_0x2af9af['error'](0x1f4,_0xc98d1[_0x76f6('0x11')]));});});};