Built motion from commit 10af8726.|2.6.34
[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 _0x5271=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','debug','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x56a008,_0x3448b6){var _0xf56f47=function(_0x4d9f99){while(--_0x4d9f99){_0x56a008['push'](_0x56a008['shift']());}};_0xf56f47(++_0x3448b6);}(_0x5271,0xa0));var _0x1527=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x5271[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x1527('0x0'));var util=require('util');var moment=require(_0x1527('0x1'));var BPromise=require(_0x1527('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1527('0x3'));var db=require(_0x1527('0x4'))['db'];var utils=require(_0x1527('0x5'));var logger=require(_0x1527('0x6'))('rpc');var config=require(_0x1527('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1527('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b35a6,_0x1100ce,_0x560d05){return new BPromise(function(_0x3c6cbf,_0xe62229){return client[_0x1527('0x9')](_0x5b35a6,_0x560d05)[_0x1527('0xa')](function(_0x68f9ce){logger[_0x1527('0xb')](_0x1527('0xc'),_0x1100ce,_0x1527('0xd'));logger['debug'](_0x1527('0xe'),_0x1100ce,'request\x20sent',JSON[_0x1527('0xf')](_0x68f9ce));if(_0x68f9ce[_0x1527('0x10')]){if(_0x68f9ce[_0x1527('0x10')][_0x1527('0x11')]===0x1f4){logger[_0x1527('0x10')](_0x1527('0xc'),_0x1100ce,_0x68f9ce['error'][_0x1527('0x12')]);return _0xe62229(_0x68f9ce[_0x1527('0x10')][_0x1527('0x12')]);}logger[_0x1527('0x10')](_0x1527('0xc'),_0x1100ce,_0x68f9ce[_0x1527('0x10')][_0x1527('0x12')]);return _0x3c6cbf(_0x68f9ce[_0x1527('0x10')][_0x1527('0x12')]);}else{logger[_0x1527('0xb')](_0x1527('0xc'),_0x1100ce,_0x1527('0xd'));_0x3c6cbf(_0x68f9ce[_0x1527('0x13')]['message']);}})[_0x1527('0x14')](function(_0x1c8786){logger['error'](_0x1527('0xc'),_0x1100ce,_0x1c8786);_0xe62229(_0x1c8786);});});}exports['GetMailServerIn']=function(_0x4eed10){var _0x326e0b=this;return new Promise(function(_0x195a26,_0x592d5a){return db[_0x1527('0x15')][_0x1527('0x16')]({'raw':_0x4eed10['options']?_0x4eed10[_0x1527('0x17')][_0x1527('0x18')]===undefined?!![]:![]:!![],'where':_0x4eed10['options']?_0x4eed10[_0x1527('0x17')][_0x1527('0x19')]||null:null,'attributes':_0x4eed10['options']?_0x4eed10['options'][_0x1527('0x1a')]||null:null,'limit':_0x4eed10[_0x1527('0x17')]?_0x4eed10[_0x1527('0x17')][_0x1527('0x1b')]||null:null,'include':_0x4eed10[_0x1527('0x17')]?_0x4eed10[_0x1527('0x17')][_0x1527('0x1c')]?_[_0x1527('0x1d')](_0x4eed10['options'][_0x1527('0x1c')],function(_0xa46055){return{'model':db[_0xa46055[_0x1527('0x1e')]],'as':_0xa46055['as'],'attributes':_0xa46055[_0x1527('0x1a')],'include':_0xa46055['include']?_['map'](_0xa46055[_0x1527('0x1c')],function(_0x5e943e){return{'model':db[_0x5e943e[_0x1527('0x1e')]],'as':_0x5e943e['as'],'attributes':_0x5e943e[_0x1527('0x1a')],'include':_0x5e943e[_0x1527('0x1c')]?_['map'](_0x5e943e[_0x1527('0x1c')],function(_0x55cbb6){return{'model':db[_0x55cbb6[_0x1527('0x1e')]],'as':_0x55cbb6['as'],'attributes':_0x55cbb6['attributes']};}):[]};}):[]};}):[]:[]})[_0x1527('0xa')](function(_0x5f1fa9){logger[_0x1527('0xb')](_0x1527('0x1f'),_0x4eed10);logger[_0x1527('0x20')](_0x1527('0x1f'),_0x4eed10,JSON[_0x1527('0xf')](_0x5f1fa9));_0x195a26(_0x5f1fa9);})[_0x1527('0x14')](function(_0x1a02e5){logger['error'](_0x1527('0x1f'),_0x1a02e5[_0x1527('0x12')],_0x4eed10);_0x592d5a(_0x326e0b[_0x1527('0x10')](0x1f4,_0x1a02e5[_0x1527('0x12')]));});});};