Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / chatQueueReport / chatQueueReport.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 _0x7ff7=['message','result','catch','CreateChatQueueReport','create','body','options','raw','ChatQueueReport','update','where','attributes','limit','UpdateChatQueueReport','debug','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s'];(function(_0x5d3af5,_0x25b63e){var _0x44723c=function(_0x46f451){while(--_0x46f451){_0x5d3af5['push'](_0x5d3af5['shift']());}};_0x44723c(++_0x25b63e);}(_0x7ff7,0xef));var _0x77ff=function(_0x1f336f,_0x50aebd){_0x1f336f=_0x1f336f-0x0;var _0x43141e=_0x7ff7[_0x1f336f];return _0x43141e;};'use strict';var _=require(_0x77ff('0x0'));var util=require('util');var moment=require(_0x77ff('0x1'));var BPromise=require(_0x77ff('0x2'));var rs=require(_0x77ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x77ff('0x4'));var logger=require(_0x77ff('0x5'))(_0x77ff('0x6'));var config=require(_0x77ff('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x77ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c293d,_0x188ce6,_0x554361){return new BPromise(function(_0x2cf9e3,_0x3be72b){return client[_0x77ff('0x9')](_0x1c293d,_0x554361)[_0x77ff('0xa')](function(_0x2664f3){logger[_0x77ff('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x188ce6,_0x77ff('0xc'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x188ce6,_0x77ff('0xc'),JSON[_0x77ff('0xd')](_0x2664f3));if(_0x2664f3[_0x77ff('0xe')]){if(_0x2664f3[_0x77ff('0xe')][_0x77ff('0xf')]===0x1f4){logger[_0x77ff('0xe')](_0x77ff('0x10'),_0x188ce6,_0x2664f3['error']['message']);return _0x3be72b(_0x2664f3[_0x77ff('0xe')]['message']);}logger[_0x77ff('0xe')](_0x77ff('0x10'),_0x188ce6,_0x2664f3[_0x77ff('0xe')][_0x77ff('0x11')]);return _0x2cf9e3(_0x2664f3[_0x77ff('0xe')][_0x77ff('0x11')]);}else{logger['info'](_0x77ff('0x10'),_0x188ce6,_0x77ff('0xc'));_0x2cf9e3(_0x2664f3[_0x77ff('0x12')][_0x77ff('0x11')]);}})[_0x77ff('0x13')](function(_0x421dad){logger[_0x77ff('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x188ce6,_0x421dad);_0x3be72b(_0x421dad);});});}exports[_0x77ff('0x14')]=function(_0x54779e){var _0x5000ce=this;return new Promise(function(_0x28c20e,_0x2dbb43){return db['ChatQueueReport'][_0x77ff('0x15')](_0x54779e[_0x77ff('0x16')],{'raw':_0x54779e[_0x77ff('0x17')]?_0x54779e[_0x77ff('0x17')][_0x77ff('0x18')]===undefined?!![]:![]:!![]})[_0x77ff('0xa')](function(_0x19698c){logger['info']('CreateChatQueueReport',_0x54779e);logger['debug'](_0x77ff('0x14'),_0x54779e,JSON[_0x77ff('0xd')](_0x19698c));_0x28c20e(_0x19698c);})[_0x77ff('0x13')](function(_0x104351){logger['error']('CreateChatQueueReport',_0x104351[_0x77ff('0x11')],_0x54779e);_0x2dbb43(_0x5000ce[_0x77ff('0xe')](0x1f4,_0x104351['message']));});});};exports['UpdateChatQueueReport']=function(_0x1c47b5){var _0x14bbcd=this;return new Promise(function(_0x192324,_0x10282f){return db[_0x77ff('0x19')][_0x77ff('0x1a')](_0x1c47b5[_0x77ff('0x16')],{'raw':_0x1c47b5['options']?_0x1c47b5['options'][_0x77ff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c47b5['options']?_0x1c47b5[_0x77ff('0x17')][_0x77ff('0x1b')]||null:null,'attributes':_0x1c47b5[_0x77ff('0x17')]?_0x1c47b5['options'][_0x77ff('0x1c')]||null:null,'limit':_0x1c47b5['options']?_0x1c47b5[_0x77ff('0x17')][_0x77ff('0x1d')]||null:null})[_0x77ff('0xa')](function(_0x30c57f){logger[_0x77ff('0xb')](_0x77ff('0x1e'),_0x1c47b5);logger[_0x77ff('0x1f')](_0x77ff('0x1e'),_0x1c47b5,JSON['stringify'](_0x30c57f));_0x192324(_0x30c57f);})[_0x77ff('0x13')](function(_0x541840){logger['error'](_0x77ff('0x1e'),_0x541840['message'],_0x1c47b5);_0x10282f(_0x14bbcd['error'](0x1f4,_0x541840[_0x77ff('0x11')]));});});};