tango-app-api-audit 3.4.11-alpha.2 → 3.4.11-alpha.22
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 +2 -2
- package/src/controllers/audit.controllers.js +404 -342
- package/src/controllers/traxAudit.controllers.js +245 -105
- package/src/docs/audit.docs.js +14 -0
- package/src/dtos/audit.dtos.js +2 -0
- package/src/routes/audit.routes.js +3 -2
- package/src/service/auditUserWallet.service.js +4 -0
- package/src/service/auditUsers.service.js +4 -0
- package/src/validation/audit.validation.js +15 -0
- package/src/validation/traxAuditValidation.js +1 -0
|
@@ -2,6 +2,7 @@ import { checkFileExist, chunkArray, getJsonFileData, getObject, getQueueUrl, li
|
|
|
2
2
|
import { findOneUserAudit } from '../service/userAudit.service.js';
|
|
3
3
|
import { findOneStoreAudit } from '../service/storeAudit.service.js';
|
|
4
4
|
import AdmZip from 'adm-zip';
|
|
5
|
+
import { findOneAuditUsers } from '../service/auditUsers.service.js';
|
|
5
6
|
|
|
6
7
|
export async function isExistsQueue( req, res, next ) {
|
|
7
8
|
try {
|
|
@@ -333,4 +334,18 @@ export async function getAuditFilterData( data ) {
|
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
336
|
|
|
337
|
+
export async function isAuditUser( req, res, next ) {
|
|
338
|
+
try {
|
|
339
|
+
const userEmail = req.user?.email;
|
|
340
|
+
const getAuditUser = await findOneAuditUsers( { email: userEmail, isActive: true } );
|
|
341
|
+
if ( !getAuditUser ) {
|
|
342
|
+
return res.sendSuccess( { result: 0, isAuditUser: false } );
|
|
343
|
+
}
|
|
344
|
+
return next();
|
|
345
|
+
} catch ( error ) {
|
|
346
|
+
const err = error.message || 'Internal Server Error';
|
|
347
|
+
logger.error( { error: error, function: 'isAuditUser' } );
|
|
348
|
+
return res.sendError( err, 500 );
|
|
349
|
+
}
|
|
350
|
+
}
|
|
336
351
|
|