Built motion from commit (unavailable).|2.5.3
[motion2.git] / server / api / mailServerIn / mailServerIn.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 _0xc9fc=['../../config/utils','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','findAll','options','attributes','include','model','map','GetMailServerIn','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x69c0c2,_0x2af0bf){var _0x3422f6=function(_0x283e41){while(--_0x283e41){_0x69c0c2['push'](_0x69c0c2['shift']());}};_0x3422f6(++_0x2af0bf);}(_0xc9fc,0x1bd));var _0xcc9f=function(_0x5a9896,_0x29fb94){_0x5a9896=_0x5a9896-0x0;var _0x4c5295=_0xc9fc[_0x5a9896];return _0x4c5295;};'use strict';var _=require(_0xcc9f('0x0'));var util=require(_0xcc9f('0x1'));var moment=require('moment');var BPromise=require(_0xcc9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc9f('0x3'));var db=require(_0xcc9f('0x4'))['db'];var utils=require(_0xcc9f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcc9f('0x6'));var jayson=require(_0xcc9f('0x7'));var client=jayson[_0xcc9f('0x8')][_0xcc9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30346c,_0x311300,_0x3ed33e){return new BPromise(function(_0x568787,_0x253782){return client['request'](_0x30346c,_0x3ed33e)[_0xcc9f('0xa')](function(_0x359a2e){logger[_0xcc9f('0xb')](_0xcc9f('0xc'),_0x311300,_0xcc9f('0xd'));logger[_0xcc9f('0xe')](_0xcc9f('0xf'),_0x311300,_0xcc9f('0xd'),JSON[_0xcc9f('0x10')](_0x359a2e));if(_0x359a2e[_0xcc9f('0x11')]){if(_0x359a2e[_0xcc9f('0x11')][_0xcc9f('0x12')]===0x1f4){logger['error'](_0xcc9f('0xc'),_0x311300,_0x359a2e[_0xcc9f('0x11')][_0xcc9f('0x13')]);return _0x253782(_0x359a2e[_0xcc9f('0x11')]['message']);}logger['error'](_0xcc9f('0xc'),_0x311300,_0x359a2e['error'][_0xcc9f('0x13')]);return _0x568787(_0x359a2e[_0xcc9f('0x11')][_0xcc9f('0x13')]);}else{logger[_0xcc9f('0xb')]('MailServerIn,\x20%s,\x20%s',_0x311300,_0xcc9f('0xd'));_0x568787(_0x359a2e[_0xcc9f('0x14')]['message']);}})[_0xcc9f('0x15')](function(_0x2548a1){logger[_0xcc9f('0x11')]('MailServerIn,\x20%s,\x20%s',_0x311300,_0x2548a1);_0x253782(_0x2548a1);});});}exports['GetMailServerIn']=function(_0x14c172){var _0x369e1f=this;return new Promise(function(_0x2730a1,_0x39e7c3){return db[_0xcc9f('0x16')][_0xcc9f('0x17')]({'raw':_0x14c172[_0xcc9f('0x18')]?_0x14c172['options']['raw']===undefined?!![]:![]:!![],'where':_0x14c172['options']?_0x14c172[_0xcc9f('0x18')]['where']||null:null,'attributes':_0x14c172[_0xcc9f('0x18')]?_0x14c172[_0xcc9f('0x18')][_0xcc9f('0x19')]||null:null,'limit':_0x14c172[_0xcc9f('0x18')]?_0x14c172[_0xcc9f('0x18')]['limit']||null:null,'include':_0x14c172[_0xcc9f('0x18')]?_0x14c172['options'][_0xcc9f('0x1a')]?_['map'](_0x14c172[_0xcc9f('0x18')][_0xcc9f('0x1a')],function(_0x5f1864){return{'model':db[_0x5f1864[_0xcc9f('0x1b')]],'as':_0x5f1864['as'],'attributes':_0x5f1864[_0xcc9f('0x19')],'include':_0x5f1864[_0xcc9f('0x1a')]?_[_0xcc9f('0x1c')](_0x5f1864['include'],function(_0x710907){return{'model':db[_0x710907['model']],'as':_0x710907['as'],'attributes':_0x710907[_0xcc9f('0x19')],'include':_0x710907[_0xcc9f('0x1a')]?_[_0xcc9f('0x1c')](_0x710907[_0xcc9f('0x1a')],function(_0x3e1349){return{'model':db[_0x3e1349[_0xcc9f('0x1b')]],'as':_0x3e1349['as'],'attributes':_0x3e1349[_0xcc9f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcc9f('0xa')](function(_0x138532){logger[_0xcc9f('0xb')](_0xcc9f('0x1d'),_0x14c172);logger['debug'](_0xcc9f('0x1d'),_0x14c172,JSON[_0xcc9f('0x10')](_0x138532));_0x2730a1(_0x138532);})[_0xcc9f('0x15')](function(_0x164d22){logger[_0xcc9f('0x11')](_0xcc9f('0x1d'),_0x164d22['message'],_0x14c172);_0x39e7c3(_0x369e1f[_0xcc9f('0x11')](0x1f4,_0x164d22[_0xcc9f('0x13')]));});});};