Built motion from commit (unavailable).|2.5.5
[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 _0x60c5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','CreateChatQueueReport','ChatQueueReport','create','body','catch','UpdateChatQueueReport','update','options','raw','where','attributes','limit','lodash'];(function(_0x4db4ee,_0x89cff1){var _0x5839fc=function(_0x259397){while(--_0x259397){_0x4db4ee['push'](_0x4db4ee['shift']());}};_0x5839fc(++_0x89cff1);}(_0x60c5,0x9f));var _0x560c=function(_0x18022f,_0xbe4f68){_0x18022f=_0x18022f-0x0;var _0x25b87d=_0x60c5[_0x18022f];return _0x25b87d;};'use strict';var _=require(_0x560c('0x0'));var util=require('util');var moment=require(_0x560c('0x1'));var BPromise=require(_0x560c('0x2'));var rs=require(_0x560c('0x3'));var fs=require('fs');var Redis=require(_0x560c('0x4'));var db=require(_0x560c('0x5'))['db'];var utils=require(_0x560c('0x6'));var logger=require(_0x560c('0x7'))(_0x560c('0x8'));var config=require(_0x560c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x560c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x509a86,_0x459638,_0x2dfff2){return new BPromise(function(_0x305c43,_0x28e9fc){return client['request'](_0x509a86,_0x2dfff2)[_0x560c('0xb')](function(_0x5aa476){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x459638,_0x560c('0xc'));logger[_0x560c('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x459638,'request\x20sent',JSON[_0x560c('0xe')](_0x5aa476));if(_0x5aa476[_0x560c('0xf')]){if(_0x5aa476[_0x560c('0xf')][_0x560c('0x10')]===0x1f4){logger[_0x560c('0xf')](_0x560c('0x11'),_0x459638,_0x5aa476[_0x560c('0xf')][_0x560c('0x12')]);return _0x28e9fc(_0x5aa476['error'][_0x560c('0x12')]);}logger[_0x560c('0xf')](_0x560c('0x11'),_0x459638,_0x5aa476[_0x560c('0xf')][_0x560c('0x12')]);return _0x305c43(_0x5aa476[_0x560c('0xf')][_0x560c('0x12')]);}else{logger[_0x560c('0x13')](_0x560c('0x11'),_0x459638,'request\x20sent');_0x305c43(_0x5aa476['result'][_0x560c('0x12')]);}})['catch'](function(_0x3d90b2){logger[_0x560c('0xf')](_0x560c('0x11'),_0x459638,_0x3d90b2);_0x28e9fc(_0x3d90b2);});});}exports[_0x560c('0x14')]=function(_0xd7e05d){var _0x5bc355=this;return new Promise(function(_0x41cb08,_0x37532a){return db[_0x560c('0x15')][_0x560c('0x16')](_0xd7e05d[_0x560c('0x17')],{'raw':_0xd7e05d['options']?_0xd7e05d['options']['raw']===undefined?!![]:![]:!![]})[_0x560c('0xb')](function(_0x5d28e6){logger['info'](_0x560c('0x14'),_0xd7e05d);logger[_0x560c('0xd')](_0x560c('0x14'),_0xd7e05d,JSON[_0x560c('0xe')](_0x5d28e6));_0x41cb08(_0x5d28e6);})[_0x560c('0x18')](function(_0x46605a){logger[_0x560c('0xf')](_0x560c('0x14'),_0x46605a[_0x560c('0x12')],_0xd7e05d);_0x37532a(_0x5bc355[_0x560c('0xf')](0x1f4,_0x46605a[_0x560c('0x12')]));});});};exports[_0x560c('0x19')]=function(_0x17afe4){var _0x3e424b=this;return new Promise(function(_0x5d8721,_0x5a2f5a){return db[_0x560c('0x15')][_0x560c('0x1a')](_0x17afe4[_0x560c('0x17')],{'raw':_0x17afe4[_0x560c('0x1b')]?_0x17afe4[_0x560c('0x1b')][_0x560c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17afe4['options']?_0x17afe4[_0x560c('0x1b')][_0x560c('0x1d')]||null:null,'attributes':_0x17afe4[_0x560c('0x1b')]?_0x17afe4['options'][_0x560c('0x1e')]||null:null,'limit':_0x17afe4[_0x560c('0x1b')]?_0x17afe4[_0x560c('0x1b')][_0x560c('0x1f')]||null:null})['then'](function(_0x393fee){logger['info'](_0x560c('0x19'),_0x17afe4);logger[_0x560c('0xd')](_0x560c('0x19'),_0x17afe4,JSON[_0x560c('0xe')](_0x393fee));_0x5d8721(_0x393fee);})[_0x560c('0x18')](function(_0x247141){logger[_0x560c('0xf')]('UpdateChatQueueReport',_0x247141[_0x560c('0x12')],_0x17afe4);_0x5a2f5a(_0x3e424b[_0x560c('0xf')](0x1f4,_0x247141[_0x560c('0x12')]));});});};