tango-app-api-audit 3.4.3-alpha.5 → 3.4.3-alpha.7
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 +1 -1
- package/src/controllers/audit.controllers.js +29 -23
- package/src/controllers/traxAudit.controllers.js +98 -13
- package/src/docs/traxAudit.docs.js +23 -1
- package/src/dtos/traxAudit.dtos.js +12 -0
- package/src/routes/traxAudit.routes.js +4 -3
- package/src/service/storeEmpDetection.service.js +5 -0
- package/src/validation/traxAuditValidation.js +47 -1
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
signedUrl,
|
|
10
10
|
getDate, getDateWithCustomizeTime,
|
|
11
11
|
getUTC,
|
|
12
|
+
getOpenSearchData,
|
|
12
13
|
} from 'tango-app-api-middleware';
|
|
13
14
|
import {
|
|
14
15
|
aggregateUserAudit,
|
|
@@ -4304,30 +4305,35 @@ export async function getUserAuditCountMTD( req, res ) {
|
|
|
4304
4305
|
|
|
4305
4306
|
export async function auditViewLogs( req, res ) {
|
|
4306
4307
|
try {
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4308
|
+
const inputData = req.query;
|
|
4309
|
+
const parsedOpenSearch = JSON.parse( process.env.OPENSEARCH );
|
|
4310
|
+
let downTimeQuery = {
|
|
4311
|
+
'size': 100,
|
|
4312
|
+
'query': {
|
|
4313
|
+
'bool': {
|
|
4314
|
+
'must': [
|
|
4315
|
+
{
|
|
4316
|
+
'term': {
|
|
4317
|
+
'doc.logData.fileDate.keyword': dayjs( inputData.fileDate ).format( 'DD-MM-YYYY' ),
|
|
4318
|
+
},
|
|
4319
|
+
},
|
|
4320
|
+
{
|
|
4321
|
+
'term': {
|
|
4322
|
+
'doc.logData.storeId.keyword': inputData.storeId,
|
|
4323
|
+
},
|
|
4324
|
+
},
|
|
4325
|
+
{
|
|
4326
|
+
'term': {
|
|
4327
|
+
'doc.logData.moduleType.keyword': inputData.moduleType,
|
|
4328
|
+
},
|
|
4329
|
+
},
|
|
4330
|
+
],
|
|
4325
4331
|
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4332
|
+
},
|
|
4333
|
+
},
|
|
4334
|
+
};
|
|
4335
|
+
const downtime = await getOpenSearchData( parsedOpenSearch.auditLog, downTimeQuery );
|
|
4336
|
+
return res.sendSuccess( downtime );
|
|
4331
4337
|
} catch ( err ) {
|
|
4332
4338
|
|
|
4333
4339
|
}
|
|
@@ -4,11 +4,11 @@ import { countDocumentsStore, findOneStore } from '../service/store.service.js';
|
|
|
4
4
|
import { findOneUser } from '../service/user.service.js';
|
|
5
5
|
import { aggregateUserEmpDetection, createUserEmpDetection, updateOneUserEmpDetection } from '../service/userEmpDetection.service.js';
|
|
6
6
|
import { aggregateTraxAuditData, findOneTraxAuditData } from '../service/traxAuditData.service.js';
|
|
7
|
-
import { aggregateClient } from '../service/client.service.js';
|
|
7
|
+
import { aggregateClient, findOneClient } from '../service/client.service.js';
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
9
|
import { aggregateAssignAudit } from '../service/assignAudit.service.js';
|
|
10
10
|
import { aggregateStoreEmpDetection, updateManyStoreEmpDetection, updateOneStoreEmpDetection } from '../service/storeEmpDetection.service.js';
|
|
11
|
-
import { listQueue } from 'tango-app-api-middleware/src/utils/aws/sqs.js';
|
|
11
|
+
import { listQueue, sendMessageToQueue } from 'tango-app-api-middleware/src/utils/aws/sqs.js';
|
|
12
12
|
import _ from 'lodash';
|
|
13
13
|
import mongoose from 'mongoose';
|
|
14
14
|
import { findOneAuditLog, createAuditLog,
|
|
@@ -337,13 +337,13 @@ import { updateOneEmpDetectionOutput } from '../service/empDetectionOutput.servi
|
|
|
337
337
|
// const data = await signedUrl( fetchData );
|
|
338
338
|
// const mapimg = {
|
|
339
339
|
// img_path: data,
|
|
340
|
-
// img_name: image[0],
|
|
341
|
-
// img_id:
|
|
340
|
+
// img_name: inputData.moduleType=='mobile-detection'?`${indexes[0]}-${indexes[3]}` :image[0],
|
|
341
|
+
// img_id: img[3],
|
|
342
342
|
// };
|
|
343
343
|
// files.push( {
|
|
344
344
|
// img_path: data,
|
|
345
|
-
// img_name: image[0],
|
|
346
|
-
// img_id:
|
|
345
|
+
// img_name: inputData.moduleType=='mobile-detection'?`${indexes[0]}-${indexes[3]}` :image[0],
|
|
346
|
+
// img_id: img[3],
|
|
347
347
|
// selected: false,
|
|
348
348
|
// dropped: false,
|
|
349
349
|
// count: 1,
|
|
@@ -3815,13 +3815,13 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
3815
3815
|
const data = await signedUrl( fetchData );
|
|
3816
3816
|
const mapimg = {
|
|
3817
3817
|
img_path: data,
|
|
3818
|
-
img_name: image[0],
|
|
3819
|
-
img_id:
|
|
3818
|
+
img_name: inputData.moduleType=='mobile-detection'?`${indexes[0]}-${indexes[3]}` :image[0],
|
|
3819
|
+
img_id: img[3],
|
|
3820
3820
|
};
|
|
3821
3821
|
files.push( {
|
|
3822
3822
|
img_path: data,
|
|
3823
|
-
img_name: image[0],
|
|
3824
|
-
img_id:
|
|
3823
|
+
img_name: inputData.moduleType=='mobile-detection'?`${indexes[0]}-${indexes[3]}` :image[0],
|
|
3824
|
+
img_id: img[3],
|
|
3825
3825
|
selected: false,
|
|
3826
3826
|
dropped: false,
|
|
3827
3827
|
count: 1,
|
|
@@ -3840,7 +3840,7 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
3840
3840
|
userId: req.user._id,
|
|
3841
3841
|
storeId: msg.storeId,
|
|
3842
3842
|
clientId: msg.storeId.split( '-' )[0],
|
|
3843
|
-
auditType: 'Audit',
|
|
3843
|
+
auditType: msg.auditType || 'Audit',
|
|
3844
3844
|
fileDate: msg.fileDate,
|
|
3845
3845
|
inputBucketName: msg.inputBucketName,
|
|
3846
3846
|
folderPath: msg.folderPath,
|
|
@@ -3861,7 +3861,7 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
3861
3861
|
userId: req.user._id,
|
|
3862
3862
|
storeId: msg.storeId,
|
|
3863
3863
|
clientId: msg.storeId.split( '-' )[0],
|
|
3864
|
-
auditType: 'Audit',
|
|
3864
|
+
auditType: msg.auditType || 'Audit',
|
|
3865
3865
|
fileDate: msg.fileDate,
|
|
3866
3866
|
folderPath: msg.folderPath,
|
|
3867
3867
|
inputBucketName: msg.inputBucketName,
|
|
@@ -3924,7 +3924,7 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
3924
3924
|
queueName: inputData.queueName,
|
|
3925
3925
|
storeId: storeId,
|
|
3926
3926
|
fileDate: fileDate,
|
|
3927
|
-
auditType: 'Audit',
|
|
3927
|
+
auditType: msg.auditType || 'Audit',
|
|
3928
3928
|
auditId: insertData._id,
|
|
3929
3929
|
userId: insertData.userId,
|
|
3930
3930
|
moduleType: inputData.moduleType,
|
|
@@ -4050,6 +4050,8 @@ export async function getDraftedData( req, res ) {
|
|
|
4050
4050
|
export async function save( req, res ) {
|
|
4051
4051
|
try {
|
|
4052
4052
|
const inputData = req.body;
|
|
4053
|
+
const getUserAuditData = await findOneUserEmpDetection( { _id: inputData.auditId } );
|
|
4054
|
+
inputData.clientId = getUserAuditData.clientId;
|
|
4053
4055
|
const query ={ storeId: inputData.storeId, moduleType: inputData.moduleType, fileDate: inputData.fileDate };
|
|
4054
4056
|
const data = await updateOneEmpDetectionOutput( query, { $set: inputData }, { upsert: true } );
|
|
4055
4057
|
if ( data ) {
|
|
@@ -4069,3 +4071,86 @@ export async function save( req, res ) {
|
|
|
4069
4071
|
return res.sendError( err, 500 );
|
|
4070
4072
|
}
|
|
4071
4073
|
}
|
|
4074
|
+
|
|
4075
|
+
export async function reTrigger( req, res ) {
|
|
4076
|
+
try {
|
|
4077
|
+
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
4078
|
+
const inputData = req.body;
|
|
4079
|
+
const message = req.sqs;
|
|
4080
|
+
const sqs = JSON.parse( process.env.SQS );
|
|
4081
|
+
const query = {
|
|
4082
|
+
storeId: inputData.storeId,
|
|
4083
|
+
fileDate: inputData.fileDate,
|
|
4084
|
+
moduleType: inputData.moduleType,
|
|
4085
|
+
};
|
|
4086
|
+
const getQueueName = await findOneClient( { clientId: req.audit.clientId }, { 'auditConfigs': 1 } );
|
|
4087
|
+
const queueName = inputData.moduleType == 'uniform-detection' ? getQueueName?.auditConfigs?.traxQueueName?.uniformDetection : getQueueName?.auditConfigs?.traxQueueName?.mobileDetection;
|
|
4088
|
+
if ( !getQueueName || queueName == '' ) {
|
|
4089
|
+
return res.sendError( 'queueName does not create', 400 );
|
|
4090
|
+
}
|
|
4091
|
+
const msg = {
|
|
4092
|
+
storeId: message.storeId,
|
|
4093
|
+
fileDate: message.fileDate,
|
|
4094
|
+
moduleType: message.moduleType,
|
|
4095
|
+
inputBucketName: message.inputBucketName,
|
|
4096
|
+
questionType: message.questionType,
|
|
4097
|
+
question: message.question,
|
|
4098
|
+
folderPath: message.folderPath,
|
|
4099
|
+
fileCount: message.fileCount,
|
|
4100
|
+
};
|
|
4101
|
+
const sqsProduceQueue = {
|
|
4102
|
+
QueueUrl: `${sqs.url}${queueName}`,
|
|
4103
|
+
MessageBody: JSON.stringify( msg ),
|
|
4104
|
+
};
|
|
4105
|
+
const sqsQueue = await sendMessageToQueue( sqsProduceQueue.QueueUrl, sqsProduceQueue.MessageBody );
|
|
4106
|
+
if ( sqsQueue?.errorCode ) {
|
|
4107
|
+
const error = sqsQueue?.errorMsg;
|
|
4108
|
+
const code = sqsQueue?.errorCode;
|
|
4109
|
+
return res.sendError( error, code );
|
|
4110
|
+
} else {
|
|
4111
|
+
if ( req.audit.status !== 'completed' ) {
|
|
4112
|
+
const userRecord = {
|
|
4113
|
+
auditStatus: 'skipped',
|
|
4114
|
+
isDraft: false,
|
|
4115
|
+
};
|
|
4116
|
+
const query = {
|
|
4117
|
+
storeId: inputData.storeId,
|
|
4118
|
+
fileDate: inputData.fileDate,
|
|
4119
|
+
auditStatus: req.audit.status,
|
|
4120
|
+
|
|
4121
|
+
};
|
|
4122
|
+
await updateOneUserEmpDetection( query, userRecord );
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
const storeRecord = {
|
|
4126
|
+
status: 'not_assign',
|
|
4127
|
+
};
|
|
4128
|
+
|
|
4129
|
+
await updateOneStoreEmpDetection( query, storeRecord );
|
|
4130
|
+
const logData = {
|
|
4131
|
+
userId: req.user._id,
|
|
4132
|
+
userName: req.user.userName,
|
|
4133
|
+
logType: 'traxAudit',
|
|
4134
|
+
logSubType: 'reTrigger',
|
|
4135
|
+
logData: {
|
|
4136
|
+
beforeCount: message.fileCount,
|
|
4137
|
+
afterCount: '',
|
|
4138
|
+
fileDate: inputData.fileDate,
|
|
4139
|
+
auditType: req.audit.auditType,
|
|
4140
|
+
storeId: inputData.storeId,
|
|
4141
|
+
moduleType: inputData.moduleType,
|
|
4142
|
+
queueName: queueName,
|
|
4143
|
+
triggerBy: req.user.userName,
|
|
4144
|
+
triggerId: req.user._id,
|
|
4145
|
+
},
|
|
4146
|
+
createdAt: new Date(),
|
|
4147
|
+
};
|
|
4148
|
+
await insertOpenSearchData( openSearch.auditLog, logData );
|
|
4149
|
+
}
|
|
4150
|
+
return res.sendSuccess( { result: 'The File has been Re-Triggered Succesfully' } );
|
|
4151
|
+
} catch ( error ) {
|
|
4152
|
+
const err = error.message;
|
|
4153
|
+
logger.error( { error: error, message: req.body, function: 'reTrigger' } );
|
|
4154
|
+
return res.sendError( err, 500 );
|
|
4155
|
+
}
|
|
4156
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import j2s from 'joi-to-swagger';
|
|
2
|
-
import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema, pendingSummaryTableSchema, overAllAuditSummarySchema, overviewTableSchema, summarySplitSchema, getUpdatedFileSchema, getDetectionFileValid, saveBinarySchema, saveDraftSchema, getDraftedDataSchema } from '../dtos/traxAudit.dtos.js';
|
|
2
|
+
import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema, pendingSummaryTableSchema, overAllAuditSummarySchema, overviewTableSchema, summarySplitSchema, getUpdatedFileSchema, getDetectionFileValid, saveBinarySchema, saveDraftSchema, getDraftedDataSchema, reTriggerValidSchema } from '../dtos/traxAudit.dtos.js';
|
|
3
3
|
|
|
4
4
|
export const traxAuditDocs = {
|
|
5
5
|
|
|
@@ -403,4 +403,26 @@ export const traxAuditDocs = {
|
|
|
403
403
|
},
|
|
404
404
|
},
|
|
405
405
|
},
|
|
406
|
+
'/v3/trax-audit/metrics/re-trigger': {
|
|
407
|
+
post: {
|
|
408
|
+
tags: [ 'Trax Audit' ],
|
|
409
|
+
description: `Manual re trigger a file`,
|
|
410
|
+
operationId: 'metrics/re-trigger',
|
|
411
|
+
parameters: {},
|
|
412
|
+
requestBody: {
|
|
413
|
+
content: {
|
|
414
|
+
'application/json': {
|
|
415
|
+
schema: j2s( reTriggerValidSchema ).swagger,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
responses: {
|
|
420
|
+
200: { description: 'Successful' },
|
|
421
|
+
401: { description: 'Unauthorized User' },
|
|
422
|
+
422: { description: 'Field Error' },
|
|
423
|
+
500: { description: 'Server Error' },
|
|
424
|
+
204: { description: 'Not Found' },
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
},
|
|
406
428
|
};
|
|
@@ -279,3 +279,15 @@ export const saveSchema = joi.object( {
|
|
|
279
279
|
export const saveValid = {
|
|
280
280
|
body: saveSchema,
|
|
281
281
|
};
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
export const reTriggerValidSchema = joi.object( {
|
|
285
|
+
fileDate: joi.string().required(),
|
|
286
|
+
storeId: joi.string().required(),
|
|
287
|
+
moduleType: joi.string().required(),
|
|
288
|
+
|
|
289
|
+
} );
|
|
290
|
+
|
|
291
|
+
export const reTriggerValid = {
|
|
292
|
+
body: reTriggerValidSchema,
|
|
293
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
2
|
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
3
|
-
import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid, summarySplitValid, overviewTableValid, getUpdatedFileValid, saveBinaryValid, getDraftedDataValid, saveDraftValid } from '../dtos/traxAudit.dtos.js';
|
|
3
|
+
import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid, summarySplitValid, overviewTableValid, getUpdatedFileValid, saveBinaryValid, getDraftedDataValid, saveDraftValid, reTriggerValidSchema } from '../dtos/traxAudit.dtos.js';
|
|
4
4
|
import { isExistsQueue } from '../validation/audit.validation.js';
|
|
5
|
-
import { clientMetrics, getAuditFile, getDetectionAuditFile, getUpdatedFile, overAllAuditSummary, overviewTable, pendingSummaryTable, saveBinary, storeMetrics, summarySplit, userAuditHistory, userMetrics, workSpace, saveDraft, getDraftedData, save } from '../controllers/traxAudit.controllers.js';
|
|
6
|
-
import { isTraxAuditDocumentExist, validateBinaryAudit } from '../validation/traxAuditValidation.js';
|
|
5
|
+
import { clientMetrics, getAuditFile, getDetectionAuditFile, getUpdatedFile, overAllAuditSummary, overviewTable, pendingSummaryTable, saveBinary, storeMetrics, summarySplit, userAuditHistory, userMetrics, workSpace, saveDraft, getDraftedData, save, reTrigger } from '../controllers/traxAudit.controllers.js';
|
|
6
|
+
import { isMappingAuditInputFolderExist, isTraxAuditDocumentExist, isuserEmpDocumentExist, validateBinaryAudit } from '../validation/traxAuditValidation.js';
|
|
7
7
|
|
|
8
8
|
export const traxAuditRouter = Router();
|
|
9
9
|
|
|
@@ -28,6 +28,7 @@ traxAuditRouter.post( '/metrics/store-metrics', isAllowedSessionHandler, validat
|
|
|
28
28
|
traxAuditRouter.post( '/metrics/user-metrics', isAllowedSessionHandler, validate( userMetricsValid ), userMetrics );
|
|
29
29
|
traxAuditRouter.post( '/metrics/pending-summary-table', isAllowedSessionHandler, validate( pendingSummaryTableValid ), pendingSummaryTable );
|
|
30
30
|
traxAuditRouter.post( '/metrics/overall-audit-summary', isAllowedSessionHandler, validate( overAllAuditSummaryValid ), overAllAuditSummary );
|
|
31
|
+
traxAuditRouter.post( '/metrics/re-trigger', isAllowedSessionHandler, validate( reTriggerValidSchema ), isuserEmpDocumentExist, isMappingAuditInputFolderExist, reTrigger );
|
|
31
32
|
|
|
32
33
|
// summary
|
|
33
34
|
|
|
@@ -5,9 +5,14 @@ export function aggregateStoreEmpDetection( query ) {
|
|
|
5
5
|
return storeEmpDetectionModel.aggregate( query, { collation: { locale: 'en', strength: 2 } } );
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export function findOneStoreEmpDetection( query ) {
|
|
9
|
+
return storeEmpDetectionModel.findOne( query );
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
export function updateOneStoreEmpDetection( query, record ) {
|
|
9
13
|
return storeEmpDetectionModel.updateOne( query, { $set: record } );
|
|
10
14
|
}
|
|
15
|
+
|
|
11
16
|
export function updateManyStoreEmpDetection( query, record ) {
|
|
12
17
|
return storeEmpDetectionModel.updateMany( query, { $set: record }, { upsert: true } );
|
|
13
18
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { logger } from 'tango-app-api-middleware';
|
|
1
|
+
import { checkFileExist, logger } from 'tango-app-api-middleware';
|
|
2
2
|
import { findOneBinaryAudit, updateOneBinaryAuditModel } from '../service/binaryAudit.service.js';
|
|
3
3
|
import { findOneUserEmpDetection } from '../service/userEmpDetection.service.js';
|
|
4
4
|
import { findOneTraxAuditData } from '../service/traxAuditData.service.js';
|
|
5
|
+
import { findOneStoreEmpDetection } from '../service/storeEmpDetection.service.js';
|
|
5
6
|
|
|
6
7
|
export async function validateUserEmpDetection( req, res, next ) {
|
|
7
8
|
try {
|
|
@@ -116,3 +117,48 @@ export async function isTraxAuditDocumentExist( req, res, next ) {
|
|
|
116
117
|
return res.sendError( err, 500 );
|
|
117
118
|
}
|
|
118
119
|
}
|
|
120
|
+
|
|
121
|
+
export async function isuserEmpDocumentExist( req, res, next ) {
|
|
122
|
+
try {
|
|
123
|
+
const inputData = req.body;
|
|
124
|
+
const query={
|
|
125
|
+
storeId: inputData.storeId,
|
|
126
|
+
fileDate: inputData.fileDate,
|
|
127
|
+
moduleType: inputData.moduleType,
|
|
128
|
+
};
|
|
129
|
+
const auditInfo = await findOneStoreEmpDetection( query );
|
|
130
|
+
if ( auditInfo ) {
|
|
131
|
+
const sqs = await findOneTraxAuditData( query, { sqs: 1 } );
|
|
132
|
+
req.sqs = sqs.sqs.Body;
|
|
133
|
+
req.audit = auditInfo;
|
|
134
|
+
return next();
|
|
135
|
+
} else {
|
|
136
|
+
return res.sendError( 'No audited Record', 400 );
|
|
137
|
+
}
|
|
138
|
+
} catch ( error ) {
|
|
139
|
+
const err = error.message || 'Internal Server Error';
|
|
140
|
+
logger.error( { error: error, message: req.body, function: 'isAuditFileExist' } );
|
|
141
|
+
return res.sendError( err, 500 );
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
export async function isMappingAuditInputFolderExist( req, res, next ) {
|
|
147
|
+
try {
|
|
148
|
+
// const inputData = req.method === 'POST' ? req.body : req.query;
|
|
149
|
+
const params={
|
|
150
|
+
Bucket: req.sqs.inputBucketName,
|
|
151
|
+
Key: req.sqs.folderPath.replace( /\/$/, '' ),
|
|
152
|
+
};
|
|
153
|
+
const isExist = await checkFileExist( params );
|
|
154
|
+
if ( isExist ) {
|
|
155
|
+
next();
|
|
156
|
+
} else {
|
|
157
|
+
return res.sendError( `Audit Input folder not available : ${req.sqs.folderPath}`, 400 );
|
|
158
|
+
}
|
|
159
|
+
} catch ( error ) {
|
|
160
|
+
const err = error.message || 'Internal Server Error';
|
|
161
|
+
logger.error( { error: error, message: req.query, function: 'isAuidtInputFolderExist' } );
|
|
162
|
+
return res.sendError( err, 500 );
|
|
163
|
+
}
|
|
164
|
+
}
|