Built motion from commit 5ae82ce5.|2.6.7
[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 _0xc08c=['options','raw','update','where','attributes','limit','UpdateWhatsappQueueReport','debug','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','body'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc08c,0xda));var _0xcc08=function(_0x78a804,_0x3fb22d){_0x78a804=_0x78a804-0x0;var _0x390b13=_0xc08c[_0x78a804];return _0x390b13;};'use strict';var _=require('lodash');var util=require(_0xcc08('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc08('0x1'));var fs=require('fs');var Redis=require(_0xcc08('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc08('0x3'));var logger=require('../../config/logger')(_0xcc08('0x4'));var config=require(_0xcc08('0x5'));var jayson=require(_0xcc08('0x6'));var client=jayson[_0xcc08('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f5197,_0x11b6de,_0x3f8812){return new BPromise(function(_0x34cb6a,_0x2940b6){return client[_0xcc08('0x8')](_0x4f5197,_0x3f8812)[_0xcc08('0x9')](function(_0x57efd6){logger[_0xcc08('0xa')](_0xcc08('0xb'),_0x11b6de,_0xcc08('0xc'));logger['debug'](_0xcc08('0xd'),_0x11b6de,_0xcc08('0xc'),JSON[_0xcc08('0xe')](_0x57efd6));if(_0x57efd6['error']){if(_0x57efd6[_0xcc08('0xf')][_0xcc08('0x10')]===0x1f4){logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x57efd6[_0xcc08('0xf')][_0xcc08('0x11')]);return _0x2940b6(_0x57efd6['error'][_0xcc08('0x11')]);}logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x57efd6[_0xcc08('0xf')]['message']);return _0x34cb6a(_0x57efd6[_0xcc08('0xf')][_0xcc08('0x11')]);}else{logger[_0xcc08('0xa')](_0xcc08('0xb'),_0x11b6de,_0xcc08('0xc'));_0x34cb6a(_0x57efd6[_0xcc08('0x12')][_0xcc08('0x11')]);}})[_0xcc08('0x13')](function(_0x33b919){logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x33b919);_0x2940b6(_0x33b919);});});}exports[_0xcc08('0x14')]=function(_0x42700f){var _0x3d9434=this;return new Promise(function(_0xafabd5,_0x5a9eb5){return db['WhatsappQueueReport']['create'](_0x42700f[_0xcc08('0x15')],{'raw':_0x42700f[_0xcc08('0x16')]?_0x42700f[_0xcc08('0x16')][_0xcc08('0x17')]===undefined?!![]:![]:!![]})[_0xcc08('0x9')](function(_0x54d4fd){logger[_0xcc08('0xa')](_0xcc08('0x14'),_0x42700f);logger['debug'](_0xcc08('0x14'),_0x42700f,JSON[_0xcc08('0xe')](_0x54d4fd));_0xafabd5(_0x54d4fd);})[_0xcc08('0x13')](function(_0x54d263){logger[_0xcc08('0xf')]('CreateWhatsappQueueReport',_0x54d263[_0xcc08('0x11')],_0x42700f);_0x5a9eb5(_0x3d9434['error'](0x1f4,_0x54d263[_0xcc08('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4d9ee4){var _0x190ec7=this;return new Promise(function(_0x31322f,_0x2f616a){return db['WhatsappQueueReport'][_0xcc08('0x18')](_0x4d9ee4[_0xcc08('0x15')],{'raw':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x19')]||null:null,'attributes':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4['options'][_0xcc08('0x1a')]||null:null,'limit':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x1b')]||null:null})[_0xcc08('0x9')](function(_0x22fdf5){logger[_0xcc08('0xa')](_0xcc08('0x1c'),_0x4d9ee4);logger[_0xcc08('0x1d')](_0xcc08('0x1c'),_0x4d9ee4,JSON[_0xcc08('0xe')](_0x22fdf5));_0x31322f(_0x22fdf5);})[_0xcc08('0x13')](function(_0x3acca2){logger[_0xcc08('0xf')]('UpdateWhatsappQueueReport',_0x3acca2[_0xcc08('0x11')],_0x4d9ee4);_0x2f616a(_0x190ec7[_0xcc08('0xf')](0x1f4,_0x3acca2[_0xcc08('0x11')]));});});};