Built motion from commit (unavailable).|2.5.5
[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 _0xfe61=['update','attributes','limit','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','debug','UpdateMailQueueReport'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0xfe61,0xb7));var _0x1fe6=function(_0x52c464,_0x2a3a8f){_0x52c464=_0x52c464-0x0;var _0x522836=_0xfe61[_0x52c464];return _0x522836;};'use strict';var _=require(_0x1fe6('0x0'));var util=require(_0x1fe6('0x1'));var moment=require('moment');var BPromise=require(_0x1fe6('0x2'));var rs=require(_0x1fe6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1fe6('0x4'));var logger=require(_0x1fe6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1fe6('0x6'));var client=jayson[_0x1fe6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x264999,_0x5c4cf1,_0x51211e){return new BPromise(function(_0x4d2e07,_0x4d6419){return client[_0x1fe6('0x8')](_0x264999,_0x51211e)[_0x1fe6('0x9')](function(_0xe31f5){logger[_0x1fe6('0xa')]('MailQueueReport,\x20%s,\x20%s',_0x5c4cf1,_0x1fe6('0xb'));logger['debug'](_0x1fe6('0xc'),_0x5c4cf1,_0x1fe6('0xb'),JSON[_0x1fe6('0xd')](_0xe31f5));if(_0xe31f5['error']){if(_0xe31f5[_0x1fe6('0xe')][_0x1fe6('0xf')]===0x1f4){logger[_0x1fe6('0xe')](_0x1fe6('0x10'),_0x5c4cf1,_0xe31f5[_0x1fe6('0xe')][_0x1fe6('0x11')]);return _0x4d6419(_0xe31f5['error']['message']);}logger['error'](_0x1fe6('0x10'),_0x5c4cf1,_0xe31f5[_0x1fe6('0xe')][_0x1fe6('0x11')]);return _0x4d2e07(_0xe31f5[_0x1fe6('0xe')][_0x1fe6('0x11')]);}else{logger[_0x1fe6('0xa')](_0x1fe6('0x10'),_0x5c4cf1,_0x1fe6('0xb'));_0x4d2e07(_0xe31f5['result'][_0x1fe6('0x11')]);}})[_0x1fe6('0x12')](function(_0x222ea1){logger['error'](_0x1fe6('0x10'),_0x5c4cf1,_0x222ea1);_0x4d6419(_0x222ea1);});});}exports[_0x1fe6('0x13')]=function(_0x3c99ab){var _0x40c4c3=this;return new Promise(function(_0x526009,_0x280dcd){return db[_0x1fe6('0x14')][_0x1fe6('0x15')](_0x3c99ab[_0x1fe6('0x16')],{'raw':_0x3c99ab[_0x1fe6('0x17')]?_0x3c99ab['options'][_0x1fe6('0x18')]===undefined?!![]:![]:!![]})[_0x1fe6('0x9')](function(_0x4a4e4e){logger[_0x1fe6('0xa')](_0x1fe6('0x13'),_0x3c99ab);logger[_0x1fe6('0x19')](_0x1fe6('0x13'),_0x3c99ab,JSON[_0x1fe6('0xd')](_0x4a4e4e));_0x526009(_0x4a4e4e);})[_0x1fe6('0x12')](function(_0x16382e){logger[_0x1fe6('0xe')](_0x1fe6('0x13'),_0x16382e['message'],_0x3c99ab);_0x280dcd(_0x40c4c3[_0x1fe6('0xe')](0x1f4,_0x16382e[_0x1fe6('0x11')]));});});};exports[_0x1fe6('0x1a')]=function(_0xf61c59){var _0x3041dc=this;return new Promise(function(_0x4a2422,_0x11d1b4){return db[_0x1fe6('0x14')][_0x1fe6('0x1b')](_0xf61c59['body'],{'raw':_0xf61c59['options']?_0xf61c59[_0x1fe6('0x17')][_0x1fe6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf61c59[_0x1fe6('0x17')]?_0xf61c59['options']['where']||null:null,'attributes':_0xf61c59[_0x1fe6('0x17')]?_0xf61c59[_0x1fe6('0x17')][_0x1fe6('0x1c')]||null:null,'limit':_0xf61c59[_0x1fe6('0x17')]?_0xf61c59[_0x1fe6('0x17')][_0x1fe6('0x1d')]||null:null})[_0x1fe6('0x9')](function(_0x18f4a5){logger[_0x1fe6('0xa')](_0x1fe6('0x1a'),_0xf61c59);logger[_0x1fe6('0x19')](_0x1fe6('0x1a'),_0xf61c59,JSON[_0x1fe6('0xd')](_0x18f4a5));_0x4a2422(_0x18f4a5);})[_0x1fe6('0x12')](function(_0x391eb0){logger['error'](_0x1fe6('0x1a'),_0x391eb0[_0x1fe6('0x11')],_0xf61c59);_0x11d1b4(_0x3041dc['error'](0x1f4,_0x391eb0[_0x1fe6('0x11')]));});});};