Built motion from commit (unavailable).|2.5.4
[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 _0xbf7c=['then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4c5a52,_0x59ef62){var _0x5b40f5=function(_0x4eb274){while(--_0x4eb274){_0x4c5a52['push'](_0x4c5a52['shift']());}};_0x5b40f5(++_0x59ef62);}(_0xbf7c,0x7e));var _0xcbf7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbf7c[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xcbf7('0x0'));var util=require(_0xcbf7('0x1'));var moment=require(_0xcbf7('0x2'));var BPromise=require(_0xcbf7('0x3'));var rs=require(_0xcbf7('0x4'));var fs=require('fs');var Redis=require(_0xcbf7('0x5'));var db=require(_0xcbf7('0x6'))['db'];var utils=require(_0xcbf7('0x7'));var logger=require('../../config/logger')(_0xcbf7('0x8'));var config=require(_0xcbf7('0x9'));var jayson=require(_0xcbf7('0xa'));var client=jayson[_0xcbf7('0xb')][_0xcbf7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbf20fd,_0x5b4f8c,_0x2b1da2){return new BPromise(function(_0xd4027d,_0x46a8d2){return client[_0xcbf7('0xd')](_0xbf20fd,_0x2b1da2)[_0xcbf7('0xe')](function(_0x40d2d3){logger['info'](_0xcbf7('0xf'),_0x5b4f8c,'request\x20sent');logger['debug'](_0xcbf7('0x10'),_0x5b4f8c,_0xcbf7('0x11'),JSON[_0xcbf7('0x12')](_0x40d2d3));if(_0x40d2d3[_0xcbf7('0x13')]){if(_0x40d2d3[_0xcbf7('0x13')][_0xcbf7('0x14')]===0x1f4){logger[_0xcbf7('0x13')]('MailApplication,\x20%s,\x20%s',_0x5b4f8c,_0x40d2d3['error']['message']);return _0x46a8d2(_0x40d2d3[_0xcbf7('0x13')][_0xcbf7('0x15')]);}logger['error'](_0xcbf7('0xf'),_0x5b4f8c,_0x40d2d3[_0xcbf7('0x13')][_0xcbf7('0x15')]);return _0xd4027d(_0x40d2d3[_0xcbf7('0x13')][_0xcbf7('0x15')]);}else{logger['info'](_0xcbf7('0xf'),_0x5b4f8c,_0xcbf7('0x11'));_0xd4027d(_0x40d2d3[_0xcbf7('0x16')][_0xcbf7('0x15')]);}})[_0xcbf7('0x17')](function(_0x3811ac){logger[_0xcbf7('0x13')]('MailApplication,\x20%s,\x20%s',_0x5b4f8c,_0x3811ac);_0x46a8d2(_0x3811ac);});});}exports[_0xcbf7('0x18')]=function(_0x521520){var _0x4bf839=this;return new Promise(function(_0x2932f4,_0x523c57){return db['MailApplication'][_0xcbf7('0x19')](_0x521520['body'],{'raw':_0x521520[_0xcbf7('0x1a')]?_0x521520[_0xcbf7('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x521520['options']?_0x521520[_0xcbf7('0x1a')][_0xcbf7('0x1b')]||null:null,'attributes':_0x521520['options']?_0x521520['options']['attributes']||null:null,'limit':_0x521520['options']?_0x521520[_0xcbf7('0x1a')]['limit']||null:null})[_0xcbf7('0xe')](function(_0x3b51bd){logger['info'](_0xcbf7('0x18'),_0x521520);logger['debug'](_0xcbf7('0x18'),_0x521520,JSON[_0xcbf7('0x12')](_0x3b51bd));_0x2932f4(_0x3b51bd);})[_0xcbf7('0x17')](function(_0x549d42){logger[_0xcbf7('0x13')]('UpdateMailApplication',_0x549d42[_0xcbf7('0x15')],_0x521520);_0x523c57(_0x4bf839[_0xcbf7('0x13')](0x1f4,_0x549d42[_0xcbf7('0x15')]));});});};