Built motion from commit e6806ed6.|2.6.0
[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 _0xfa7a=['message','MailServerIn,\x20%s,\x20%s','catch','MailServerIn','findAll','options','raw','attributes','map','include','model','then','GetMailServerIn','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57f959,_0x1d7fbc){var _0x107f05=function(_0x1c4e04){while(--_0x1c4e04){_0x57f959['push'](_0x57f959['shift']());}};_0x107f05(++_0x1d7fbc);}(_0xfa7a,0x1ed));var _0xafa7=function(_0x448122,_0x2f716a){_0x448122=_0x448122-0x0;var _0xaa173b=_0xfa7a[_0x448122];return _0xaa173b;};'use strict';var _=require(_0xafa7('0x0'));var util=require(_0xafa7('0x1'));var moment=require(_0xafa7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafa7('0x3'));var db=require(_0xafa7('0x4'))['db'];var utils=require(_0xafa7('0x5'));var logger=require(_0xafa7('0x6'))('rpc');var config=require(_0xafa7('0x7'));var jayson=require(_0xafa7('0x8'));var client=jayson[_0xafa7('0x9')][_0xafa7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fc26e,_0x91c971,_0x1d8552){return new BPromise(function(_0x41103b,_0x5a9b0c){return client[_0xafa7('0xb')](_0x2fc26e,_0x1d8552)['then'](function(_0x42f79b){logger[_0xafa7('0xc')]('MailServerIn,\x20%s,\x20%s',_0x91c971,_0xafa7('0xd'));logger[_0xafa7('0xe')](_0xafa7('0xf'),_0x91c971,_0xafa7('0xd'),JSON[_0xafa7('0x10')](_0x42f79b));if(_0x42f79b[_0xafa7('0x11')]){if(_0x42f79b[_0xafa7('0x11')][_0xafa7('0x12')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x91c971,_0x42f79b[_0xafa7('0x11')]['message']);return _0x5a9b0c(_0x42f79b[_0xafa7('0x11')][_0xafa7('0x13')]);}logger['error'](_0xafa7('0x14'),_0x91c971,_0x42f79b['error'][_0xafa7('0x13')]);return _0x41103b(_0x42f79b['error'][_0xafa7('0x13')]);}else{logger[_0xafa7('0xc')]('MailServerIn,\x20%s,\x20%s',_0x91c971,_0xafa7('0xd'));_0x41103b(_0x42f79b['result']['message']);}})[_0xafa7('0x15')](function(_0x58c121){logger[_0xafa7('0x11')]('MailServerIn,\x20%s,\x20%s',_0x91c971,_0x58c121);_0x5a9b0c(_0x58c121);});});}exports['GetMailServerIn']=function(_0x5e12e0){var _0x5881e3=this;return new Promise(function(_0x3f304b,_0x4bee88){return db[_0xafa7('0x16')][_0xafa7('0x17')]({'raw':_0x5e12e0[_0xafa7('0x18')]?_0x5e12e0['options'][_0xafa7('0x19')]===undefined?!![]:![]:!![],'where':_0x5e12e0['options']?_0x5e12e0[_0xafa7('0x18')]['where']||null:null,'attributes':_0x5e12e0[_0xafa7('0x18')]?_0x5e12e0[_0xafa7('0x18')][_0xafa7('0x1a')]||null:null,'limit':_0x5e12e0[_0xafa7('0x18')]?_0x5e12e0['options']['limit']||null:null,'include':_0x5e12e0[_0xafa7('0x18')]?_0x5e12e0[_0xafa7('0x18')]['include']?_[_0xafa7('0x1b')](_0x5e12e0['options']['include'],function(_0x2fefa3){return{'model':db[_0x2fefa3['model']],'as':_0x2fefa3['as'],'attributes':_0x2fefa3[_0xafa7('0x1a')],'include':_0x2fefa3[_0xafa7('0x1c')]?_[_0xafa7('0x1b')](_0x2fefa3[_0xafa7('0x1c')],function(_0x470aa5){return{'model':db[_0x470aa5[_0xafa7('0x1d')]],'as':_0x470aa5['as'],'attributes':_0x470aa5['attributes'],'include':_0x470aa5[_0xafa7('0x1c')]?_[_0xafa7('0x1b')](_0x470aa5[_0xafa7('0x1c')],function(_0x5c601a){return{'model':db[_0x5c601a['model']],'as':_0x5c601a['as'],'attributes':_0x5c601a[_0xafa7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafa7('0x1e')](function(_0x13d06e){logger[_0xafa7('0xc')](_0xafa7('0x1f'),_0x5e12e0);logger['debug'](_0xafa7('0x1f'),_0x5e12e0,JSON['stringify'](_0x13d06e));_0x3f304b(_0x13d06e);})[_0xafa7('0x15')](function(_0x200e13){logger[_0xafa7('0x11')]('GetMailServerIn',_0x200e13[_0xafa7('0x13')],_0x5e12e0);_0x4bee88(_0x5881e3['error'](0x1f4,_0x200e13[_0xafa7('0x13')]));});});};