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 _0xc75f=['info','result','catch','CreateChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','ChatQueueReport','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0xc75f,0x12d));var _0xfc75=function(_0x5f0209,_0x4d0422){_0x5f0209=_0x5f0209-0x0;var _0x116987=_0xc75f[_0x5f0209];return _0x116987;};'use strict';var _=require(_0xfc75('0x0'));var util=require(_0xfc75('0x1'));var moment=require(_0xfc75('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc75('0x3'));var db=require(_0xfc75('0x4'))['db'];var utils=require(_0xfc75('0x5'));var logger=require(_0xfc75('0x6'))('rpc');var config=require(_0xfc75('0x7'));var jayson=require(_0xfc75('0x8'));var client=jayson['client'][_0xfc75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d43f0,_0x1b97bf,_0x1fd911){return new BPromise(function(_0x292000,_0x211d98){return client[_0xfc75('0xa')](_0x2d43f0,_0x1fd911)[_0xfc75('0xb')](function(_0x441c8e){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1b97bf,_0xfc75('0xc'));logger['debug'](_0xfc75('0xd'),_0x1b97bf,_0xfc75('0xc'),JSON[_0xfc75('0xe')](_0x441c8e));if(_0x441c8e['error']){if(_0x441c8e[_0xfc75('0xf')][_0xfc75('0x10')]===0x1f4){logger[_0xfc75('0xf')](_0xfc75('0x11'),_0x1b97bf,_0x441c8e[_0xfc75('0xf')]['message']);return _0x211d98(_0x441c8e['error'][_0xfc75('0x12')]);}logger['error'](_0xfc75('0x11'),_0x1b97bf,_0x441c8e[_0xfc75('0xf')][_0xfc75('0x12')]);return _0x292000(_0x441c8e[_0xfc75('0xf')]['message']);}else{logger[_0xfc75('0x13')](_0xfc75('0x11'),_0x1b97bf,'request\x20sent');_0x292000(_0x441c8e[_0xfc75('0x14')][_0xfc75('0x12')]);}})[_0xfc75('0x15')](function(_0x63a304){logger[_0xfc75('0xf')](_0xfc75('0x11'),_0x1b97bf,_0x63a304);_0x211d98(_0x63a304);});});}exports[_0xfc75('0x16')]=function(_0x14250b){var _0x2efe70=this;return new Promise(function(_0x531595,_0x12126a){return db['ChatQueueReport'][_0xfc75('0x17')](_0x14250b[_0xfc75('0x18')],{'raw':_0x14250b[_0xfc75('0x19')]?_0x14250b[_0xfc75('0x19')][_0xfc75('0x1a')]===undefined?!![]:![]:!![]})[_0xfc75('0xb')](function(_0x2f2c38){logger[_0xfc75('0x13')](_0xfc75('0x16'),_0x14250b);logger[_0xfc75('0x1b')](_0xfc75('0x16'),_0x14250b,JSON['stringify'](_0x2f2c38));_0x531595(_0x2f2c38);})[_0xfc75('0x15')](function(_0xc9a883){logger[_0xfc75('0xf')](_0xfc75('0x16'),_0xc9a883[_0xfc75('0x12')],_0x14250b);_0x12126a(_0x2efe70[_0xfc75('0xf')](0x1f4,_0xc9a883['message']));});});};exports[_0xfc75('0x1c')]=function(_0x5d05e7){var _0x45d250=this;return new Promise(function(_0x514e8a,_0x315f4e){return db[_0xfc75('0x1d')]['update'](_0x5d05e7[_0xfc75('0x18')],{'raw':_0x5d05e7['options']?_0x5d05e7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d05e7[_0xfc75('0x19')]?_0x5d05e7[_0xfc75('0x19')]['where']||null:null,'attributes':_0x5d05e7[_0xfc75('0x19')]?_0x5d05e7['options'][_0xfc75('0x1e')]||null:null,'limit':_0x5d05e7[_0xfc75('0x19')]?_0x5d05e7[_0xfc75('0x19')][_0xfc75('0x1f')]||null:null})[_0xfc75('0xb')](function(_0x34b111){logger[_0xfc75('0x13')](_0xfc75('0x1c'),_0x5d05e7);logger[_0xfc75('0x1b')](_0xfc75('0x1c'),_0x5d05e7,JSON['stringify'](_0x34b111));_0x514e8a(_0x34b111);})[_0xfc75('0x15')](function(_0x551d77){logger[_0xfc75('0xf')](_0xfc75('0x1c'),_0x551d77[_0xfc75('0x12')],_0x5d05e7);_0x315f4e(_0x45d250['error'](0x1f4,_0x551d77['message']));});});};