Built motion from commit (unavailable).|2.5.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 _0x267e=['model','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include'];(function(_0xd71a41,_0x59c071){var _0x2347e8=function(_0x341351){while(--_0x341351){_0xd71a41['push'](_0xd71a41['shift']());}};_0x2347e8(++_0x59c071);}(_0x267e,0xa2));var _0xe267=function(_0x36deb9,_0x18bc47){_0x36deb9=_0x36deb9-0x0;var _0x4a2f53=_0x267e[_0x36deb9];return _0x4a2f53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe267('0x0'));var BPromise=require(_0xe267('0x1'));var rs=require(_0xe267('0x2'));var fs=require('fs');var Redis=require(_0xe267('0x3'));var db=require(_0xe267('0x4'))['db'];var utils=require(_0xe267('0x5'));var logger=require(_0xe267('0x6'))(_0xe267('0x7'));var config=require(_0xe267('0x8'));var jayson=require(_0xe267('0x9'));var client=jayson[_0xe267('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42b764,_0x1b2f17,_0x398ff1){return new BPromise(function(_0x53a7ce,_0x33930b){return client['request'](_0x42b764,_0x398ff1)['then'](function(_0xc2ae4c){logger[_0xe267('0xb')](_0xe267('0xc'),_0x1b2f17,_0xe267('0xd'));logger[_0xe267('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1b2f17,_0xe267('0xd'),JSON[_0xe267('0xf')](_0xc2ae4c));if(_0xc2ae4c['error']){if(_0xc2ae4c[_0xe267('0x10')][_0xe267('0x11')]===0x1f4){logger['error'](_0xe267('0xc'),_0x1b2f17,_0xc2ae4c['error'][_0xe267('0x12')]);return _0x33930b(_0xc2ae4c[_0xe267('0x10')]['message']);}logger[_0xe267('0x10')]('MailServerIn,\x20%s,\x20%s',_0x1b2f17,_0xc2ae4c[_0xe267('0x10')]['message']);return _0x53a7ce(_0xc2ae4c['error'][_0xe267('0x12')]);}else{logger[_0xe267('0xb')](_0xe267('0xc'),_0x1b2f17,'request\x20sent');_0x53a7ce(_0xc2ae4c['result']['message']);}})[_0xe267('0x13')](function(_0x3dcac6){logger[_0xe267('0x10')](_0xe267('0xc'),_0x1b2f17,_0x3dcac6);_0x33930b(_0x3dcac6);});});}exports[_0xe267('0x14')]=function(_0x56d493){var _0x4097f3=this;return new Promise(function(_0x10efa4,_0x521d18){return db[_0xe267('0x15')][_0xe267('0x16')]({'raw':_0x56d493[_0xe267('0x17')]?_0x56d493[_0xe267('0x17')][_0xe267('0x18')]===undefined?!![]:![]:!![],'where':_0x56d493['options']?_0x56d493[_0xe267('0x17')][_0xe267('0x19')]||null:null,'attributes':_0x56d493['options']?_0x56d493[_0xe267('0x17')][_0xe267('0x1a')]||null:null,'limit':_0x56d493[_0xe267('0x17')]?_0x56d493[_0xe267('0x17')][_0xe267('0x1b')]||null:null,'include':_0x56d493['options']?_0x56d493['options']['include']?_[_0xe267('0x1c')](_0x56d493['options'][_0xe267('0x1d')],function(_0x3b6047){return{'model':db[_0x3b6047[_0xe267('0x1e')]],'as':_0x3b6047['as'],'attributes':_0x3b6047['attributes'],'include':_0x3b6047[_0xe267('0x1d')]?_[_0xe267('0x1c')](_0x3b6047['include'],function(_0x46f7b6){return{'model':db[_0x46f7b6['model']],'as':_0x46f7b6['as'],'attributes':_0x46f7b6[_0xe267('0x1a')],'include':_0x46f7b6[_0xe267('0x1d')]?_[_0xe267('0x1c')](_0x46f7b6['include'],function(_0xbb1fcb){return{'model':db[_0xbb1fcb[_0xe267('0x1e')]],'as':_0xbb1fcb['as'],'attributes':_0xbb1fcb['attributes']};}):[]};}):[]};}):[]:[]})[_0xe267('0x1f')](function(_0x43a296){logger[_0xe267('0xb')](_0xe267('0x14'),_0x56d493);logger[_0xe267('0xe')](_0xe267('0x14'),_0x56d493,JSON[_0xe267('0xf')](_0x43a296));_0x10efa4(_0x43a296);})[_0xe267('0x13')](function(_0x48fa82){logger[_0xe267('0x10')](_0xe267('0x14'),_0x48fa82[_0xe267('0x12')],_0x56d493);_0x521d18(_0x4097f3[_0xe267('0x10')](0x1f4,_0x48fa82['message']));});});};