6c31c6e4f0e55fd1f4ce8b4f033f473ddfe623a0
[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 _0x5f83=['attributes','limit','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x5f83,0xe2));var _0x35f8=function(_0x45d087,_0x23aa46){_0x45d087=_0x45d087-0x0;var _0x587205=_0x5f83[_0x45d087];return _0x587205;};'use strict';var _=require('lodash');var util=require(_0x35f8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35f8('0x1'));var fs=require('fs');var Redis=require(_0x35f8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x35f8('0x3'));var logger=require('../../config/logger')(_0x35f8('0x4'));var config=require(_0x35f8('0x5'));var jayson=require(_0x35f8('0x6'));var client=jayson[_0x35f8('0x7')][_0x35f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31397c,_0x630dd5,_0x2bfb83){return new BPromise(function(_0x1b44e6,_0x26c31a){return client[_0x35f8('0x9')](_0x31397c,_0x2bfb83)[_0x35f8('0xa')](function(_0x223125){logger[_0x35f8('0xb')](_0x35f8('0xc'),_0x630dd5,_0x35f8('0xd'));logger[_0x35f8('0xe')](_0x35f8('0xf'),_0x630dd5,_0x35f8('0xd'),JSON[_0x35f8('0x10')](_0x223125));if(_0x223125[_0x35f8('0x11')]){if(_0x223125[_0x35f8('0x11')]['code']===0x1f4){logger[_0x35f8('0x11')](_0x35f8('0xc'),_0x630dd5,_0x223125[_0x35f8('0x11')]['message']);return _0x26c31a(_0x223125[_0x35f8('0x11')][_0x35f8('0x12')]);}logger[_0x35f8('0x11')](_0x35f8('0xc'),_0x630dd5,_0x223125[_0x35f8('0x11')][_0x35f8('0x12')]);return _0x1b44e6(_0x223125['error']['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x630dd5,_0x35f8('0xd'));_0x1b44e6(_0x223125[_0x35f8('0x13')][_0x35f8('0x12')]);}})[_0x35f8('0x14')](function(_0x2418f9){logger[_0x35f8('0x11')](_0x35f8('0xc'),_0x630dd5,_0x2418f9);_0x26c31a(_0x2418f9);});});}exports[_0x35f8('0x15')]=function(_0xb6db3b){var _0x58962c=this;return new Promise(function(_0x1f5f87,_0x15520a){return db[_0x35f8('0x16')][_0x35f8('0x17')](_0xb6db3b[_0x35f8('0x18')],{'raw':_0xb6db3b['options']?_0xb6db3b[_0x35f8('0x19')][_0x35f8('0x1a')]===undefined?!![]:![]:!![]})[_0x35f8('0xa')](function(_0x2b33d4){logger[_0x35f8('0xb')]('CreateWhatsappQueueReport',_0xb6db3b);logger['debug']('CreateWhatsappQueueReport',_0xb6db3b,JSON[_0x35f8('0x10')](_0x2b33d4));_0x1f5f87(_0x2b33d4);})[_0x35f8('0x14')](function(_0x23d70f){logger['error'](_0x35f8('0x15'),_0x23d70f[_0x35f8('0x12')],_0xb6db3b);_0x15520a(_0x58962c['error'](0x1f4,_0x23d70f['message']));});});};exports[_0x35f8('0x1b')]=function(_0x1e3e1c){var _0x503822=this;return new Promise(function(_0x4ecd5a,_0x37938a){return db[_0x35f8('0x16')][_0x35f8('0x1c')](_0x1e3e1c[_0x35f8('0x18')],{'raw':_0x1e3e1c[_0x35f8('0x19')]?_0x1e3e1c[_0x35f8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e3e1c[_0x35f8('0x19')]?_0x1e3e1c[_0x35f8('0x19')][_0x35f8('0x1d')]||null:null,'attributes':_0x1e3e1c[_0x35f8('0x19')]?_0x1e3e1c[_0x35f8('0x19')][_0x35f8('0x1e')]||null:null,'limit':_0x1e3e1c[_0x35f8('0x19')]?_0x1e3e1c[_0x35f8('0x19')][_0x35f8('0x1f')]||null:null})[_0x35f8('0xa')](function(_0x1512d1){logger[_0x35f8('0xb')](_0x35f8('0x1b'),_0x1e3e1c);logger[_0x35f8('0xe')](_0x35f8('0x1b'),_0x1e3e1c,JSON[_0x35f8('0x10')](_0x1512d1));_0x4ecd5a(_0x1512d1);})[_0x35f8('0x14')](function(_0x5932e4){logger[_0x35f8('0x11')]('UpdateWhatsappQueueReport',_0x5932e4[_0x35f8('0x12')],_0x1e3e1c);_0x37938a(_0x503822[_0x35f8('0x11')](0x1f4,_0x5932e4['message']));});});};