Built motion from commit 0c5f406c.|2.6.29
[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 _0xdf68=['error','code','message','result','catch','UpdateMailApplication','MailApplication','options','raw','where','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdf68,0x1ce));var _0x8df6=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0xdf68[_0x34bd34];return _0x4e36d6;};'use strict';var _=require(_0x8df6('0x0'));var util=require(_0x8df6('0x1'));var moment=require(_0x8df6('0x2'));var BPromise=require(_0x8df6('0x3'));var rs=require(_0x8df6('0x4'));var fs=require('fs');var Redis=require(_0x8df6('0x5'));var db=require(_0x8df6('0x6'))['db'];var utils=require(_0x8df6('0x7'));var logger=require(_0x8df6('0x8'))('rpc');var config=require(_0x8df6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8df6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef9ba,_0x213f9f,_0x40c3a7){return new BPromise(function(_0x371ab1,_0x15e780){return client[_0x8df6('0xb')](_0x5ef9ba,_0x40c3a7)[_0x8df6('0xc')](function(_0xacf60a){logger[_0x8df6('0xd')](_0x8df6('0xe'),_0x213f9f,'request\x20sent');logger[_0x8df6('0xf')](_0x8df6('0x10'),_0x213f9f,_0x8df6('0x11'),JSON['stringify'](_0xacf60a));if(_0xacf60a[_0x8df6('0x12')]){if(_0xacf60a[_0x8df6('0x12')][_0x8df6('0x13')]===0x1f4){logger[_0x8df6('0x12')]('MailApplication,\x20%s,\x20%s',_0x213f9f,_0xacf60a[_0x8df6('0x12')][_0x8df6('0x14')]);return _0x15e780(_0xacf60a[_0x8df6('0x12')][_0x8df6('0x14')]);}logger['error'](_0x8df6('0xe'),_0x213f9f,_0xacf60a[_0x8df6('0x12')][_0x8df6('0x14')]);return _0x371ab1(_0xacf60a[_0x8df6('0x12')][_0x8df6('0x14')]);}else{logger[_0x8df6('0xd')](_0x8df6('0xe'),_0x213f9f,'request\x20sent');_0x371ab1(_0xacf60a[_0x8df6('0x15')]['message']);}})[_0x8df6('0x16')](function(_0x14be54){logger[_0x8df6('0x12')](_0x8df6('0xe'),_0x213f9f,_0x14be54);_0x15e780(_0x14be54);});});}exports[_0x8df6('0x17')]=function(_0x4c556d){var _0x559fc0=this;return new Promise(function(_0x59ffc0,_0x5080b7){return db[_0x8df6('0x18')]['update'](_0x4c556d['body'],{'raw':_0x4c556d[_0x8df6('0x19')]?_0x4c556d[_0x8df6('0x19')][_0x8df6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c556d[_0x8df6('0x19')]?_0x4c556d[_0x8df6('0x19')][_0x8df6('0x1b')]||null:null,'attributes':_0x4c556d[_0x8df6('0x19')]?_0x4c556d['options']['attributes']||null:null,'limit':_0x4c556d[_0x8df6('0x19')]?_0x4c556d[_0x8df6('0x19')][_0x8df6('0x1c')]||null:null})[_0x8df6('0xc')](function(_0x5f50ee){logger[_0x8df6('0xd')](_0x8df6('0x17'),_0x4c556d);logger[_0x8df6('0xf')](_0x8df6('0x17'),_0x4c556d,JSON[_0x8df6('0x1d')](_0x5f50ee));_0x59ffc0(_0x5f50ee);})[_0x8df6('0x16')](function(_0x2ded37){logger[_0x8df6('0x12')](_0x8df6('0x17'),_0x2ded37['message'],_0x4c556d);_0x5080b7(_0x559fc0['error'](0x1f4,_0x2ded37['message']));});});};