3ec5b9fdde21646db2d3d11ce67f674d43990def
[motion2.git] / server / api / faxQueueReport / faxQueueReport.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 _0x55a6=['http','request','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','where','attributes','limit','debug','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c809b,_0x23f66e){var _0x48cb21=function(_0x521c69){while(--_0x521c69){_0x5c809b['push'](_0x5c809b['shift']());}};_0x48cb21(++_0x23f66e);}(_0x55a6,0x1d2));var _0x655a=function(_0x25b57c,_0x585294){_0x25b57c=_0x25b57c-0x0;var _0x5860ed=_0x55a6[_0x25b57c];return _0x5860ed;};'use strict';var _=require(_0x655a('0x0'));var util=require('util');var moment=require(_0x655a('0x1'));var BPromise=require(_0x655a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x655a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x655a('0x4'));var logger=require(_0x655a('0x5'))(_0x655a('0x6'));var config=require(_0x655a('0x7'));var jayson=require(_0x655a('0x8'));var client=jayson[_0x655a('0x9')][_0x655a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x252007,_0x300f26,_0x2be2ec){return new BPromise(function(_0x264caf,_0x6ab222){return client[_0x655a('0xb')](_0x252007,_0x2be2ec)[_0x655a('0xc')](function(_0x335e0d){logger[_0x655a('0xd')](_0x655a('0xe'),_0x300f26,'request\x20sent');logger['debug'](_0x655a('0xf'),_0x300f26,_0x655a('0x10'),JSON[_0x655a('0x11')](_0x335e0d));if(_0x335e0d['error']){if(_0x335e0d[_0x655a('0x12')][_0x655a('0x13')]===0x1f4){logger[_0x655a('0x12')](_0x655a('0xe'),_0x300f26,_0x335e0d[_0x655a('0x12')][_0x655a('0x14')]);return _0x6ab222(_0x335e0d[_0x655a('0x12')][_0x655a('0x14')]);}logger['error'](_0x655a('0xe'),_0x300f26,_0x335e0d[_0x655a('0x12')][_0x655a('0x14')]);return _0x264caf(_0x335e0d[_0x655a('0x12')][_0x655a('0x14')]);}else{logger[_0x655a('0xd')](_0x655a('0xe'),_0x300f26,_0x655a('0x10'));_0x264caf(_0x335e0d[_0x655a('0x15')][_0x655a('0x14')]);}})[_0x655a('0x16')](function(_0x355919){logger[_0x655a('0x12')](_0x655a('0xe'),_0x300f26,_0x355919);_0x6ab222(_0x355919);});});}exports[_0x655a('0x17')]=function(_0x490b0f){var _0x498ce4=this;return new Promise(function(_0x2ab30f,_0x4d70e6){return db[_0x655a('0x18')][_0x655a('0x19')](_0x490b0f[_0x655a('0x1a')],{'raw':_0x490b0f[_0x655a('0x1b')]?_0x490b0f[_0x655a('0x1b')][_0x655a('0x1c')]===undefined?!![]:![]:!![]})[_0x655a('0xc')](function(_0x1f72e8){logger[_0x655a('0xd')]('CreateFaxQueueReport',_0x490b0f);logger['debug'](_0x655a('0x17'),_0x490b0f,JSON[_0x655a('0x11')](_0x1f72e8));_0x2ab30f(_0x1f72e8);})['catch'](function(_0xb9e05a){logger[_0x655a('0x12')]('CreateFaxQueueReport',_0xb9e05a[_0x655a('0x14')],_0x490b0f);_0x4d70e6(_0x498ce4['error'](0x1f4,_0xb9e05a['message']));});});};exports[_0x655a('0x1d')]=function(_0x1af637){var _0x2eb423=this;return new Promise(function(_0x1c60b6,_0x28e046){return db[_0x655a('0x18')]['update'](_0x1af637[_0x655a('0x1a')],{'raw':_0x1af637[_0x655a('0x1b')]?_0x1af637['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af637['options']?_0x1af637[_0x655a('0x1b')][_0x655a('0x1e')]||null:null,'attributes':_0x1af637[_0x655a('0x1b')]?_0x1af637['options'][_0x655a('0x1f')]||null:null,'limit':_0x1af637['options']?_0x1af637[_0x655a('0x1b')][_0x655a('0x20')]||null:null})[_0x655a('0xc')](function(_0x282447){logger[_0x655a('0xd')](_0x655a('0x1d'),_0x1af637);logger[_0x655a('0x21')](_0x655a('0x1d'),_0x1af637,JSON[_0x655a('0x11')](_0x282447));_0x1c60b6(_0x282447);})[_0x655a('0x16')](function(_0x36021d){logger[_0x655a('0x12')]('UpdateFaxQueueReport',_0x36021d[_0x655a('0x14')],_0x1af637);_0x28e046(_0x2eb423[_0x655a('0x12')](0x1f4,_0x36021d['message']));});});};