Built motion from commit (unavailable).|2.5.0
[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 _0x11c8=['UpdateOpenchannelQueueReport','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request\x20sent','debug','stringify','error','code','message','info','OpenchannelQueueReport,\x20%s,\x20%s','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then'];(function(_0x971ba8,_0x426a3b){var _0x312350=function(_0x48a0fe){while(--_0x48a0fe){_0x971ba8['push'](_0x971ba8['shift']());}};_0x312350(++_0x426a3b);}(_0x11c8,0x19a));var _0x811c=function(_0x4459b8,_0x3271b8){_0x4459b8=_0x4459b8-0x0;var _0x4a4b07=_0x11c8[_0x4459b8];return _0x4a4b07;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var moment=require(_0x811c('0x1'));var BPromise=require('bluebird');var rs=require(_0x811c('0x2'));var fs=require('fs');var Redis=require(_0x811c('0x3'));var db=require(_0x811c('0x4'))['db'];var utils=require(_0x811c('0x5'));var logger=require(_0x811c('0x6'))(_0x811c('0x7'));var config=require('../../config/environment');var jayson=require(_0x811c('0x8'));var client=jayson[_0x811c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126cc2,_0x8af784,_0x13a95a){return new BPromise(function(_0x3e81ac,_0x57a92d){return client['request'](_0x126cc2,_0x13a95a)['then'](function(_0x5be7fc){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'));logger[_0x811c('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'),JSON[_0x811c('0xc')](_0x5be7fc));if(_0x5be7fc[_0x811c('0xd')]){if(_0x5be7fc[_0x811c('0xd')][_0x811c('0xe')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')]['message']);return _0x57a92d(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);return _0x3e81ac(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}else{logger[_0x811c('0x10')](_0x811c('0x11'),_0x8af784,'request\x20sent');_0x3e81ac(_0x5be7fc['result'][_0x811c('0xf')]);}})[_0x811c('0x12')](function(_0x3b0895){logger[_0x811c('0xd')](_0x811c('0x11'),_0x8af784,_0x3b0895);_0x57a92d(_0x3b0895);});});}exports[_0x811c('0x13')]=function(_0xcefd63){var _0x36c8da=this;return new Promise(function(_0x179636,_0x503bbc){return db[_0x811c('0x14')]['create'](_0xcefd63[_0x811c('0x15')],{'raw':_0xcefd63[_0x811c('0x16')]?_0xcefd63['options'][_0x811c('0x17')]===undefined?!![]:![]:!![]})[_0x811c('0x18')](function(_0x3bcc6b){logger['info']('CreateOpenchannelQueueReport',_0xcefd63);logger['debug'](_0x811c('0x13'),_0xcefd63,JSON[_0x811c('0xc')](_0x3bcc6b));_0x179636(_0x3bcc6b);})[_0x811c('0x12')](function(_0x49562b){logger[_0x811c('0xd')](_0x811c('0x13'),_0x49562b[_0x811c('0xf')],_0xcefd63);_0x503bbc(_0x36c8da[_0x811c('0xd')](0x1f4,_0x49562b['message']));});});};exports[_0x811c('0x19')]=function(_0x456aa1){var _0xddb6d9=this;return new Promise(function(_0xc3fda,_0x29c61){return db[_0x811c('0x14')]['update'](_0x456aa1[_0x811c('0x15')],{'raw':_0x456aa1['options']?_0x456aa1[_0x811c('0x16')][_0x811c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456aa1[_0x811c('0x16')]?_0x456aa1[_0x811c('0x16')][_0x811c('0x1a')]||null:null,'attributes':_0x456aa1[_0x811c('0x16')]?_0x456aa1['options'][_0x811c('0x1b')]||null:null,'limit':_0x456aa1[_0x811c('0x16')]?_0x456aa1[_0x811c('0x16')][_0x811c('0x1c')]||null:null})[_0x811c('0x18')](function(_0x18f87a){logger['info'](_0x811c('0x19'),_0x456aa1);logger[_0x811c('0xb')]('UpdateOpenchannelQueueReport',_0x456aa1,JSON['stringify'](_0x18f87a));_0xc3fda(_0x18f87a);})[_0x811c('0x12')](function(_0x38d639){logger[_0x811c('0xd')]('UpdateOpenchannelQueueReport',_0x38d639[_0x811c('0xf')],_0x456aa1);_0x29c61(_0xddb6d9[_0x811c('0xd')](0x1f4,_0x38d639['message']));});});};