tango-app-api-report 3.3.2 → 3.3.3
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
|
@@ -7,7 +7,7 @@ export async function isReportEnable( req, res, next ) {
|
|
|
7
7
|
const inputData = req.method !== 'GET'? req.body: req.query;
|
|
8
8
|
const getReportName = await findOneClient( { 'clientId': inputData.clientId, 'status': { $in: [ 'active', 'hold' ] }, 'reportConfigs.report': true }, { '_id': 0, 'reportConfigs.reportName': 1, 'clientName': 1 } );
|
|
9
9
|
if ( !getReportName ) {
|
|
10
|
-
return res.sendError( 'This action was
|
|
10
|
+
return res.sendError( 'This action was forbidden', 403 );
|
|
11
11
|
}
|
|
12
12
|
req.report = getReportName;
|
|
13
13
|
return next();
|
|
@@ -36,11 +36,13 @@ export async function isFolderExist( req, res, next ) {
|
|
|
36
36
|
try {
|
|
37
37
|
const bucket = JSON.parse( process.env.BUCKET );
|
|
38
38
|
const inputData = req.query;
|
|
39
|
+
const getReportName = await findOneClient( { 'clientId': inputData.clientId, 'reportConfigs.report': true }, { '_id': 0, 'reportConfigs.reportName': 1, 'clientName': 1 } );
|
|
40
|
+
req.report = getReportName;
|
|
39
41
|
const fetchData = {
|
|
40
42
|
Bucket: bucket.reportBucket,
|
|
41
|
-
Key: `${inputData.fileDate}/${
|
|
43
|
+
Key: `${inputData.fileDate}/${getReportName?.reportConfigs?.reportName}/`,
|
|
42
44
|
};
|
|
43
|
-
logger.info( { fetchData: fetchData, report:
|
|
45
|
+
logger.info( { fetchData: fetchData, report: getReportName?.reportConfigs?.reportName } );
|
|
44
46
|
const isExist = await checkFileExist( fetchData );
|
|
45
47
|
if ( isExist ) {
|
|
46
48
|
return next();
|