7b4d3320bee3297257398ae1f3c4e0992bd2c467
[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 _0xc900=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4e002e,_0x4069ac){var _0x5df3e5=function(_0xcaa025){while(--_0xcaa025){_0x4e002e['push'](_0x4e002e['shift']());}};_0x5df3e5(++_0x4069ac);}(_0xc900,0xb3));var _0x0c90=function(_0x4aab57,_0x1a6209){_0x4aab57=_0x4aab57-0x0;var _0x149aa7=_0xc900[_0x4aab57];return _0x149aa7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});}exports[_0x0c90('0x15')]=function(_0x42321a){var _0x57b9a6=this;return new Promise(function(_0xc3bb47,_0x38becc){return db[_0x0c90('0x16')][_0x0c90('0x17')](_0x42321a['body'],{'raw':_0x42321a[_0x0c90('0x18')]?_0x42321a[_0x0c90('0x18')][_0x0c90('0x19')]===undefined?!![]:![]:!![]})[_0x0c90('0xb')](function(_0x315932){logger[_0x0c90('0xc')]('CreateOpenchannelQueueReport',_0x42321a);logger[_0x0c90('0xf')]('CreateOpenchannelQueueReport',_0x42321a,JSON[_0x0c90('0x11')](_0x315932));_0xc3bb47(_0x315932);})[_0x0c90('0x14')](function(_0x47b13c){logger[_0x0c90('0x12')](_0x0c90('0x15'),_0x47b13c[_0x0c90('0x13')],_0x42321a);_0x38becc(_0x57b9a6[_0x0c90('0x12')](0x1f4,_0x47b13c[_0x0c90('0x13')]));});});};exports[_0x0c90('0x1a')]=function(_0x4dfbc3){var _0x26f0a3=this;return new Promise(function(_0x12f22c,_0x5695a2){return db['OpenchannelQueueReport'][_0x0c90('0x1b')](_0x4dfbc3[_0x0c90('0x1c')],{'raw':_0x4dfbc3[_0x0c90('0x18')]?_0x4dfbc3[_0x0c90('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dfbc3[_0x0c90('0x18')]?_0x4dfbc3[_0x0c90('0x18')][_0x0c90('0x1d')]||null:null,'attributes':_0x4dfbc3[_0x0c90('0x18')]?_0x4dfbc3[_0x0c90('0x18')][_0x0c90('0x1e')]||null:null,'limit':_0x4dfbc3['options']?_0x4dfbc3[_0x0c90('0x18')][_0x0c90('0x1f')]||null:null})[_0x0c90('0xb')](function(_0x13b377){logger['info']('UpdateOpenchannelQueueReport',_0x4dfbc3);logger[_0x0c90('0xf')](_0x0c90('0x1a'),_0x4dfbc3,JSON[_0x0c90('0x11')](_0x13b377));_0x12f22c(_0x13b377);})[_0x0c90('0x14')](function(_0x119e09){logger['error'](_0x0c90('0x1a'),_0x119e09[_0x0c90('0x13')],_0x4dfbc3);_0x5695a2(_0x26f0a3[_0x0c90('0x12')](0x1f4,_0x119e09['message']));});});};