adf635604746dc6fa74cabd291394e2e6545fe46
[motion2.git] / server / api / openchannelQueueReport / openchannelQueueReport.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 _0xb81a=['body','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','create'];(function(_0x233e41,_0x1f9300){var _0x59fecf=function(_0x43df0b){while(--_0x43df0b){_0x233e41['push'](_0x233e41['shift']());}};_0x59fecf(++_0x1f9300);}(_0xb81a,0x1f3));var _0xab81=function(_0x9f149e,_0xbc274a){_0x9f149e=_0x9f149e-0x0;var _0x4f3db5=_0xb81a[_0x9f149e];return _0x4f3db5;};'use strict';var _=require(_0xab81('0x0'));var util=require(_0xab81('0x1'));var moment=require('moment');var BPromise=require(_0xab81('0x2'));var rs=require(_0xab81('0x3'));var fs=require('fs');var Redis=require(_0xab81('0x4'));var db=require(_0xab81('0x5'))['db'];var utils=require(_0xab81('0x6'));var logger=require(_0xab81('0x7'))(_0xab81('0x8'));var config=require(_0xab81('0x9'));var jayson=require(_0xab81('0xa'));var client=jayson[_0xab81('0xb')][_0xab81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc1c7f4,_0x4b80d7,_0x5d533c){return new BPromise(function(_0x28bc80,_0xaf3321){return client[_0xab81('0xd')](_0xc1c7f4,_0x5d533c)[_0xab81('0xe')](function(_0x2cd454){logger[_0xab81('0xf')](_0xab81('0x10'),_0x4b80d7,_0xab81('0x11'));logger[_0xab81('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4b80d7,_0xab81('0x11'),JSON[_0xab81('0x13')](_0x2cd454));if(_0x2cd454['error']){if(_0x2cd454['error'][_0xab81('0x14')]===0x1f4){logger[_0xab81('0x15')](_0xab81('0x10'),_0x4b80d7,_0x2cd454[_0xab81('0x15')]['message']);return _0xaf3321(_0x2cd454[_0xab81('0x15')][_0xab81('0x16')]);}logger[_0xab81('0x15')](_0xab81('0x10'),_0x4b80d7,_0x2cd454[_0xab81('0x15')][_0xab81('0x16')]);return _0x28bc80(_0x2cd454[_0xab81('0x15')][_0xab81('0x16')]);}else{logger[_0xab81('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4b80d7,_0xab81('0x11'));_0x28bc80(_0x2cd454[_0xab81('0x17')][_0xab81('0x16')]);}})[_0xab81('0x18')](function(_0xf12be5){logger['error'](_0xab81('0x10'),_0x4b80d7,_0xf12be5);_0xaf3321(_0xf12be5);});});}exports['CreateOpenchannelQueueReport']=function(_0x265fe8){var _0x22a9c9=this;return new Promise(function(_0x235448,_0x9b7737){return db['OpenchannelQueueReport'][_0xab81('0x19')](_0x265fe8[_0xab81('0x1a')],{'raw':_0x265fe8[_0xab81('0x1b')]?_0x265fe8[_0xab81('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xab81('0xe')](function(_0x3450b0){logger[_0xab81('0xf')](_0xab81('0x1c'),_0x265fe8);logger[_0xab81('0x12')]('CreateOpenchannelQueueReport',_0x265fe8,JSON[_0xab81('0x13')](_0x3450b0));_0x235448(_0x3450b0);})[_0xab81('0x18')](function(_0x477636){logger[_0xab81('0x15')]('CreateOpenchannelQueueReport',_0x477636[_0xab81('0x16')],_0x265fe8);_0x9b7737(_0x22a9c9[_0xab81('0x15')](0x1f4,_0x477636[_0xab81('0x16')]));});});};exports[_0xab81('0x1d')]=function(_0x221ec9){var _0x57bfc9=this;return new Promise(function(_0x2abbc0,_0x147e91){return db[_0xab81('0x1e')]['update'](_0x221ec9['body'],{'raw':_0x221ec9[_0xab81('0x1b')]?_0x221ec9[_0xab81('0x1b')][_0xab81('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x221ec9[_0xab81('0x1b')]?_0x221ec9['options'][_0xab81('0x20')]||null:null,'attributes':_0x221ec9[_0xab81('0x1b')]?_0x221ec9[_0xab81('0x1b')][_0xab81('0x21')]||null:null,'limit':_0x221ec9[_0xab81('0x1b')]?_0x221ec9[_0xab81('0x1b')][_0xab81('0x22')]||null:null})[_0xab81('0xe')](function(_0x13e6c6){logger[_0xab81('0xf')](_0xab81('0x1d'),_0x221ec9);logger['debug'](_0xab81('0x1d'),_0x221ec9,JSON[_0xab81('0x13')](_0x13e6c6));_0x2abbc0(_0x13e6c6);})[_0xab81('0x18')](function(_0x10a552){logger[_0xab81('0x15')]('UpdateOpenchannelQueueReport',_0x10a552[_0xab81('0x16')],_0x221ec9);_0x147e91(_0x57bfc9[_0xab81('0x15')](0x1f4,_0x10a552['message']));});});};