Built motion from commit 85328c08.|2.5.50
[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 _0x17c2=['WhatsappQueueReport','body','options','raw','update','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../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'];(function(_0x872ec2,_0x22ee21){var _0x566774=function(_0x4db14e){while(--_0x4db14e){_0x872ec2['push'](_0x872ec2['shift']());}};_0x566774(++_0x22ee21);}(_0x17c2,0x128));var _0x217c=function(_0x4ee0ba,_0x340d2c){_0x4ee0ba=_0x4ee0ba-0x0;var _0x52917f=_0x17c2[_0x4ee0ba];return _0x52917f;};'use strict';var _=require(_0x217c('0x0'));var util=require('util');var moment=require(_0x217c('0x1'));var BPromise=require(_0x217c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x217c('0x3'));var db=require(_0x217c('0x4'))['db'];var utils=require(_0x217c('0x5'));var logger=require('../../config/logger')(_0x217c('0x6'));var config=require(_0x217c('0x7'));var jayson=require(_0x217c('0x8'));var client=jayson[_0x217c('0x9')][_0x217c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x432594,_0x8a6113,_0xb3cc8c){return new BPromise(function(_0x58dadf,_0x1d8e9f){return client[_0x217c('0xb')](_0x432594,_0xb3cc8c)[_0x217c('0xc')](function(_0x1b071c){logger[_0x217c('0xd')](_0x217c('0xe'),_0x8a6113,_0x217c('0xf'));logger[_0x217c('0x10')](_0x217c('0x11'),_0x8a6113,_0x217c('0xf'),JSON[_0x217c('0x12')](_0x1b071c));if(_0x1b071c['error']){if(_0x1b071c[_0x217c('0x13')]['code']===0x1f4){logger['error'](_0x217c('0xe'),_0x8a6113,_0x1b071c[_0x217c('0x13')]['message']);return _0x1d8e9f(_0x1b071c['error'][_0x217c('0x14')]);}logger[_0x217c('0x13')](_0x217c('0xe'),_0x8a6113,_0x1b071c['error'][_0x217c('0x14')]);return _0x58dadf(_0x1b071c[_0x217c('0x13')][_0x217c('0x14')]);}else{logger[_0x217c('0xd')](_0x217c('0xe'),_0x8a6113,'request\x20sent');_0x58dadf(_0x1b071c[_0x217c('0x15')][_0x217c('0x14')]);}})[_0x217c('0x16')](function(_0x76518a){logger[_0x217c('0x13')](_0x217c('0xe'),_0x8a6113,_0x76518a);_0x1d8e9f(_0x76518a);});});}exports[_0x217c('0x17')]=function(_0xd4bdce){var _0x2f68ba=this;return new Promise(function(_0xf2cba3,_0x1f7915){return db[_0x217c('0x18')]['create'](_0xd4bdce[_0x217c('0x19')],{'raw':_0xd4bdce['options']?_0xd4bdce[_0x217c('0x1a')][_0x217c('0x1b')]===undefined?!![]:![]:!![]})[_0x217c('0xc')](function(_0xe537d4){logger[_0x217c('0xd')](_0x217c('0x17'),_0xd4bdce);logger[_0x217c('0x10')]('CreateWhatsappQueueReport',_0xd4bdce,JSON[_0x217c('0x12')](_0xe537d4));_0xf2cba3(_0xe537d4);})['catch'](function(_0x426464){logger['error'](_0x217c('0x17'),_0x426464['message'],_0xd4bdce);_0x1f7915(_0x2f68ba[_0x217c('0x13')](0x1f4,_0x426464[_0x217c('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1f2449){var _0x36bd69=this;return new Promise(function(_0x1ecbd8,_0x3c07a0){return db['WhatsappQueueReport'][_0x217c('0x1c')](_0x1f2449['body'],{'raw':_0x1f2449[_0x217c('0x1a')]?_0x1f2449[_0x217c('0x1a')][_0x217c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f2449[_0x217c('0x1a')]?_0x1f2449['options']['where']||null:null,'attributes':_0x1f2449[_0x217c('0x1a')]?_0x1f2449['options'][_0x217c('0x1d')]||null:null,'limit':_0x1f2449['options']?_0x1f2449[_0x217c('0x1a')][_0x217c('0x1e')]||null:null})[_0x217c('0xc')](function(_0x52f6cd){logger[_0x217c('0xd')]('UpdateWhatsappQueueReport',_0x1f2449);logger[_0x217c('0x10')](_0x217c('0x1f'),_0x1f2449,JSON[_0x217c('0x12')](_0x52f6cd));_0x1ecbd8(_0x52f6cd);})[_0x217c('0x16')](function(_0x52c11b){logger[_0x217c('0x13')]('UpdateWhatsappQueueReport',_0x52c11b['message'],_0x1f2449);_0x3c07a0(_0x36bd69[_0x217c('0x13')](0x1f4,_0x52c11b[_0x217c('0x14')]));});});};