Built motion from commit (unavailable).|2.5.4
[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 _0xa110=['http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','options','body','raw','where','attributes','limit','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','client'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0xa110,0x9b));var _0x0a11=function(_0x1223ff,_0x5a07b9){_0x1223ff=_0x1223ff-0x0;var _0x11dbff=_0xa110[_0x1223ff];return _0x11dbff;};'use strict';var _=require(_0x0a11('0x0'));var util=require(_0x0a11('0x1'));var moment=require('moment');var BPromise=require(_0x0a11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a11('0x3'));var logger=require(_0x0a11('0x4'))(_0x0a11('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a11('0x6')][_0x0a11('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56ee6c,_0x372ee5,_0x1818f3){return new BPromise(function(_0x2960eb,_0x6eec79){return client[_0x0a11('0x8')](_0x56ee6c,_0x1818f3)[_0x0a11('0x9')](function(_0x4dc530){logger[_0x0a11('0xa')](_0x0a11('0xb'),_0x372ee5,_0x0a11('0xc'));logger[_0x0a11('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x372ee5,_0x0a11('0xc'),JSON[_0x0a11('0xe')](_0x4dc530));if(_0x4dc530[_0x0a11('0xf')]){if(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x10')]===0x1f4){logger[_0x0a11('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x372ee5,_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);return _0x6eec79(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);}logger[_0x0a11('0xf')](_0x0a11('0xb'),_0x372ee5,_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);return _0x2960eb(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);}else{logger['info'](_0x0a11('0xb'),_0x372ee5,_0x0a11('0xc'));_0x2960eb(_0x4dc530['result'][_0x0a11('0x11')]);}})[_0x0a11('0x12')](function(_0x1ed9f2){logger[_0x0a11('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x372ee5,_0x1ed9f2);_0x6eec79(_0x1ed9f2);});});}exports[_0x0a11('0x13')]=function(_0xa75869){var _0x37ddb7=this;return new Promise(function(_0x2a6ab0,_0x5299cf){return db[_0x0a11('0x14')]['create'](_0xa75869['body'],{'raw':_0xa75869[_0x0a11('0x15')]?_0xa75869['options']['raw']===undefined?!![]:![]:!![]})[_0x0a11('0x9')](function(_0x19fe27){logger[_0x0a11('0xa')](_0x0a11('0x13'),_0xa75869);logger['debug'](_0x0a11('0x13'),_0xa75869,JSON['stringify'](_0x19fe27));_0x2a6ab0(_0x19fe27);})['catch'](function(_0x41ad78){logger[_0x0a11('0xf')](_0x0a11('0x13'),_0x41ad78[_0x0a11('0x11')],_0xa75869);_0x5299cf(_0x37ddb7[_0x0a11('0xf')](0x1f4,_0x41ad78['message']));});});};exports['UpdateChatQueueReport']=function(_0x55e0fd){var _0x3e937c=this;return new Promise(function(_0x3e290b,_0x432f78){return db[_0x0a11('0x14')]['update'](_0x55e0fd[_0x0a11('0x16')],{'raw':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd['options'][_0x0a11('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x18')]||null:null,'attributes':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x19')]||null:null,'limit':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x1a')]||null:null})[_0x0a11('0x9')](function(_0x529eca){logger[_0x0a11('0xa')]('UpdateChatQueueReport',_0x55e0fd);logger['debug']('UpdateChatQueueReport',_0x55e0fd,JSON[_0x0a11('0xe')](_0x529eca));_0x3e290b(_0x529eca);})['catch'](function(_0x4db9e6){logger[_0x0a11('0xf')]('UpdateChatQueueReport',_0x4db9e6[_0x0a11('0x11')],_0x55e0fd);_0x432f78(_0x3e937c[_0x0a11('0xf')](0x1f4,_0x4db9e6[_0x0a11('0x11')]));});});};