042e9ddf4d55c5033cc4b0c20ce6f10d1f61318f
[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 _0x2379=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','request\x20sent','result','MailServerIn','findAll','raw','options','where','include','map','attributes','debug','catch','GetMailServerIn','bluebird','randomstring'];(function(_0x25a3ec,_0x219fc9){var _0x42020a=function(_0x17e82c){while(--_0x17e82c){_0x25a3ec['push'](_0x25a3ec['shift']());}};_0x42020a(++_0x219fc9);}(_0x2379,0x82));var _0x9237=function(_0x183a1e,_0x2501f8){_0x183a1e=_0x183a1e-0x0;var _0x43fc33=_0x2379[_0x183a1e];return _0x43fc33;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9237('0x0'));var rs=require(_0x9237('0x1'));var fs=require('fs');var Redis=require(_0x9237('0x2'));var db=require(_0x9237('0x3'))['db'];var utils=require(_0x9237('0x4'));var logger=require(_0x9237('0x5'))(_0x9237('0x6'));var config=require(_0x9237('0x7'));var jayson=require(_0x9237('0x8'));var client=jayson[_0x9237('0x9')][_0x9237('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f5692,_0x4c961a,_0x3895f9){return new BPromise(function(_0x14d42f,_0x460dff){return client[_0x9237('0xb')](_0x5f5692,_0x3895f9)[_0x9237('0xc')](function(_0x227265){logger[_0x9237('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4c961a,'request\x20sent');logger['debug'](_0x9237('0xe'),_0x4c961a,'request\x20sent',JSON[_0x9237('0xf')](_0x227265));if(_0x227265[_0x9237('0x10')]){if(_0x227265[_0x9237('0x10')][_0x9237('0x11')]===0x1f4){logger['error'](_0x9237('0x12'),_0x4c961a,_0x227265['error']['message']);return _0x460dff(_0x227265[_0x9237('0x10')][_0x9237('0x13')]);}logger[_0x9237('0x10')](_0x9237('0x12'),_0x4c961a,_0x227265['error'][_0x9237('0x13')]);return _0x14d42f(_0x227265[_0x9237('0x10')]['message']);}else{logger[_0x9237('0xd')](_0x9237('0x12'),_0x4c961a,_0x9237('0x14'));_0x14d42f(_0x227265[_0x9237('0x15')]['message']);}})['catch'](function(_0x36666f){logger['error']('MailServerIn,\x20%s,\x20%s',_0x4c961a,_0x36666f);_0x460dff(_0x36666f);});});}exports['GetMailServerIn']=function(_0x1ff34b){var _0x48fe14=this;return new Promise(function(_0x427404,_0x14128e){return db[_0x9237('0x16')][_0x9237('0x17')]({'raw':_0x1ff34b['options']?_0x1ff34b['options'][_0x9237('0x18')]===undefined?!![]:![]:!![],'where':_0x1ff34b[_0x9237('0x19')]?_0x1ff34b[_0x9237('0x19')][_0x9237('0x1a')]||null:null,'attributes':_0x1ff34b[_0x9237('0x19')]?_0x1ff34b[_0x9237('0x19')]['attributes']||null:null,'limit':_0x1ff34b[_0x9237('0x19')]?_0x1ff34b[_0x9237('0x19')]['limit']||null:null,'include':_0x1ff34b['options']?_0x1ff34b[_0x9237('0x19')][_0x9237('0x1b')]?_[_0x9237('0x1c')](_0x1ff34b['options'][_0x9237('0x1b')],function(_0x4007b5){return{'model':db[_0x4007b5['model']],'as':_0x4007b5['as'],'attributes':_0x4007b5[_0x9237('0x1d')],'include':_0x4007b5[_0x9237('0x1b')]?_[_0x9237('0x1c')](_0x4007b5[_0x9237('0x1b')],function(_0x21fcc9){return{'model':db[_0x21fcc9['model']],'as':_0x21fcc9['as'],'attributes':_0x21fcc9[_0x9237('0x1d')],'include':_0x21fcc9[_0x9237('0x1b')]?_[_0x9237('0x1c')](_0x21fcc9[_0x9237('0x1b')],function(_0x561be9){return{'model':db[_0x561be9['model']],'as':_0x561be9['as'],'attributes':_0x561be9[_0x9237('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9237('0xc')](function(_0x250dd4){logger[_0x9237('0xd')]('GetMailServerIn',_0x1ff34b);logger[_0x9237('0x1e')]('GetMailServerIn',_0x1ff34b,JSON[_0x9237('0xf')](_0x250dd4));_0x427404(_0x250dd4);})[_0x9237('0x1f')](function(_0x58025e){logger[_0x9237('0x10')](_0x9237('0x20'),_0x58025e[_0x9237('0x13')],_0x1ff34b);_0x14128e(_0x48fe14[_0x9237('0x10')](0x1f4,_0x58025e[_0x9237('0x13')]));});});};