Built motion from commit 13c3002c.|2.6.9
[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 _0x4de2=['request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4de2,0x195));var _0x24de=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x4de2[_0x996bc8];return _0x20b0ea;};'use strict';var _=require(_0x24de('0x0'));var util=require(_0x24de('0x1'));var moment=require(_0x24de('0x2'));var BPromise=require(_0x24de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24de('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x24de('0x5'));var logger=require(_0x24de('0x6'))(_0x24de('0x7'));var config=require(_0x24de('0x8'));var jayson=require(_0x24de('0x9'));var client=jayson[_0x24de('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f530,_0x49a1b3,_0x84aec1){return new BPromise(function(_0x464405,_0x4b7661){return client[_0x24de('0xb')](_0x17f530,_0x84aec1)[_0x24de('0xc')](function(_0x1c8e8c){logger[_0x24de('0xd')](_0x24de('0xe'),_0x49a1b3,_0x24de('0xf'));logger[_0x24de('0x10')](_0x24de('0x11'),_0x49a1b3,_0x24de('0xf'),JSON[_0x24de('0x12')](_0x1c8e8c));if(_0x1c8e8c[_0x24de('0x13')]){if(_0x1c8e8c[_0x24de('0x13')][_0x24de('0x14')]===0x1f4){logger[_0x24de('0x13')](_0x24de('0xe'),_0x49a1b3,_0x1c8e8c[_0x24de('0x13')][_0x24de('0x15')]);return _0x4b7661(_0x1c8e8c[_0x24de('0x13')][_0x24de('0x15')]);}logger[_0x24de('0x13')](_0x24de('0xe'),_0x49a1b3,_0x1c8e8c[_0x24de('0x13')][_0x24de('0x15')]);return _0x464405(_0x1c8e8c[_0x24de('0x13')][_0x24de('0x15')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x49a1b3,_0x24de('0xf'));_0x464405(_0x1c8e8c['result'][_0x24de('0x15')]);}})[_0x24de('0x16')](function(_0x17b2f8){logger[_0x24de('0x13')](_0x24de('0xe'),_0x49a1b3,_0x17b2f8);_0x4b7661(_0x17b2f8);});});}exports[_0x24de('0x17')]=function(_0x223b82){var _0x346efd=this;return new Promise(function(_0x4bb9aa,_0x136504){return db[_0x24de('0x18')]['create'](_0x223b82[_0x24de('0x19')],{'raw':_0x223b82[_0x24de('0x1a')]?_0x223b82[_0x24de('0x1a')][_0x24de('0x1b')]===undefined?!![]:![]:!![]})[_0x24de('0xc')](function(_0x5921dc){logger[_0x24de('0xd')]('CreateChatQueueReport',_0x223b82);logger['debug']('CreateChatQueueReport',_0x223b82,JSON[_0x24de('0x12')](_0x5921dc));_0x4bb9aa(_0x5921dc);})[_0x24de('0x16')](function(_0x224dd4){logger[_0x24de('0x13')]('CreateChatQueueReport',_0x224dd4[_0x24de('0x15')],_0x223b82);_0x136504(_0x346efd['error'](0x1f4,_0x224dd4['message']));});});};exports[_0x24de('0x1c')]=function(_0x59a718){var _0x5576a3=this;return new Promise(function(_0x42a5e1,_0xb55f05){return db[_0x24de('0x18')][_0x24de('0x1d')](_0x59a718[_0x24de('0x19')],{'raw':_0x59a718[_0x24de('0x1a')]?_0x59a718[_0x24de('0x1a')][_0x24de('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59a718[_0x24de('0x1a')]?_0x59a718['options']['where']||null:null,'attributes':_0x59a718[_0x24de('0x1a')]?_0x59a718[_0x24de('0x1a')][_0x24de('0x1e')]||null:null,'limit':_0x59a718['options']?_0x59a718[_0x24de('0x1a')][_0x24de('0x1f')]||null:null})['then'](function(_0xeebd16){logger[_0x24de('0xd')](_0x24de('0x1c'),_0x59a718);logger[_0x24de('0x10')](_0x24de('0x1c'),_0x59a718,JSON[_0x24de('0x12')](_0xeebd16));_0x42a5e1(_0xeebd16);})['catch'](function(_0x5d7396){logger[_0x24de('0x13')](_0x24de('0x1c'),_0x5d7396[_0x24de('0x15')],_0x59a718);_0xb55f05(_0x5576a3[_0x24de('0x13')](0x1f4,_0x5d7396[_0x24de('0x15')]));});});};