9f4517e062eed10933c31d04541e6b918bd154fd
[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 _0x88ac=['options','attributes','limit','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','raw','UpdateChatQueueReport'];(function(_0x4905a2,_0x359ab2){var _0x1c288b=function(_0x32c4a0){while(--_0x32c4a0){_0x4905a2['push'](_0x4905a2['shift']());}};_0x1c288b(++_0x359ab2);}(_0x88ac,0x124));var _0xc88a=function(_0x2388be,_0x43ebae){_0x2388be=_0x2388be-0x0;var _0x13ac52=_0x88ac[_0x2388be];return _0x13ac52;};'use strict';var _=require(_0xc88a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc88a('0x1'));var fs=require('fs');var Redis=require(_0xc88a('0x2'));var db=require(_0xc88a('0x3'))['db'];var utils=require(_0xc88a('0x4'));var logger=require(_0xc88a('0x5'))('rpc');var config=require(_0xc88a('0x6'));var jayson=require(_0xc88a('0x7'));var client=jayson[_0xc88a('0x8')][_0xc88a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23b3a7,_0x44a753,_0x2b5bc7){return new BPromise(function(_0x26f1a1,_0x842a2f){return client[_0xc88a('0xa')](_0x23b3a7,_0x2b5bc7)[_0xc88a('0xb')](function(_0x20bb2e){logger[_0xc88a('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x44a753,_0xc88a('0xd'));logger['debug'](_0xc88a('0xe'),_0x44a753,_0xc88a('0xd'),JSON[_0xc88a('0xf')](_0x20bb2e));if(_0x20bb2e[_0xc88a('0x10')]){if(_0x20bb2e[_0xc88a('0x10')][_0xc88a('0x11')]===0x1f4){logger[_0xc88a('0x10')](_0xc88a('0x12'),_0x44a753,_0x20bb2e[_0xc88a('0x10')][_0xc88a('0x13')]);return _0x842a2f(_0x20bb2e['error']['message']);}logger[_0xc88a('0x10')](_0xc88a('0x12'),_0x44a753,_0x20bb2e[_0xc88a('0x10')]['message']);return _0x26f1a1(_0x20bb2e[_0xc88a('0x10')][_0xc88a('0x13')]);}else{logger[_0xc88a('0xc')](_0xc88a('0x12'),_0x44a753,'request\x20sent');_0x26f1a1(_0x20bb2e[_0xc88a('0x14')][_0xc88a('0x13')]);}})[_0xc88a('0x15')](function(_0x19fdc4){logger[_0xc88a('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x44a753,_0x19fdc4);_0x842a2f(_0x19fdc4);});});}exports[_0xc88a('0x16')]=function(_0x1d5f29){var _0x4795d0=this;return new Promise(function(_0x54948c,_0x4fb656){return db[_0xc88a('0x17')][_0xc88a('0x18')](_0x1d5f29[_0xc88a('0x19')],{'raw':_0x1d5f29['options']?_0x1d5f29['options'][_0xc88a('0x1a')]===undefined?!![]:![]:!![]})[_0xc88a('0xb')](function(_0xecd6d3){logger['info'](_0xc88a('0x16'),_0x1d5f29);logger['debug'](_0xc88a('0x16'),_0x1d5f29,JSON['stringify'](_0xecd6d3));_0x54948c(_0xecd6d3);})['catch'](function(_0x371a4e){logger[_0xc88a('0x10')](_0xc88a('0x16'),_0x371a4e[_0xc88a('0x13')],_0x1d5f29);_0x4fb656(_0x4795d0['error'](0x1f4,_0x371a4e[_0xc88a('0x13')]));});});};exports[_0xc88a('0x1b')]=function(_0x558978){var _0x1cd4ed=this;return new Promise(function(_0x129132,_0xcf46ce){return db[_0xc88a('0x17')]['update'](_0x558978['body'],{'raw':_0x558978[_0xc88a('0x1c')]?_0x558978[_0xc88a('0x1c')][_0xc88a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x558978['options']?_0x558978[_0xc88a('0x1c')]['where']||null:null,'attributes':_0x558978[_0xc88a('0x1c')]?_0x558978[_0xc88a('0x1c')][_0xc88a('0x1d')]||null:null,'limit':_0x558978[_0xc88a('0x1c')]?_0x558978[_0xc88a('0x1c')][_0xc88a('0x1e')]||null:null})['then'](function(_0x2565a7){logger[_0xc88a('0xc')]('UpdateChatQueueReport',_0x558978);logger[_0xc88a('0x1f')](_0xc88a('0x1b'),_0x558978,JSON['stringify'](_0x2565a7));_0x129132(_0x2565a7);})[_0xc88a('0x15')](function(_0x388090){logger[_0xc88a('0x10')](_0xc88a('0x1b'),_0x388090[_0xc88a('0x13')],_0x558978);_0xcf46ce(_0x1cd4ed[_0xc88a('0x10')](0x1f4,_0x388090[_0xc88a('0x13')]));});});};