Built motion from commit 497d3d92.|2.5.43
[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 _0x8130=['request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','update','body','options','raw','where','attributes','UpdateMailApplication','lodash','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x28eafc,_0x37e1c0){var _0x1dd143=function(_0x3074a0){while(--_0x3074a0){_0x28eafc['push'](_0x28eafc['shift']());}};_0x1dd143(++_0x37e1c0);}(_0x8130,0x1d4));var _0x0813=function(_0x3e80d7,_0x2bb817){_0x3e80d7=_0x3e80d7-0x0;var _0x338241=_0x8130[_0x3e80d7];return _0x338241;};'use strict';var _=require(_0x0813('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0813('0x1'));var fs=require('fs');var Redis=require(_0x0813('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0813('0x3'));var logger=require('../../config/logger')(_0x0813('0x4'));var config=require('../../config/environment');var jayson=require(_0x0813('0x5'));var client=jayson[_0x0813('0x6')][_0x0813('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7d8a5d,_0x76186e,_0x162121){return new BPromise(function(_0x4449e3,_0x57da78){return client[_0x0813('0x8')](_0x7d8a5d,_0x162121)[_0x0813('0x9')](function(_0x5552e9){logger[_0x0813('0xa')]('MailApplication,\x20%s,\x20%s',_0x76186e,_0x0813('0xb'));logger[_0x0813('0xc')](_0x0813('0xd'),_0x76186e,_0x0813('0xb'),JSON[_0x0813('0xe')](_0x5552e9));if(_0x5552e9['error']){if(_0x5552e9[_0x0813('0xf')][_0x0813('0x10')]===0x1f4){logger[_0x0813('0xf')](_0x0813('0x11'),_0x76186e,_0x5552e9['error'][_0x0813('0x12')]);return _0x57da78(_0x5552e9['error'][_0x0813('0x12')]);}logger[_0x0813('0xf')]('MailApplication,\x20%s,\x20%s',_0x76186e,_0x5552e9[_0x0813('0xf')][_0x0813('0x12')]);return _0x4449e3(_0x5552e9['error']['message']);}else{logger[_0x0813('0xa')](_0x0813('0x11'),_0x76186e,_0x0813('0xb'));_0x4449e3(_0x5552e9[_0x0813('0x13')][_0x0813('0x12')]);}})[_0x0813('0x14')](function(_0x460579){logger[_0x0813('0xf')](_0x0813('0x11'),_0x76186e,_0x460579);_0x57da78(_0x460579);});});}exports['UpdateMailApplication']=function(_0x141185){var _0x36df38=this;return new Promise(function(_0x3aa538,_0x3cc95b){return db['MailApplication'][_0x0813('0x15')](_0x141185[_0x0813('0x16')],{'raw':_0x141185[_0x0813('0x17')]?_0x141185[_0x0813('0x17')][_0x0813('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x141185[_0x0813('0x17')]?_0x141185[_0x0813('0x17')][_0x0813('0x19')]||null:null,'attributes':_0x141185[_0x0813('0x17')]?_0x141185['options'][_0x0813('0x1a')]||null:null,'limit':_0x141185[_0x0813('0x17')]?_0x141185[_0x0813('0x17')]['limit']||null:null})[_0x0813('0x9')](function(_0x211e64){logger[_0x0813('0xa')](_0x0813('0x1b'),_0x141185);logger[_0x0813('0xc')]('UpdateMailApplication',_0x141185,JSON[_0x0813('0xe')](_0x211e64));_0x3aa538(_0x211e64);})[_0x0813('0x14')](function(_0x3cb3f0){logger[_0x0813('0xf')](_0x0813('0x1b'),_0x3cb3f0[_0x0813('0x12')],_0x141185);_0x3cc95b(_0x36df38[_0x0813('0xf')](0x1f4,_0x3cb3f0['message']));});});};