Built motion from commit 42801a18.|2.6.28
[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 _0x5184=['request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','debug','UpdateChatQueueReport','where','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x50368e,_0x17ee72){var _0x381d5d=function(_0x1aa026){while(--_0x1aa026){_0x50368e['push'](_0x50368e['shift']());}};_0x381d5d(++_0x17ee72);}(_0x5184,0x1b5));var _0x4518=function(_0x2a7d02,_0x136e24){_0x2a7d02=_0x2a7d02-0x0;var _0x3cd79d=_0x5184[_0x2a7d02];return _0x3cd79d;};'use strict';var _=require('lodash');var util=require(_0x4518('0x0'));var moment=require('moment');var BPromise=require(_0x4518('0x1'));var rs=require(_0x4518('0x2'));var fs=require('fs');var Redis=require(_0x4518('0x3'));var db=require(_0x4518('0x4'))['db'];var utils=require(_0x4518('0x5'));var logger=require(_0x4518('0x6'))(_0x4518('0x7'));var config=require(_0x4518('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4518('0x9')][_0x4518('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44eea0,_0x5bc2c0,_0x2a40cd){return new BPromise(function(_0x4edfce,_0x3a2e74){return client[_0x4518('0xb')](_0x44eea0,_0x2a40cd)[_0x4518('0xc')](function(_0x30ae98){logger[_0x4518('0xd')](_0x4518('0xe'),_0x5bc2c0,_0x4518('0xf'));logger['debug'](_0x4518('0x10'),_0x5bc2c0,_0x4518('0xf'),JSON[_0x4518('0x11')](_0x30ae98));if(_0x30ae98[_0x4518('0x12')]){if(_0x30ae98[_0x4518('0x12')]['code']===0x1f4){logger[_0x4518('0x12')](_0x4518('0xe'),_0x5bc2c0,_0x30ae98[_0x4518('0x12')][_0x4518('0x13')]);return _0x3a2e74(_0x30ae98[_0x4518('0x12')][_0x4518('0x13')]);}logger[_0x4518('0x12')](_0x4518('0xe'),_0x5bc2c0,_0x30ae98[_0x4518('0x12')][_0x4518('0x13')]);return _0x4edfce(_0x30ae98[_0x4518('0x12')][_0x4518('0x13')]);}else{logger['info'](_0x4518('0xe'),_0x5bc2c0,_0x4518('0xf'));_0x4edfce(_0x30ae98[_0x4518('0x14')][_0x4518('0x13')]);}})[_0x4518('0x15')](function(_0x2713a6){logger['error'](_0x4518('0xe'),_0x5bc2c0,_0x2713a6);_0x3a2e74(_0x2713a6);});});}exports['CreateChatQueueReport']=function(_0x40e3de){var _0x301299=this;return new Promise(function(_0x581721,_0x48c2d6){return db[_0x4518('0x16')][_0x4518('0x17')](_0x40e3de[_0x4518('0x18')],{'raw':_0x40e3de[_0x4518('0x19')]?_0x40e3de[_0x4518('0x19')][_0x4518('0x1a')]===undefined?!![]:![]:!![]})[_0x4518('0xc')](function(_0x2dd9b8){logger['info'](_0x4518('0x1b'),_0x40e3de);logger[_0x4518('0x1c')]('CreateChatQueueReport',_0x40e3de,JSON['stringify'](_0x2dd9b8));_0x581721(_0x2dd9b8);})[_0x4518('0x15')](function(_0x42a854){logger['error'](_0x4518('0x1b'),_0x42a854[_0x4518('0x13')],_0x40e3de);_0x48c2d6(_0x301299[_0x4518('0x12')](0x1f4,_0x42a854['message']));});});};exports[_0x4518('0x1d')]=function(_0x3b50ee){var _0x702067=this;return new Promise(function(_0x384b3f,_0x16e3ad){return db['ChatQueueReport']['update'](_0x3b50ee[_0x4518('0x18')],{'raw':_0x3b50ee['options']?_0x3b50ee[_0x4518('0x19')][_0x4518('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b50ee[_0x4518('0x19')]?_0x3b50ee['options'][_0x4518('0x1e')]||null:null,'attributes':_0x3b50ee[_0x4518('0x19')]?_0x3b50ee['options'][_0x4518('0x1f')]||null:null,'limit':_0x3b50ee[_0x4518('0x19')]?_0x3b50ee[_0x4518('0x19')]['limit']||null:null})[_0x4518('0xc')](function(_0x13fc2e){logger['info'](_0x4518('0x1d'),_0x3b50ee);logger[_0x4518('0x1c')](_0x4518('0x1d'),_0x3b50ee,JSON[_0x4518('0x11')](_0x13fc2e));_0x384b3f(_0x13fc2e);})[_0x4518('0x15')](function(_0x3587ab){logger[_0x4518('0x12')](_0x4518('0x1d'),_0x3587ab[_0x4518('0x13')],_0x3b50ee);_0x16e3ad(_0x702067[_0x4518('0x12')](0x1f4,_0x3587ab[_0x4518('0x13')]));});});};