Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / mailApplication / mailApplication.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 _0xceb6=['client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','options','where','attributes','limit','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xceb6,0xf5));var _0x6ceb=function(_0x3d5cab,_0x5cf978){_0x3d5cab=_0x3d5cab-0x0;var _0x4527c1=_0xceb6[_0x3d5cab];return _0x4527c1;};'use strict';var _=require('lodash');var util=require(_0x6ceb('0x0'));var moment=require(_0x6ceb('0x1'));var BPromise=require(_0x6ceb('0x2'));var rs=require(_0x6ceb('0x3'));var fs=require('fs');var Redis=require(_0x6ceb('0x4'));var db=require(_0x6ceb('0x5'))['db'];var utils=require(_0x6ceb('0x6'));var logger=require(_0x6ceb('0x7'))(_0x6ceb('0x8'));var config=require(_0x6ceb('0x9'));var jayson=require(_0x6ceb('0xa'));var client=jayson[_0x6ceb('0xb')][_0x6ceb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5457b7,_0x806029,_0x454d79){return new BPromise(function(_0x55abca,_0x3e55b7){return client[_0x6ceb('0xd')](_0x5457b7,_0x454d79)[_0x6ceb('0xe')](function(_0x44ebc9){logger['info'](_0x6ceb('0xf'),_0x806029,_0x6ceb('0x10'));logger['debug'](_0x6ceb('0x11'),_0x806029,_0x6ceb('0x10'),JSON[_0x6ceb('0x12')](_0x44ebc9));if(_0x44ebc9[_0x6ceb('0x13')]){if(_0x44ebc9[_0x6ceb('0x13')][_0x6ceb('0x14')]===0x1f4){logger['error'](_0x6ceb('0xf'),_0x806029,_0x44ebc9[_0x6ceb('0x13')]['message']);return _0x3e55b7(_0x44ebc9['error'][_0x6ceb('0x15')]);}logger[_0x6ceb('0x13')]('MailApplication,\x20%s,\x20%s',_0x806029,_0x44ebc9[_0x6ceb('0x13')][_0x6ceb('0x15')]);return _0x55abca(_0x44ebc9['error']['message']);}else{logger[_0x6ceb('0x16')](_0x6ceb('0xf'),_0x806029,_0x6ceb('0x10'));_0x55abca(_0x44ebc9[_0x6ceb('0x17')][_0x6ceb('0x15')]);}})[_0x6ceb('0x18')](function(_0x12484c){logger[_0x6ceb('0x13')]('MailApplication,\x20%s,\x20%s',_0x806029,_0x12484c);_0x3e55b7(_0x12484c);});});}exports[_0x6ceb('0x19')]=function(_0x443f63){var _0x277736=this;return new Promise(function(_0x474a26,_0x4db47e){return db[_0x6ceb('0x1a')]['update'](_0x443f63['body'],{'raw':_0x443f63[_0x6ceb('0x1b')]?_0x443f63['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x443f63[_0x6ceb('0x1b')]?_0x443f63['options'][_0x6ceb('0x1c')]||null:null,'attributes':_0x443f63[_0x6ceb('0x1b')]?_0x443f63[_0x6ceb('0x1b')][_0x6ceb('0x1d')]||null:null,'limit':_0x443f63[_0x6ceb('0x1b')]?_0x443f63[_0x6ceb('0x1b')][_0x6ceb('0x1e')]||null:null})[_0x6ceb('0xe')](function(_0x115130){logger[_0x6ceb('0x16')](_0x6ceb('0x19'),_0x443f63);logger[_0x6ceb('0x1f')](_0x6ceb('0x19'),_0x443f63,JSON[_0x6ceb('0x12')](_0x115130));_0x474a26(_0x115130);})['catch'](function(_0x5f1052){logger['error'](_0x6ceb('0x19'),_0x5f1052[_0x6ceb('0x15')],_0x443f63);_0x4db47e(_0x277736[_0x6ceb('0x13')](0x1f4,_0x5f1052[_0x6ceb('0x15')]));});});};