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 _0xad81=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','options','then','catch','UpdateChatQueueReport','update','raw','where','attributes'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xad81,0x66));var _0x1ad8=function(_0x13ae3b,_0x4ddd7c){_0x13ae3b=_0x13ae3b-0x0;var _0x145764=_0xad81[_0x13ae3b];return _0x145764;};'use strict';var _=require(_0x1ad8('0x0'));var util=require(_0x1ad8('0x1'));var moment=require('moment');var BPromise=require(_0x1ad8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ad8('0x3'));var db=require(_0x1ad8('0x4'))['db'];var utils=require(_0x1ad8('0x5'));var logger=require(_0x1ad8('0x6'))(_0x1ad8('0x7'));var config=require(_0x1ad8('0x8'));var jayson=require(_0x1ad8('0x9'));var client=jayson[_0x1ad8('0xa')][_0x1ad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2589,_0x490fe9,_0x5baf92){return new BPromise(function(_0x693245,_0x3a83e9){return client[_0x1ad8('0xc')](_0x5b2589,_0x5baf92)['then'](function(_0x2307c5){logger[_0x1ad8('0xd')](_0x1ad8('0xe'),_0x490fe9,_0x1ad8('0xf'));logger[_0x1ad8('0x10')](_0x1ad8('0x11'),_0x490fe9,'request\x20sent',JSON[_0x1ad8('0x12')](_0x2307c5));if(_0x2307c5[_0x1ad8('0x13')]){if(_0x2307c5[_0x1ad8('0x13')][_0x1ad8('0x14')]===0x1f4){logger[_0x1ad8('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x490fe9,_0x2307c5['error'][_0x1ad8('0x15')]);return _0x3a83e9(_0x2307c5[_0x1ad8('0x13')][_0x1ad8('0x15')]);}logger[_0x1ad8('0x13')](_0x1ad8('0xe'),_0x490fe9,_0x2307c5[_0x1ad8('0x13')][_0x1ad8('0x15')]);return _0x693245(_0x2307c5[_0x1ad8('0x13')][_0x1ad8('0x15')]);}else{logger[_0x1ad8('0xd')](_0x1ad8('0xe'),_0x490fe9,_0x1ad8('0xf'));_0x693245(_0x2307c5[_0x1ad8('0x16')]['message']);}})['catch'](function(_0x5bbf43){logger[_0x1ad8('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x490fe9,_0x5bbf43);_0x3a83e9(_0x5bbf43);});});}exports[_0x1ad8('0x17')]=function(_0x11538d){var _0x273974=this;return new Promise(function(_0x574a89,_0x31386d){return db[_0x1ad8('0x18')][_0x1ad8('0x19')](_0x11538d['body'],{'raw':_0x11538d[_0x1ad8('0x1a')]?_0x11538d[_0x1ad8('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x1ad8('0x1b')](function(_0x9a8f55){logger[_0x1ad8('0xd')](_0x1ad8('0x17'),_0x11538d);logger[_0x1ad8('0x10')](_0x1ad8('0x17'),_0x11538d,JSON[_0x1ad8('0x12')](_0x9a8f55));_0x574a89(_0x9a8f55);})[_0x1ad8('0x1c')](function(_0x72d32c){logger[_0x1ad8('0x13')](_0x1ad8('0x17'),_0x72d32c[_0x1ad8('0x15')],_0x11538d);_0x31386d(_0x273974[_0x1ad8('0x13')](0x1f4,_0x72d32c['message']));});});};exports[_0x1ad8('0x1d')]=function(_0x69f0fb){var _0x2cf49d=this;return new Promise(function(_0x504d6c,_0x20a32d){return db[_0x1ad8('0x18')][_0x1ad8('0x1e')](_0x69f0fb['body'],{'raw':_0x69f0fb['options']?_0x69f0fb[_0x1ad8('0x1a')][_0x1ad8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x69f0fb[_0x1ad8('0x1a')]?_0x69f0fb[_0x1ad8('0x1a')][_0x1ad8('0x20')]||null:null,'attributes':_0x69f0fb[_0x1ad8('0x1a')]?_0x69f0fb[_0x1ad8('0x1a')][_0x1ad8('0x21')]||null:null,'limit':_0x69f0fb[_0x1ad8('0x1a')]?_0x69f0fb[_0x1ad8('0x1a')]['limit']||null:null})[_0x1ad8('0x1b')](function(_0xb25e69){logger[_0x1ad8('0xd')](_0x1ad8('0x1d'),_0x69f0fb);logger[_0x1ad8('0x10')]('UpdateChatQueueReport',_0x69f0fb,JSON['stringify'](_0xb25e69));_0x504d6c(_0xb25e69);})[_0x1ad8('0x1c')](function(_0x30506d){logger[_0x1ad8('0x13')](_0x1ad8('0x1d'),_0x30506d['message'],_0x69f0fb);_0x20a32d(_0x2cf49d['error'](0x1f4,_0x30506d[_0x1ad8('0x15')]));});});};