3d247c30d0530b10a4b8984ff806c3610b18ac51
[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 _0xd523=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xd523,0x153));var _0x3d52=function(_0x1e6763,_0x557792){_0x1e6763=_0x1e6763-0x0;var _0x43ec0d=_0xd523[_0x1e6763];return _0x43ec0d;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcc92,_0x189147,_0x2f3ebc){return new BPromise(function(_0x232bd4,_0x2e03c0){return client[_0x3d52('0xb')](_0x4fcc92,_0x2f3ebc)[_0x3d52('0xc')](function(_0x34c184){logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,'request\x20sent');logger[_0x3d52('0xf')](_0x3d52('0x10'),_0x189147,_0x3d52('0x11'),JSON[_0x3d52('0x12')](_0x34c184));if(_0x34c184[_0x3d52('0x13')]){if(_0x34c184['error'][_0x3d52('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x2e03c0(_0x34c184['error']['message']);}logger['error'](_0x3d52('0xe'),_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x232bd4(_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);}else{logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,_0x3d52('0x11'));_0x232bd4(_0x34c184[_0x3d52('0x16')][_0x3d52('0x15')]);}})[_0x3d52('0x17')](function(_0x15cc02){logger[_0x3d52('0x13')](_0x3d52('0xe'),_0x189147,_0x15cc02);_0x2e03c0(_0x15cc02);});});}exports[_0x3d52('0x18')]=function(_0x5bce9a){var _0x163d88=this;return new Promise(function(_0x3b3451,_0x386cdb){return db['OpenchannelQueueReport'][_0x3d52('0x19')](_0x5bce9a[_0x3d52('0x1a')],{'raw':_0x5bce9a[_0x3d52('0x1b')]?_0x5bce9a['options'][_0x3d52('0x1c')]===undefined?!![]:![]:!![]})[_0x3d52('0xc')](function(_0x1163c5){logger[_0x3d52('0xd')](_0x3d52('0x18'),_0x5bce9a);logger[_0x3d52('0xf')](_0x3d52('0x18'),_0x5bce9a,JSON[_0x3d52('0x12')](_0x1163c5));_0x3b3451(_0x1163c5);})['catch'](function(_0x419c05){logger[_0x3d52('0x13')](_0x3d52('0x18'),_0x419c05['message'],_0x5bce9a);_0x386cdb(_0x163d88[_0x3d52('0x13')](0x1f4,_0x419c05[_0x3d52('0x15')]));});});};exports[_0x3d52('0x1d')]=function(_0xc6c76){var _0x3816bc=this;return new Promise(function(_0x349b30,_0xdf73cd){return db[_0x3d52('0x1e')][_0x3d52('0x1f')](_0xc6c76[_0x3d52('0x1a')],{'raw':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76['options'][_0x3d52('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76[_0x3d52('0x1b')][_0x3d52('0x20')]||null:null,'attributes':_0xc6c76['options']?_0xc6c76['options'][_0x3d52('0x21')]||null:null,'limit':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76[_0x3d52('0x1b')]['limit']||null:null})[_0x3d52('0xc')](function(_0x4312a7){logger[_0x3d52('0xd')](_0x3d52('0x1d'),_0xc6c76);logger['debug'](_0x3d52('0x1d'),_0xc6c76,JSON[_0x3d52('0x12')](_0x4312a7));_0x349b30(_0x4312a7);})[_0x3d52('0x17')](function(_0x193bf1){logger['error'](_0x3d52('0x1d'),_0x193bf1['message'],_0xc6c76);_0xdf73cd(_0x3816bc[_0x3d52('0x13')](0x1f4,_0x193bf1[_0x3d52('0x15')]));});});};