tango-app-api-audit 3.3.0-alpha.10 → 3.3.0-alpha.12
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/app.js +38 -0
- package/package.json +3 -3
- package/src/controllers/audit.controllers.js +16 -10
- package/src/validation/audit.validation.js +1 -1
package/app.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { auditRouter } from './index.js';
|
|
3
|
+
import dotenv from 'dotenv';
|
|
4
|
+
import { logger } from 'tango-app-api-middleware';
|
|
5
|
+
import { connectdb } from './config/database/database.js';
|
|
6
|
+
import responseMiddleware from './config/response/response.js';
|
|
7
|
+
import errorMiddleware from './config/response/error.js';
|
|
8
|
+
import pkg from 'body-parser';
|
|
9
|
+
import { swaggerConfig } from './config/swagger/swagger.js';
|
|
10
|
+
import swagger from 'swagger-ui-express';
|
|
11
|
+
|
|
12
|
+
const { json, urlencoded } = pkg;
|
|
13
|
+
const env=dotenv.config();
|
|
14
|
+
|
|
15
|
+
const app = express();
|
|
16
|
+
const PORT = process.env.PORT || 3000;
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
app.use( json( { limit: '500mb' } ) );
|
|
20
|
+
app.use(
|
|
21
|
+
urlencoded( {
|
|
22
|
+
extended: true,
|
|
23
|
+
} ),
|
|
24
|
+
);
|
|
25
|
+
app.use( responseMiddleware );
|
|
26
|
+
app.use( errorMiddleware );
|
|
27
|
+
if ( env.error ) {
|
|
28
|
+
logger.error( '.env not found' );
|
|
29
|
+
process.exit( 1 );
|
|
30
|
+
}
|
|
31
|
+
app.use( '/api-docs', swagger.serve, swagger.setup( swaggerConfig ) );
|
|
32
|
+
app.use( '/v3/audit', auditRouter );
|
|
33
|
+
|
|
34
|
+
app.listen( PORT, () => {
|
|
35
|
+
logger.info( `server is running on port= ${PORT} ` );
|
|
36
|
+
connectdb();
|
|
37
|
+
} );
|
|
38
|
+
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-audit",
|
|
3
|
-
"version": "3.3.0-alpha.
|
|
3
|
+
"version": "3.3.0-alpha.12",
|
|
4
4
|
"description": "audit & audit metrics apis",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "app.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.10.0"
|
|
@@ -776,9 +776,9 @@ export async function workSpace( req, res ) {
|
|
|
776
776
|
}
|
|
777
777
|
if ( inputData.sortColumnName ) {
|
|
778
778
|
const sortBy = inputData.sortBy || -1;
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
$sort: { [
|
|
779
|
+
const sortColumn = inputData.sortColumnName;
|
|
780
|
+
query.push( {
|
|
781
|
+
$sort: { [sortColumn]: sortBy },
|
|
782
782
|
},
|
|
783
783
|
);
|
|
784
784
|
}
|
|
@@ -1620,9 +1620,10 @@ export async function userAuditHistory( req, res ) {
|
|
|
1620
1620
|
}
|
|
1621
1621
|
|
|
1622
1622
|
if ( inputData.sortColumnName ) {
|
|
1623
|
-
const sortBy =inputData.sortBy || -1;
|
|
1623
|
+
const sortBy = inputData.sortBy || -1;
|
|
1624
|
+
const sortColumn = inputData.sortColumnName;
|
|
1624
1625
|
query.push( {
|
|
1625
|
-
$sort: { [
|
|
1626
|
+
$sort: { [sortColumn]: sortBy },
|
|
1626
1627
|
},
|
|
1627
1628
|
);
|
|
1628
1629
|
}
|
|
@@ -1851,8 +1852,9 @@ export async function clientMetrics( req, res ) {
|
|
|
1851
1852
|
}
|
|
1852
1853
|
if ( inputData.sortColumnName ) {
|
|
1853
1854
|
const sortBy = inputData.sortBy || -1;
|
|
1855
|
+
const sortColumn = inputData.sortColumnName;
|
|
1854
1856
|
query.push( {
|
|
1855
|
-
$sort: { [
|
|
1857
|
+
$sort: { [sortColumn]: sortBy },
|
|
1856
1858
|
},
|
|
1857
1859
|
);
|
|
1858
1860
|
}
|
|
@@ -2125,8 +2127,9 @@ export async function storeMetrics( req, res ) {
|
|
|
2125
2127
|
|
|
2126
2128
|
if ( inputData.sortColumnName ) {
|
|
2127
2129
|
const sortBy = inputData.sortBy || -1;
|
|
2130
|
+
const sortColumn = inputData.sortColumnName;
|
|
2128
2131
|
query.push( {
|
|
2129
|
-
$sort: { [
|
|
2132
|
+
$sort: { [sortColumn]: sortBy },
|
|
2130
2133
|
},
|
|
2131
2134
|
);
|
|
2132
2135
|
}
|
|
@@ -2393,8 +2396,9 @@ export async function userMetrics( req, res ) {
|
|
|
2393
2396
|
}
|
|
2394
2397
|
if ( inputData.sortColumnName ) {
|
|
2395
2398
|
const sortBy = inputData.sortBy || -1;
|
|
2399
|
+
const sortColumn = inputData.sortColumnName;
|
|
2396
2400
|
query.push( {
|
|
2397
|
-
$sort: { [
|
|
2401
|
+
$sort: { [sortColumn]: sortBy },
|
|
2398
2402
|
},
|
|
2399
2403
|
);
|
|
2400
2404
|
}
|
|
@@ -2553,8 +2557,9 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2553
2557
|
}
|
|
2554
2558
|
if ( inputData.sortColumnName ) {
|
|
2555
2559
|
const sortBy = inputData.sortBy || -1;
|
|
2560
|
+
const sortColumn = inputData.sortColumnName;
|
|
2556
2561
|
query.push( {
|
|
2557
|
-
$sort: { [
|
|
2562
|
+
$sort: { [sortColumn]: sortBy },
|
|
2558
2563
|
},
|
|
2559
2564
|
);
|
|
2560
2565
|
}
|
|
@@ -3196,8 +3201,9 @@ export async function overviewTable( req, res ) {
|
|
|
3196
3201
|
}
|
|
3197
3202
|
if ( inputData.sortColumnName ) {
|
|
3198
3203
|
const sortBy = inputData.sortBy || -1;
|
|
3204
|
+
const sortColumn = inputData.sortColumnName;
|
|
3199
3205
|
query.push( {
|
|
3200
|
-
$sort: { [
|
|
3206
|
+
$sort: { [sortColumn]: sortBy },
|
|
3201
3207
|
},
|
|
3202
3208
|
);
|
|
3203
3209
|
}
|
|
@@ -246,7 +246,7 @@ export async function getAuditImageData( data ) {
|
|
|
246
246
|
if ( auditImages && auditImages?.length > 0 ) {
|
|
247
247
|
for ( let i = 0; i < auditImages.length; i++ ) {
|
|
248
248
|
const img = auditImages[i].Key.split( '/' );
|
|
249
|
-
const image = img[
|
|
249
|
+
const image = img[3].split( '.' );
|
|
250
250
|
const indexes = image[0].split( '_' );
|
|
251
251
|
const params = {
|
|
252
252
|
file_path: auditImages[i].Key,
|