Built motion from commit (unavailable).|2.5.14
[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 _0xd64a=['ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','CreateChatQueueReport'];(function(_0x369cf2,_0x47e28c){var _0x5c7d3e=function(_0x4143d9){while(--_0x4143d9){_0x369cf2['push'](_0x369cf2['shift']());}};_0x5c7d3e(++_0x47e28c);}(_0xd64a,0x73));var _0xad64=function(_0x28b38e,_0x9785e2){_0x28b38e=_0x28b38e-0x0;var _0x51d789=_0xd64a[_0x28b38e];return _0x51d789;};'use strict';var _=require('lodash');var util=require(_0xad64('0x0'));var moment=require(_0xad64('0x1'));var BPromise=require(_0xad64('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad64('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xad64('0x4'));var logger=require(_0xad64('0x5'))(_0xad64('0x6'));var config=require(_0xad64('0x7'));var jayson=require(_0xad64('0x8'));var client=jayson[_0xad64('0x9')][_0xad64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x278d29,_0x4f51bc,_0x136aa8){return new BPromise(function(_0x3f14dc,_0x5ca80e){return client[_0xad64('0xb')](_0x278d29,_0x136aa8)[_0xad64('0xc')](function(_0x507b54){logger[_0xad64('0xd')](_0xad64('0xe'),_0x4f51bc,_0xad64('0xf'));logger[_0xad64('0x10')](_0xad64('0x11'),_0x4f51bc,_0xad64('0xf'),JSON[_0xad64('0x12')](_0x507b54));if(_0x507b54['error']){if(_0x507b54['error'][_0xad64('0x13')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4f51bc,_0x507b54['error'][_0xad64('0x14')]);return _0x5ca80e(_0x507b54['error'][_0xad64('0x14')]);}logger['error'](_0xad64('0xe'),_0x4f51bc,_0x507b54[_0xad64('0x15')]['message']);return _0x3f14dc(_0x507b54[_0xad64('0x15')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4f51bc,_0xad64('0xf'));_0x3f14dc(_0x507b54[_0xad64('0x16')]['message']);}})[_0xad64('0x17')](function(_0x3e1a66){logger[_0xad64('0x15')](_0xad64('0xe'),_0x4f51bc,_0x3e1a66);_0x5ca80e(_0x3e1a66);});});}exports[_0xad64('0x18')]=function(_0x1ec16d){var _0x5c834c=this;return new Promise(function(_0x425781,_0x1f67be){return db[_0xad64('0x19')][_0xad64('0x1a')](_0x1ec16d[_0xad64('0x1b')],{'raw':_0x1ec16d[_0xad64('0x1c')]?_0x1ec16d[_0xad64('0x1c')][_0xad64('0x1d')]===undefined?!![]:![]:!![]})[_0xad64('0xc')](function(_0x340809){logger['info'](_0xad64('0x18'),_0x1ec16d);logger[_0xad64('0x10')](_0xad64('0x18'),_0x1ec16d,JSON[_0xad64('0x12')](_0x340809));_0x425781(_0x340809);})['catch'](function(_0x5a9bb6){logger[_0xad64('0x15')](_0xad64('0x18'),_0x5a9bb6['message'],_0x1ec16d);_0x1f67be(_0x5c834c[_0xad64('0x15')](0x1f4,_0x5a9bb6[_0xad64('0x14')]));});});};exports[_0xad64('0x1e')]=function(_0x202be5){var _0xe348a=this;return new Promise(function(_0x588553,_0x9d3e0){return db['ChatQueueReport'][_0xad64('0x1f')](_0x202be5[_0xad64('0x1b')],{'raw':_0x202be5[_0xad64('0x1c')]?_0x202be5[_0xad64('0x1c')][_0xad64('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x202be5[_0xad64('0x1c')]?_0x202be5[_0xad64('0x1c')][_0xad64('0x20')]||null:null,'attributes':_0x202be5[_0xad64('0x1c')]?_0x202be5[_0xad64('0x1c')][_0xad64('0x21')]||null:null,'limit':_0x202be5[_0xad64('0x1c')]?_0x202be5[_0xad64('0x1c')][_0xad64('0x22')]||null:null})[_0xad64('0xc')](function(_0x3ffa7b){logger['info']('UpdateChatQueueReport',_0x202be5);logger['debug'](_0xad64('0x1e'),_0x202be5,JSON[_0xad64('0x12')](_0x3ffa7b));_0x588553(_0x3ffa7b);})['catch'](function(_0x17b9b9){logger['error'](_0xad64('0x1e'),_0x17b9b9[_0xad64('0x14')],_0x202be5);_0x9d3e0(_0xe348a[_0xad64('0x15')](0x1f4,_0x17b9b9[_0xad64('0x14')]));});});};