Built motion from commit 43538d75.|2.5.35
[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 _0xcf52=['request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','raw','UpdateWhatsappQueueReport','update','options','where','limit','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x511b17,_0xe6b453){var _0x4fa333=function(_0x5f13e3){while(--_0x5f13e3){_0x511b17['push'](_0x511b17['shift']());}};_0x4fa333(++_0xe6b453);}(_0xcf52,0x189));var _0x2cf5=function(_0x2ab930,_0x2ff7fb){_0x2ab930=_0x2ab930-0x0;var _0x416b8f=_0xcf52[_0x2ab930];return _0x416b8f;};'use strict';var _=require(_0x2cf5('0x0'));var util=require('util');var moment=require(_0x2cf5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cf5('0x2'));var db=require(_0x2cf5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cf5('0x4'))(_0x2cf5('0x5'));var config=require(_0x2cf5('0x6'));var jayson=require(_0x2cf5('0x7'));var client=jayson[_0x2cf5('0x8')][_0x2cf5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9f64,_0x4a3234,_0x5f119a){return new BPromise(function(_0x41e1b7,_0x15e1b4){return client[_0x2cf5('0xa')](_0x2a9f64,_0x5f119a)[_0x2cf5('0xb')](function(_0x10e7ad){logger[_0x2cf5('0xc')](_0x2cf5('0xd'),_0x4a3234,'request\x20sent');logger[_0x2cf5('0xe')](_0x2cf5('0xf'),_0x4a3234,'request\x20sent',JSON[_0x2cf5('0x10')](_0x10e7ad));if(_0x10e7ad['error']){if(_0x10e7ad[_0x2cf5('0x11')][_0x2cf5('0x12')]===0x1f4){logger['error'](_0x2cf5('0xd'),_0x4a3234,_0x10e7ad['error']['message']);return _0x15e1b4(_0x10e7ad[_0x2cf5('0x11')]['message']);}logger[_0x2cf5('0x11')](_0x2cf5('0xd'),_0x4a3234,_0x10e7ad[_0x2cf5('0x11')][_0x2cf5('0x13')]);return _0x41e1b7(_0x10e7ad[_0x2cf5('0x11')][_0x2cf5('0x13')]);}else{logger[_0x2cf5('0xc')](_0x2cf5('0xd'),_0x4a3234,_0x2cf5('0x14'));_0x41e1b7(_0x10e7ad['result'][_0x2cf5('0x13')]);}})[_0x2cf5('0x15')](function(_0x1825e3){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x4a3234,_0x1825e3);_0x15e1b4(_0x1825e3);});});}exports[_0x2cf5('0x16')]=function(_0x1c5c46){var _0x45ff52=this;return new Promise(function(_0x35f70c,_0x4684b4){return db[_0x2cf5('0x17')]['create'](_0x1c5c46[_0x2cf5('0x18')],{'raw':_0x1c5c46['options']?_0x1c5c46['options'][_0x2cf5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x280f94){logger[_0x2cf5('0xc')]('CreateWhatsappQueueReport',_0x1c5c46);logger['debug'](_0x2cf5('0x16'),_0x1c5c46,JSON[_0x2cf5('0x10')](_0x280f94));_0x35f70c(_0x280f94);})['catch'](function(_0x33657e){logger[_0x2cf5('0x11')]('CreateWhatsappQueueReport',_0x33657e[_0x2cf5('0x13')],_0x1c5c46);_0x4684b4(_0x45ff52[_0x2cf5('0x11')](0x1f4,_0x33657e[_0x2cf5('0x13')]));});});};exports[_0x2cf5('0x1a')]=function(_0x294a22){var _0x49435b=this;return new Promise(function(_0x4a23cf,_0x13a267){return db[_0x2cf5('0x17')][_0x2cf5('0x1b')](_0x294a22[_0x2cf5('0x18')],{'raw':_0x294a22[_0x2cf5('0x1c')]?_0x294a22[_0x2cf5('0x1c')][_0x2cf5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294a22[_0x2cf5('0x1c')]?_0x294a22[_0x2cf5('0x1c')][_0x2cf5('0x1d')]||null:null,'attributes':_0x294a22[_0x2cf5('0x1c')]?_0x294a22[_0x2cf5('0x1c')]['attributes']||null:null,'limit':_0x294a22[_0x2cf5('0x1c')]?_0x294a22[_0x2cf5('0x1c')][_0x2cf5('0x1e')]||null:null})[_0x2cf5('0xb')](function(_0x275607){logger[_0x2cf5('0xc')](_0x2cf5('0x1a'),_0x294a22);logger[_0x2cf5('0xe')](_0x2cf5('0x1a'),_0x294a22,JSON[_0x2cf5('0x10')](_0x275607));_0x4a23cf(_0x275607);})['catch'](function(_0x4ead75){logger[_0x2cf5('0x11')](_0x2cf5('0x1a'),_0x4ead75['message'],_0x294a22);_0x13a267(_0x49435b[_0x2cf5('0x11')](0x1f4,_0x4ead75[_0x2cf5('0x13')]));});});};