Built motion from commit (unavailable).|2.5.21
[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 _0x8885=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','update','where','attributes','UpdateMailQueueReport','lodash','moment'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0x8885,0xde));var _0x5888=function(_0x4f1cc2,_0x288391){_0x4f1cc2=_0x4f1cc2-0x0;var _0x403478=_0x8885[_0x4f1cc2];return _0x403478;};'use strict';var _=require(_0x5888('0x0'));var util=require('util');var moment=require(_0x5888('0x1'));var BPromise=require(_0x5888('0x2'));var rs=require(_0x5888('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5888('0x4'))['db'];var utils=require(_0x5888('0x5'));var logger=require(_0x5888('0x6'))(_0x5888('0x7'));var config=require('../../config/environment');var jayson=require(_0x5888('0x8'));var client=jayson[_0x5888('0x9')][_0x5888('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x173221,_0x2e77dd,_0x99c55d){return new BPromise(function(_0x5612c4,_0x5791a0){return client['request'](_0x173221,_0x99c55d)[_0x5888('0xb')](function(_0x19197e){logger[_0x5888('0xc')](_0x5888('0xd'),_0x2e77dd,_0x5888('0xe'));logger[_0x5888('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x2e77dd,_0x5888('0xe'),JSON[_0x5888('0x10')](_0x19197e));if(_0x19197e['error']){if(_0x19197e['error'][_0x5888('0x11')]===0x1f4){logger[_0x5888('0x12')](_0x5888('0xd'),_0x2e77dd,_0x19197e[_0x5888('0x12')][_0x5888('0x13')]);return _0x5791a0(_0x19197e[_0x5888('0x12')][_0x5888('0x13')]);}logger['error'](_0x5888('0xd'),_0x2e77dd,_0x19197e['error'][_0x5888('0x13')]);return _0x5612c4(_0x19197e[_0x5888('0x12')][_0x5888('0x13')]);}else{logger['info'](_0x5888('0xd'),_0x2e77dd,'request\x20sent');_0x5612c4(_0x19197e[_0x5888('0x14')][_0x5888('0x13')]);}})[_0x5888('0x15')](function(_0x30cdd6){logger[_0x5888('0x12')](_0x5888('0xd'),_0x2e77dd,_0x30cdd6);_0x5791a0(_0x30cdd6);});});}exports[_0x5888('0x16')]=function(_0x117e3c){var _0x2bd31d=this;return new Promise(function(_0x116b24,_0x5f0de9){return db[_0x5888('0x17')][_0x5888('0x18')](_0x117e3c[_0x5888('0x19')],{'raw':_0x117e3c[_0x5888('0x1a')]?_0x117e3c[_0x5888('0x1a')][_0x5888('0x1b')]===undefined?!![]:![]:!![]})[_0x5888('0xb')](function(_0x5aec1b){logger[_0x5888('0xc')](_0x5888('0x16'),_0x117e3c);logger[_0x5888('0xf')](_0x5888('0x16'),_0x117e3c,JSON[_0x5888('0x10')](_0x5aec1b));_0x116b24(_0x5aec1b);})[_0x5888('0x15')](function(_0x14353d){logger[_0x5888('0x12')](_0x5888('0x16'),_0x14353d[_0x5888('0x13')],_0x117e3c);_0x5f0de9(_0x2bd31d[_0x5888('0x12')](0x1f4,_0x14353d[_0x5888('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x28b8d9){var _0x463c80=this;return new Promise(function(_0x5f028f,_0x1705d9){return db['MailQueueReport'][_0x5888('0x1c')](_0x28b8d9['body'],{'raw':_0x28b8d9[_0x5888('0x1a')]?_0x28b8d9['options'][_0x5888('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28b8d9['options']?_0x28b8d9['options'][_0x5888('0x1d')]||null:null,'attributes':_0x28b8d9[_0x5888('0x1a')]?_0x28b8d9[_0x5888('0x1a')][_0x5888('0x1e')]||null:null,'limit':_0x28b8d9[_0x5888('0x1a')]?_0x28b8d9[_0x5888('0x1a')]['limit']||null:null})[_0x5888('0xb')](function(_0x5ec923){logger[_0x5888('0xc')](_0x5888('0x1f'),_0x28b8d9);logger[_0x5888('0xf')](_0x5888('0x1f'),_0x28b8d9,JSON[_0x5888('0x10')](_0x5ec923));_0x5f028f(_0x5ec923);})['catch'](function(_0x51d98a){logger[_0x5888('0x12')](_0x5888('0x1f'),_0x51d98a[_0x5888('0x13')],_0x28b8d9);_0x1705d9(_0x463c80['error'](0x1f4,_0x51d98a[_0x5888('0x13')]));});});};