Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / mailQueueReport / mailQueueReport.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 _0xd47f=['MailQueueReport,\x20%s,\x20%s','message','result','CreateMailQueueReport','MailQueueReport','create','body','options','raw','catch','UpdateMailQueueReport','where','attributes','limit','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d830b,_0x27f78d){var _0x238c89=function(_0x3eead9){while(--_0x3eead9){_0x4d830b['push'](_0x4d830b['shift']());}};_0x238c89(++_0x27f78d);}(_0xd47f,0x6b));var _0xfd47=function(_0x29107e,_0x26c7e7){_0x29107e=_0x29107e-0x0;var _0x55e177=_0xd47f[_0x29107e];return _0x55e177;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd47('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd47('0x1'))['db'];var utils=require(_0xfd47('0x2'));var logger=require(_0xfd47('0x3'))(_0xfd47('0x4'));var config=require('../../config/environment');var jayson=require(_0xfd47('0x5'));var client=jayson[_0xfd47('0x6')][_0xfd47('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d6f87,_0x2306ad,_0x2b7115){return new BPromise(function(_0x18a0ac,_0x1ab300){return client[_0xfd47('0x8')](_0x3d6f87,_0x2b7115)[_0xfd47('0x9')](function(_0x8d5a0){logger[_0xfd47('0xa')]('MailQueueReport,\x20%s,\x20%s',_0x2306ad,_0xfd47('0xb'));logger[_0xfd47('0xc')](_0xfd47('0xd'),_0x2306ad,_0xfd47('0xb'),JSON[_0xfd47('0xe')](_0x8d5a0));if(_0x8d5a0['error']){if(_0x8d5a0[_0xfd47('0xf')][_0xfd47('0x10')]===0x1f4){logger[_0xfd47('0xf')](_0xfd47('0x11'),_0x2306ad,_0x8d5a0[_0xfd47('0xf')][_0xfd47('0x12')]);return _0x1ab300(_0x8d5a0[_0xfd47('0xf')]['message']);}logger[_0xfd47('0xf')](_0xfd47('0x11'),_0x2306ad,_0x8d5a0[_0xfd47('0xf')][_0xfd47('0x12')]);return _0x18a0ac(_0x8d5a0[_0xfd47('0xf')]['message']);}else{logger[_0xfd47('0xa')]('MailQueueReport,\x20%s,\x20%s',_0x2306ad,_0xfd47('0xb'));_0x18a0ac(_0x8d5a0[_0xfd47('0x13')][_0xfd47('0x12')]);}})['catch'](function(_0x1e9001){logger[_0xfd47('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x2306ad,_0x1e9001);_0x1ab300(_0x1e9001);});});}exports[_0xfd47('0x14')]=function(_0x1c32c6){var _0x15e98a=this;return new Promise(function(_0x227179,_0x38f956){return db[_0xfd47('0x15')][_0xfd47('0x16')](_0x1c32c6[_0xfd47('0x17')],{'raw':_0x1c32c6[_0xfd47('0x18')]?_0x1c32c6[_0xfd47('0x18')][_0xfd47('0x19')]===undefined?!![]:![]:!![]})[_0xfd47('0x9')](function(_0x10309e){logger[_0xfd47('0xa')](_0xfd47('0x14'),_0x1c32c6);logger[_0xfd47('0xc')](_0xfd47('0x14'),_0x1c32c6,JSON[_0xfd47('0xe')](_0x10309e));_0x227179(_0x10309e);})[_0xfd47('0x1a')](function(_0x470f41){logger[_0xfd47('0xf')]('CreateMailQueueReport',_0x470f41[_0xfd47('0x12')],_0x1c32c6);_0x38f956(_0x15e98a[_0xfd47('0xf')](0x1f4,_0x470f41[_0xfd47('0x12')]));});});};exports[_0xfd47('0x1b')]=function(_0xc5cc39){var _0x4a19d4=this;return new Promise(function(_0x35fb64,_0x25b79a){return db[_0xfd47('0x15')]['update'](_0xc5cc39[_0xfd47('0x17')],{'raw':_0xc5cc39['options']?_0xc5cc39['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc5cc39[_0xfd47('0x18')]?_0xc5cc39[_0xfd47('0x18')][_0xfd47('0x1c')]||null:null,'attributes':_0xc5cc39[_0xfd47('0x18')]?_0xc5cc39['options'][_0xfd47('0x1d')]||null:null,'limit':_0xc5cc39[_0xfd47('0x18')]?_0xc5cc39[_0xfd47('0x18')][_0xfd47('0x1e')]||null:null})[_0xfd47('0x9')](function(_0x5edb8f){logger[_0xfd47('0xa')](_0xfd47('0x1b'),_0xc5cc39);logger[_0xfd47('0xc')](_0xfd47('0x1b'),_0xc5cc39,JSON[_0xfd47('0xe')](_0x5edb8f));_0x35fb64(_0x5edb8f);})[_0xfd47('0x1a')](function(_0x4ebc4b){logger[_0xfd47('0xf')](_0xfd47('0x1b'),_0x4ebc4b['message'],_0xc5cc39);_0x25b79a(_0x4a19d4['error'](0x1f4,_0x4ebc4b[_0xfd47('0x12')]));});});};