tango-app-api-analysis-traffic 3.0.0-alpha.58 → 3.0.0-alpha.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-analysis-traffic",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.59",
|
|
4
4
|
"description": "Traffic Analysis",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"nodemon": "^3.1.4",
|
|
25
25
|
"swagger-ui-express": "^5.0.1",
|
|
26
26
|
"tango-api-schema": "^2.2.7",
|
|
27
|
-
"tango-app-api-middleware": "^3.1.
|
|
27
|
+
"tango-app-api-middleware": "^3.1.47",
|
|
28
28
|
"winston": "^3.13.1",
|
|
29
29
|
"winston-daily-rotate-file": "^5.0.0"
|
|
30
30
|
},
|
|
@@ -7,7 +7,7 @@ export async function clientValidations( req, res, next ) {
|
|
|
7
7
|
const inputData = req.method === 'POST' ? req.body : req.query;
|
|
8
8
|
const clientId = req.user.userType === 'tango' ? inputData.clientId :req.user.clientId;
|
|
9
9
|
if ( !clientId ) {
|
|
10
|
-
return res.sendError( '
|
|
10
|
+
return res.sendError( 'Please enter a valid clientId', 400 );
|
|
11
11
|
}
|
|
12
12
|
req.clientId = clientId;
|
|
13
13
|
return next();
|
|
@@ -23,7 +23,7 @@ export async function roleVerification( req, res, next ) {
|
|
|
23
23
|
if ( [ 'admin', 'superadmin' ].includes( req?.user?.role ) ) {
|
|
24
24
|
return next();
|
|
25
25
|
} else {
|
|
26
|
-
return res.sendError( '
|
|
26
|
+
return res.sendError( 'Access Denied', 403 );
|
|
27
27
|
}
|
|
28
28
|
} catch ( error ) {
|
|
29
29
|
logger.error( { error: error, message: req.body, function: 'nob-roleVerification' } );
|
|
@@ -36,7 +36,7 @@ export async function fieldValidation( req, res, next ) {
|
|
|
36
36
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
37
37
|
const inputData = req.body;
|
|
38
38
|
if ( req.user.role !== 'superadmin' && req.user.userType !== 'tango'&& ( inputData?.assignedStores?.length == 0 || !inputData?.assignedStores ) ) {
|
|
39
|
-
return res.sendError( '
|
|
39
|
+
return res.sendError( 'Access Denied', 403 );
|
|
40
40
|
}
|
|
41
41
|
let tempInserData = [];
|
|
42
42
|
let filter = [];
|
|
@@ -53,7 +53,7 @@ export async function fieldValidation( req, res, next ) {
|
|
|
53
53
|
if ( seen.has( key ) ) {
|
|
54
54
|
logger.info( { message: 'deupkilicare' } );
|
|
55
55
|
// duplicates.push( { ...item, originalIndex: index } );
|
|
56
|
-
return res.sendError( `
|
|
56
|
+
return res.sendError( `Dublicate record exist`, 403 );
|
|
57
57
|
} else {
|
|
58
58
|
seen.set( key, i );
|
|
59
59
|
}
|
|
@@ -84,7 +84,7 @@ export async function fieldValidation( req, res, next ) {
|
|
|
84
84
|
];
|
|
85
85
|
let storeData= await aggregateStore( query );
|
|
86
86
|
if ( storeData?.length ==0 ) {
|
|
87
|
-
return res.sendError( `
|
|
87
|
+
return res.sendError( `Store ID / Store Code is not associated with this brand`, 403 );
|
|
88
88
|
} else {
|
|
89
89
|
let searchQuery={
|
|
90
90
|
'size': 1,
|
|
@@ -107,7 +107,7 @@ export async function fieldValidation( req, res, next ) {
|
|
|
107
107
|
};
|
|
108
108
|
let searchData=await getOpenSearchData( openSearch.nob, searchQuery );
|
|
109
109
|
if ( searchData?.body?.hits?.hits.length > 0 && searchData?.body?.hits?.hits[0]?._source?.createdAt !== searchData?.body?.hits?.hits[0]?._source?.updatedAt ) {
|
|
110
|
-
return res.sendError( `
|
|
110
|
+
return res.sendError( `You are restricted to re-upload/edit more than one time`, 403 );
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
let nobDateIso =new Date( inputFilter[i]?.nobDate );
|
|
@@ -132,11 +132,11 @@ export async function fieldValidation( req, res, next ) {
|
|
|
132
132
|
req.tempInserData = tempInserData;
|
|
133
133
|
return next();
|
|
134
134
|
} else {
|
|
135
|
-
return res.sendError( '
|
|
135
|
+
return res.sendError( 'One or more value is missing in row or column', 400 );
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
return res.sendError( '
|
|
139
|
+
return res.sendError( 'One or more value is missing in row or column', 400 );
|
|
140
140
|
} catch ( error ) {
|
|
141
141
|
logger.error( { error: error, message: req.body, function: 'nob-roleVerification' } );
|
|
142
142
|
return res.sendError( error, 500 );
|