Built motion from commit 616d3211.|2.6.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 _0x5312=['result','UpdateMailApplication','MailApplication','update','body','options','raw','limit','debug','catch','lodash','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3ac75c,_0x304058){var _0x141d7b=function(_0x1abed4){while(--_0x1abed4){_0x3ac75c['push'](_0x3ac75c['shift']());}};_0x141d7b(++_0x304058);}(_0x5312,0x96));var _0x2531=function(_0x474d35,_0x33fa5e){_0x474d35=_0x474d35-0x0;var _0x33f9df=_0x5312[_0x474d35];return _0x33f9df;};'use strict';var _=require(_0x2531('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2531('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2531('0x2'))['db'];var utils=require(_0x2531('0x3'));var logger=require('../../config/logger')(_0x2531('0x4'));var config=require(_0x2531('0x5'));var jayson=require(_0x2531('0x6'));var client=jayson[_0x2531('0x7')][_0x2531('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52c508,_0x43d4f8,_0x2cb691){return new BPromise(function(_0x413777,_0xa0dc53){return client['request'](_0x52c508,_0x2cb691)[_0x2531('0x9')](function(_0x57ee8e){logger[_0x2531('0xa')](_0x2531('0xb'),_0x43d4f8,_0x2531('0xc'));logger['debug'](_0x2531('0xd'),_0x43d4f8,_0x2531('0xc'),JSON[_0x2531('0xe')](_0x57ee8e));if(_0x57ee8e[_0x2531('0xf')]){if(_0x57ee8e[_0x2531('0xf')][_0x2531('0x10')]===0x1f4){logger[_0x2531('0xf')](_0x2531('0xb'),_0x43d4f8,_0x57ee8e[_0x2531('0xf')][_0x2531('0x11')]);return _0xa0dc53(_0x57ee8e['error'][_0x2531('0x11')]);}logger['error'](_0x2531('0xb'),_0x43d4f8,_0x57ee8e[_0x2531('0xf')][_0x2531('0x11')]);return _0x413777(_0x57ee8e['error'][_0x2531('0x11')]);}else{logger['info'](_0x2531('0xb'),_0x43d4f8,_0x2531('0xc'));_0x413777(_0x57ee8e[_0x2531('0x12')][_0x2531('0x11')]);}})['catch'](function(_0xebec45){logger[_0x2531('0xf')](_0x2531('0xb'),_0x43d4f8,_0xebec45);_0xa0dc53(_0xebec45);});});}exports[_0x2531('0x13')]=function(_0x147666){var _0x535b12=this;return new Promise(function(_0x390a26,_0x1633e0){return db[_0x2531('0x14')][_0x2531('0x15')](_0x147666[_0x2531('0x16')],{'raw':_0x147666[_0x2531('0x17')]?_0x147666[_0x2531('0x17')][_0x2531('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x147666[_0x2531('0x17')]?_0x147666[_0x2531('0x17')]['where']||null:null,'attributes':_0x147666[_0x2531('0x17')]?_0x147666['options']['attributes']||null:null,'limit':_0x147666[_0x2531('0x17')]?_0x147666[_0x2531('0x17')][_0x2531('0x19')]||null:null})[_0x2531('0x9')](function(_0xebfb8){logger[_0x2531('0xa')](_0x2531('0x13'),_0x147666);logger[_0x2531('0x1a')](_0x2531('0x13'),_0x147666,JSON['stringify'](_0xebfb8));_0x390a26(_0xebfb8);})[_0x2531('0x1b')](function(_0x54410e){logger[_0x2531('0xf')]('UpdateMailApplication',_0x54410e[_0x2531('0x11')],_0x147666);_0x1633e0(_0x535b12[_0x2531('0xf')](0x1f4,_0x54410e[_0x2531('0x11')]));});});};