Built motion from commit (unavailable).|2.4.20
[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 _0x7236=['result','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','lodash','bluebird','randomstring','../../config/utils','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7236,0x16a));var _0x6723=function(_0xf0affc,_0x25c30a){_0xf0affc=_0xf0affc-0x0;var _0xe915ad=_0x7236[_0xf0affc];return _0xe915ad;};'use strict';var _=require(_0x6723('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6723('0x1'));var rs=require(_0x6723('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6723('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6723('0x4'));var client=jayson[_0x6723('0x5')][_0x6723('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x399cc7,_0x447caf,_0x653314){return new BPromise(function(_0xbdffd7,_0x4883f7){return client[_0x6723('0x7')](_0x399cc7,_0x653314)[_0x6723('0x8')](function(_0x348eef){logger[_0x6723('0x9')](_0x6723('0xa'),_0x447caf,_0x6723('0xb'));logger['debug'](_0x6723('0xc'),_0x447caf,_0x6723('0xb'),JSON[_0x6723('0xd')](_0x348eef));if(_0x348eef[_0x6723('0xe')]){if(_0x348eef[_0x6723('0xe')]['code']===0x1f4){logger[_0x6723('0xe')](_0x6723('0xa'),_0x447caf,_0x348eef[_0x6723('0xe')]['message']);return _0x4883f7(_0x348eef[_0x6723('0xe')][_0x6723('0xf')]);}logger[_0x6723('0xe')](_0x6723('0xa'),_0x447caf,_0x348eef[_0x6723('0xe')]['message']);return _0xbdffd7(_0x348eef['error'][_0x6723('0xf')]);}else{logger[_0x6723('0x9')](_0x6723('0xa'),_0x447caf,_0x6723('0xb'));_0xbdffd7(_0x348eef[_0x6723('0x10')][_0x6723('0xf')]);}})[_0x6723('0x11')](function(_0x4c7fdf){logger[_0x6723('0xe')](_0x6723('0xa'),_0x447caf,_0x4c7fdf);_0x4883f7(_0x4c7fdf);});});}exports['UpdateMailApplication']=function(_0x1b22c1){var _0x2f4824=this;return new Promise(function(_0xbeb990,_0x263db1){return db[_0x6723('0x12')][_0x6723('0x13')](_0x1b22c1[_0x6723('0x14')],{'raw':_0x1b22c1[_0x6723('0x15')]?_0x1b22c1['options'][_0x6723('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b22c1[_0x6723('0x15')]?_0x1b22c1[_0x6723('0x15')][_0x6723('0x17')]||null:null,'attributes':_0x1b22c1[_0x6723('0x15')]?_0x1b22c1[_0x6723('0x15')][_0x6723('0x18')]||null:null,'limit':_0x1b22c1[_0x6723('0x15')]?_0x1b22c1['options'][_0x6723('0x19')]||null:null})[_0x6723('0x8')](function(_0x291c0e){logger[_0x6723('0x9')]('UpdateMailApplication',_0x1b22c1);logger['debug'](_0x6723('0x1a'),_0x1b22c1,JSON[_0x6723('0xd')](_0x291c0e));_0xbeb990(_0x291c0e);})['catch'](function(_0x1b7e2e){logger[_0x6723('0xe')](_0x6723('0x1a'),_0x1b7e2e[_0x6723('0xf')],_0x1b22c1);_0x263db1(_0x2f4824[_0x6723('0xe')](0x1f4,_0x1b7e2e[_0x6723('0xf')]));});});};