9abe834f890bb71d589ee385bfc794bb18789bc6
[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 _0x76f0=['attributes','then','GetMailServerIn','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','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','where','limit','include','map','model'];(function(_0x1db200,_0x1147ef){var _0x391c7f=function(_0x29f57e){while(--_0x29f57e){_0x1db200['push'](_0x1db200['shift']());}};_0x391c7f(++_0x1147ef);}(_0x76f0,0x157));var _0x076f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x76f0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x076f('0x0'));var util=require(_0x076f('0x1'));var moment=require(_0x076f('0x2'));var BPromise=require(_0x076f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x076f('0x4'));var db=require(_0x076f('0x5'))['db'];var utils=require(_0x076f('0x6'));var logger=require(_0x076f('0x7'))('rpc');var config=require(_0x076f('0x8'));var jayson=require(_0x076f('0x9'));var client=jayson['client'][_0x076f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564d21,_0xdd39cd,_0x2e3fdb){return new BPromise(function(_0x313738,_0x10d413){return client[_0x076f('0xb')](_0x564d21,_0x2e3fdb)['then'](function(_0x57105c){logger[_0x076f('0xc')](_0x076f('0xd'),_0xdd39cd,_0x076f('0xe'));logger[_0x076f('0xf')](_0x076f('0x10'),_0xdd39cd,_0x076f('0xe'),JSON[_0x076f('0x11')](_0x57105c));if(_0x57105c[_0x076f('0x12')]){if(_0x57105c[_0x076f('0x12')][_0x076f('0x13')]===0x1f4){logger['error'](_0x076f('0xd'),_0xdd39cd,_0x57105c[_0x076f('0x12')][_0x076f('0x14')]);return _0x10d413(_0x57105c[_0x076f('0x12')][_0x076f('0x14')]);}logger[_0x076f('0x12')]('MailServerIn,\x20%s,\x20%s',_0xdd39cd,_0x57105c[_0x076f('0x12')][_0x076f('0x14')]);return _0x313738(_0x57105c[_0x076f('0x12')][_0x076f('0x14')]);}else{logger[_0x076f('0xc')]('MailServerIn,\x20%s,\x20%s',_0xdd39cd,'request\x20sent');_0x313738(_0x57105c[_0x076f('0x15')][_0x076f('0x14')]);}})[_0x076f('0x16')](function(_0x28fdae){logger[_0x076f('0x12')]('MailServerIn,\x20%s,\x20%s',_0xdd39cd,_0x28fdae);_0x10d413(_0x28fdae);});});}exports['GetMailServerIn']=function(_0x3a713d){var _0x5809ea=this;return new Promise(function(_0xd62c2c,_0x101957){return db[_0x076f('0x17')][_0x076f('0x18')]({'raw':_0x3a713d[_0x076f('0x19')]?_0x3a713d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a713d[_0x076f('0x19')]?_0x3a713d[_0x076f('0x19')][_0x076f('0x1a')]||null:null,'attributes':_0x3a713d['options']?_0x3a713d[_0x076f('0x19')]['attributes']||null:null,'limit':_0x3a713d[_0x076f('0x19')]?_0x3a713d[_0x076f('0x19')][_0x076f('0x1b')]||null:null,'include':_0x3a713d[_0x076f('0x19')]?_0x3a713d['options'][_0x076f('0x1c')]?_[_0x076f('0x1d')](_0x3a713d[_0x076f('0x19')][_0x076f('0x1c')],function(_0xbeef21){return{'model':db[_0xbeef21[_0x076f('0x1e')]],'as':_0xbeef21['as'],'attributes':_0xbeef21[_0x076f('0x1f')],'include':_0xbeef21[_0x076f('0x1c')]?_[_0x076f('0x1d')](_0xbeef21[_0x076f('0x1c')],function(_0x183373){return{'model':db[_0x183373[_0x076f('0x1e')]],'as':_0x183373['as'],'attributes':_0x183373[_0x076f('0x1f')],'include':_0x183373['include']?_[_0x076f('0x1d')](_0x183373[_0x076f('0x1c')],function(_0x7cc79c){return{'model':db[_0x7cc79c[_0x076f('0x1e')]],'as':_0x7cc79c['as'],'attributes':_0x7cc79c[_0x076f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x076f('0x20')](function(_0x4257b2){logger['info'](_0x076f('0x21'),_0x3a713d);logger['debug'](_0x076f('0x21'),_0x3a713d,JSON[_0x076f('0x11')](_0x4257b2));_0xd62c2c(_0x4257b2);})[_0x076f('0x16')](function(_0x5eaa78){logger[_0x076f('0x12')](_0x076f('0x21'),_0x5eaa78[_0x076f('0x14')],_0x3a713d);_0x101957(_0x5809ea[_0x076f('0x12')](0x1f4,_0x5eaa78['message']));});});};