Built motion from commit 7158bc59.|2.5.42
[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 _0xeb4c=['message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','then','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xca1091,_0x539dbf){var _0xd3019c=function(_0xd629e0){while(--_0xd629e0){_0xca1091['push'](_0xca1091['shift']());}};_0xd3019c(++_0x539dbf);}(_0xeb4c,0xc1));var _0xceb4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xeb4c[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xceb4('0x0'));var util=require(_0xceb4('0x1'));var moment=require(_0xceb4('0x2'));var BPromise=require(_0xceb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb4('0x4'))['db'];var utils=require(_0xceb4('0x5'));var logger=require('../../config/logger')(_0xceb4('0x6'));var config=require(_0xceb4('0x7'));var jayson=require(_0xceb4('0x8'));var client=jayson[_0xceb4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b147,_0x105e50,_0x41a06c){return new BPromise(function(_0x80f169,_0x3ea3db){return client['request'](_0x10b147,_0x41a06c)['then'](function(_0x1cc98e){logger[_0xceb4('0xa')](_0xceb4('0xb'),_0x105e50,_0xceb4('0xc'));logger[_0xceb4('0xd')](_0xceb4('0xe'),_0x105e50,_0xceb4('0xc'),JSON['stringify'](_0x1cc98e));if(_0x1cc98e[_0xceb4('0xf')]){if(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x10')]===0x1f4){logger[_0xceb4('0xf')]('MailApplication,\x20%s,\x20%s',_0x105e50,_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);return _0x3ea3db(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);}logger[_0xceb4('0xf')](_0xceb4('0xb'),_0x105e50,_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);return _0x80f169(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);}else{logger[_0xceb4('0xa')](_0xceb4('0xb'),_0x105e50,_0xceb4('0xc'));_0x80f169(_0x1cc98e[_0xceb4('0x12')][_0xceb4('0x11')]);}})[_0xceb4('0x13')](function(_0x5cc4ff){logger[_0xceb4('0xf')](_0xceb4('0xb'),_0x105e50,_0x5cc4ff);_0x3ea3db(_0x5cc4ff);});});}exports[_0xceb4('0x14')]=function(_0x4baa5a){var _0x23ebd8=this;return new Promise(function(_0x1c95b8,_0x5b1ca6){return db['MailApplication'][_0xceb4('0x15')](_0x4baa5a[_0xceb4('0x16')],{'raw':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x19')]||null:null,'attributes':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a['options'][_0xceb4('0x1a')]||null:null,'limit':_0x4baa5a['options']?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x1b')]||null:null})[_0xceb4('0x1c')](function(_0x57dc62){logger[_0xceb4('0xa')](_0xceb4('0x14'),_0x4baa5a);logger[_0xceb4('0xd')](_0xceb4('0x14'),_0x4baa5a,JSON[_0xceb4('0x1d')](_0x57dc62));_0x1c95b8(_0x57dc62);})[_0xceb4('0x13')](function(_0x5bd9c0){logger[_0xceb4('0xf')]('UpdateMailApplication',_0x5bd9c0['message'],_0x4baa5a);_0x5b1ca6(_0x23ebd8['error'](0x1f4,_0x5bd9c0['message']));});});};