Built motion from commit (unavailable).|2.4.3
[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 _0xf6f2=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','update','limit','UpdateOpenchannelQueueReport','lodash','moment'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xf6f2,0x1b0));var _0x2f6f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf6f2[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x2f6f('0x0'));var util=require('util');var moment=require(_0x2f6f('0x1'));var BPromise=require(_0x2f6f('0x2'));var rs=require(_0x2f6f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f6f('0x5'));var config=require(_0x2f6f('0x6'));var jayson=require(_0x2f6f('0x7'));var client=jayson[_0x2f6f('0x8')][_0x2f6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x390e86,_0x4cb834,_0x42b4e1){return new BPromise(function(_0x569bbb,_0x2d56dc){return client[_0x2f6f('0xa')](_0x390e86,_0x42b4e1)[_0x2f6f('0xb')](function(_0x337aaf){logger[_0x2f6f('0xc')](_0x2f6f('0xd'),_0x4cb834,_0x2f6f('0xe'));logger[_0x2f6f('0xf')](_0x2f6f('0x10'),_0x4cb834,_0x2f6f('0xe'),JSON[_0x2f6f('0x11')](_0x337aaf));if(_0x337aaf[_0x2f6f('0x12')]){if(_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x13')]===0x1f4){logger[_0x2f6f('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4cb834,_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x14')]);return _0x2d56dc(_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x14')]);}logger[_0x2f6f('0x12')](_0x2f6f('0xd'),_0x4cb834,_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x14')]);return _0x569bbb(_0x337aaf[_0x2f6f('0x12')][_0x2f6f('0x14')]);}else{logger[_0x2f6f('0xc')](_0x2f6f('0xd'),_0x4cb834,_0x2f6f('0xe'));_0x569bbb(_0x337aaf[_0x2f6f('0x15')][_0x2f6f('0x14')]);}})[_0x2f6f('0x16')](function(_0x1a2f17){logger[_0x2f6f('0x12')](_0x2f6f('0xd'),_0x4cb834,_0x1a2f17);_0x2d56dc(_0x1a2f17);});});}exports[_0x2f6f('0x17')]=function(_0x4b3dbf){var _0x4dacbd=this;return new Promise(function(_0x5cdc01,_0x86ee7e){return db['OpenchannelQueueReport'][_0x2f6f('0x18')](_0x4b3dbf[_0x2f6f('0x19')],{'raw':_0x4b3dbf[_0x2f6f('0x1a')]?_0x4b3dbf[_0x2f6f('0x1a')][_0x2f6f('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x58cd21){logger[_0x2f6f('0xc')]('CreateOpenchannelQueueReport',_0x4b3dbf);logger[_0x2f6f('0xf')](_0x2f6f('0x17'),_0x4b3dbf,JSON['stringify'](_0x58cd21));_0x5cdc01(_0x58cd21);})[_0x2f6f('0x16')](function(_0x313b74){logger[_0x2f6f('0x12')](_0x2f6f('0x17'),_0x313b74[_0x2f6f('0x14')],_0x4b3dbf);_0x86ee7e(_0x4dacbd[_0x2f6f('0x12')](0x1f4,_0x313b74['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2ef21f){var _0x2fb86e=this;return new Promise(function(_0x44cbd6,_0x40756d){return db['OpenchannelQueueReport'][_0x2f6f('0x1c')](_0x2ef21f[_0x2f6f('0x19')],{'raw':_0x2ef21f[_0x2f6f('0x1a')]?_0x2ef21f[_0x2f6f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef21f[_0x2f6f('0x1a')]?_0x2ef21f[_0x2f6f('0x1a')]['where']||null:null,'attributes':_0x2ef21f[_0x2f6f('0x1a')]?_0x2ef21f[_0x2f6f('0x1a')]['attributes']||null:null,'limit':_0x2ef21f[_0x2f6f('0x1a')]?_0x2ef21f[_0x2f6f('0x1a')][_0x2f6f('0x1d')]||null:null})[_0x2f6f('0xb')](function(_0x4d5694){logger[_0x2f6f('0xc')](_0x2f6f('0x1e'),_0x2ef21f);logger[_0x2f6f('0xf')]('UpdateOpenchannelQueueReport',_0x2ef21f,JSON['stringify'](_0x4d5694));_0x44cbd6(_0x4d5694);})[_0x2f6f('0x16')](function(_0x337669){logger[_0x2f6f('0x12')](_0x2f6f('0x1e'),_0x337669[_0x2f6f('0x14')],_0x2ef21f);_0x40756d(_0x2fb86e['error'](0x1f4,_0x337669[_0x2f6f('0x14')]));});});};