Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / whatsappQueueReport / whatsappQueueReport.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 _0xfc16=['../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueueReport','create','body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','raw','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x207efe,_0x37e1a8){var _0x1aad20=function(_0x44dae6){while(--_0x44dae6){_0x207efe['push'](_0x207efe['shift']());}};_0x1aad20(++_0x37e1a8);}(_0xfc16,0x76));var _0x6fc1=function(_0x8d68ce,_0x135a7f){_0x8d68ce=_0x8d68ce-0x0;var _0x2e1f64=_0xfc16[_0x8d68ce];return _0x2e1f64;};'use strict';var _=require(_0x6fc1('0x0'));var util=require(_0x6fc1('0x1'));var moment=require(_0x6fc1('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fc1('0x3'));var fs=require('fs');var Redis=require(_0x6fc1('0x4'));var db=require(_0x6fc1('0x5'))['db'];var utils=require(_0x6fc1('0x6'));var logger=require('../../config/logger')(_0x6fc1('0x7'));var config=require(_0x6fc1('0x8'));var jayson=require(_0x6fc1('0x9'));var client=jayson[_0x6fc1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a75f4,_0x67e1e7,_0x465c01){return new BPromise(function(_0x1137cd,_0x61e92a){return client['request'](_0x5a75f4,_0x465c01)[_0x6fc1('0xb')](function(_0x15bf13){logger[_0x6fc1('0xc')](_0x6fc1('0xd'),_0x67e1e7,_0x6fc1('0xe'));logger[_0x6fc1('0xf')](_0x6fc1('0x10'),_0x67e1e7,_0x6fc1('0xe'),JSON[_0x6fc1('0x11')](_0x15bf13));if(_0x15bf13[_0x6fc1('0x12')]){if(_0x15bf13[_0x6fc1('0x12')][_0x6fc1('0x13')]===0x1f4){logger['error'](_0x6fc1('0xd'),_0x67e1e7,_0x15bf13['error']['message']);return _0x61e92a(_0x15bf13[_0x6fc1('0x12')]['message']);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x67e1e7,_0x15bf13[_0x6fc1('0x12')][_0x6fc1('0x14')]);return _0x1137cd(_0x15bf13[_0x6fc1('0x12')][_0x6fc1('0x14')]);}else{logger[_0x6fc1('0xc')](_0x6fc1('0xd'),_0x67e1e7,_0x6fc1('0xe'));_0x1137cd(_0x15bf13['result']['message']);}})[_0x6fc1('0x15')](function(_0x54f36e){logger[_0x6fc1('0x12')](_0x6fc1('0xd'),_0x67e1e7,_0x54f36e);_0x61e92a(_0x54f36e);});});}exports['CreateWhatsappQueueReport']=function(_0xb2af4e){var _0x423fa2=this;return new Promise(function(_0x16aaf9,_0xb69b48){return db[_0x6fc1('0x16')][_0x6fc1('0x17')](_0xb2af4e[_0x6fc1('0x18')],{'raw':_0xb2af4e[_0x6fc1('0x19')]?_0xb2af4e['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x49f9d9){logger[_0x6fc1('0xc')](_0x6fc1('0x1a'),_0xb2af4e);logger[_0x6fc1('0xf')]('CreateWhatsappQueueReport',_0xb2af4e,JSON[_0x6fc1('0x11')](_0x49f9d9));_0x16aaf9(_0x49f9d9);})[_0x6fc1('0x15')](function(_0x4b8bf8){logger[_0x6fc1('0x12')](_0x6fc1('0x1a'),_0x4b8bf8[_0x6fc1('0x14')],_0xb2af4e);_0xb69b48(_0x423fa2[_0x6fc1('0x12')](0x1f4,_0x4b8bf8[_0x6fc1('0x14')]));});});};exports[_0x6fc1('0x1b')]=function(_0x24f360){var _0x463c01=this;return new Promise(function(_0x1fe7cf,_0x98018c){return db[_0x6fc1('0x16')]['update'](_0x24f360[_0x6fc1('0x18')],{'raw':_0x24f360[_0x6fc1('0x19')]?_0x24f360[_0x6fc1('0x19')][_0x6fc1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24f360[_0x6fc1('0x19')]?_0x24f360[_0x6fc1('0x19')][_0x6fc1('0x1d')]||null:null,'attributes':_0x24f360[_0x6fc1('0x19')]?_0x24f360['options']['attributes']||null:null,'limit':_0x24f360[_0x6fc1('0x19')]?_0x24f360[_0x6fc1('0x19')][_0x6fc1('0x1e')]||null:null})[_0x6fc1('0xb')](function(_0x28496a){logger['info']('UpdateWhatsappQueueReport',_0x24f360);logger[_0x6fc1('0xf')](_0x6fc1('0x1b'),_0x24f360,JSON[_0x6fc1('0x11')](_0x28496a));_0x1fe7cf(_0x28496a);})[_0x6fc1('0x15')](function(_0x1cbc55){logger[_0x6fc1('0x12')](_0x6fc1('0x1b'),_0x1cbc55[_0x6fc1('0x14')],_0x24f360);_0x98018c(_0x463c01[_0x6fc1('0x12')](0x1f4,_0x1cbc55[_0x6fc1('0x14')]));});});};