tango-app-api-client 3.3.3-beta.11 → 3.3.3-beta.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 +40 -0
- package/package.json +42 -42
- package/src/controllers/client.controllers.js +8 -4
package/app.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { clientRouter } from './index.js';
|
|
3
|
+
|
|
4
|
+
import dotenv from 'dotenv';
|
|
5
|
+
import { logger } from 'tango-app-api-middleware';
|
|
6
|
+
import { connectdb } from './config/database/database.js';
|
|
7
|
+
import responseMiddleware from './config/response/response.js';
|
|
8
|
+
import errorMiddleware from './config/response/error.js';
|
|
9
|
+
import pkg from 'body-parser';
|
|
10
|
+
import { swaggerConfig } from './config/swagger/swagger.js';
|
|
11
|
+
import swagger from 'swagger-ui-express';
|
|
12
|
+
|
|
13
|
+
const { json, urlencoded } = pkg;
|
|
14
|
+
const env=dotenv.config();
|
|
15
|
+
|
|
16
|
+
const app = express();
|
|
17
|
+
const PORT = process.env.PORT || 3000;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
app.use( json( { limit: '500mb' } ) );
|
|
21
|
+
app.use(
|
|
22
|
+
urlencoded( {
|
|
23
|
+
extended: true,
|
|
24
|
+
} ),
|
|
25
|
+
);
|
|
26
|
+
app.use( responseMiddleware );
|
|
27
|
+
app.use( errorMiddleware );
|
|
28
|
+
|
|
29
|
+
if ( env.error ) {
|
|
30
|
+
logger.error( '.env not found' );
|
|
31
|
+
process.exit( 1 );
|
|
32
|
+
}
|
|
33
|
+
app.use( '/api-docs', swagger.serve, swagger.setup( swaggerConfig ) );
|
|
34
|
+
|
|
35
|
+
app.use( '/v3/client', clientRouter );
|
|
36
|
+
|
|
37
|
+
app.listen( PORT, () => {
|
|
38
|
+
logger.info( `server is running on port= ${PORT} ` );
|
|
39
|
+
connectdb();
|
|
40
|
+
} );
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tango-app-api-client",
|
|
3
|
-
"version": "3.3.3-beta.
|
|
4
|
-
"description": "client",
|
|
5
|
-
"main": "
|
|
6
|
-
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
9
|
-
},
|
|
10
|
-
"engines": {
|
|
11
|
-
"node": ">=18.10.0"
|
|
12
|
-
},
|
|
13
|
-
"author": "praveenraj",
|
|
14
|
-
"license": "ISC",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"aws-sdk": "^2.1560.0",
|
|
17
|
-
"cors": "^2.8.5",
|
|
18
|
-
"dotenv": "^16.4.4",
|
|
19
|
-
"express": "^4.18.2",
|
|
20
|
-
"express-fileupload": "^1.4.3",
|
|
21
|
-
"handlebars": "^4.7.8",
|
|
22
|
-
"joi": "^17.12.1",
|
|
23
|
-
"joi-to-swagger": "^6.2.0",
|
|
24
|
-
"lodash": "^4.17.21",
|
|
25
|
-
"mongodb": "^6.7.0",
|
|
26
|
-
"nodemon": "^3.0.3",
|
|
27
|
-
"npm": "^10.9.1",
|
|
28
|
-
"swagger-ui-express": "^5.0.0",
|
|
29
|
-
"tango-api-schema": "^2.2.59",
|
|
30
|
-
"tango-app-api-middleware": "^3.1.60",
|
|
31
|
-
"winston": "^3.11.0",
|
|
32
|
-
"winston-daily-rotate-file": "^5.0.0"
|
|
33
|
-
},
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"eslint": "^8.56.0",
|
|
36
|
-
"eslint-config-google": "^0.14.0",
|
|
37
|
-
"eslint-config-semistandard": "^17.0.0",
|
|
38
|
-
"eslint-config-standard": "^17.1.0",
|
|
39
|
-
"eslint-plugin-import": "^2.29.1",
|
|
40
|
-
"eslint-plugin-promise": "^6.1.1"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "tango-app-api-client",
|
|
3
|
+
"version": "3.3.3-beta.12",
|
|
4
|
+
"description": "client",
|
|
5
|
+
"main": "app.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=18.10.0"
|
|
12
|
+
},
|
|
13
|
+
"author": "praveenraj",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"aws-sdk": "^2.1560.0",
|
|
17
|
+
"cors": "^2.8.5",
|
|
18
|
+
"dotenv": "^16.4.4",
|
|
19
|
+
"express": "^4.18.2",
|
|
20
|
+
"express-fileupload": "^1.4.3",
|
|
21
|
+
"handlebars": "^4.7.8",
|
|
22
|
+
"joi": "^17.12.1",
|
|
23
|
+
"joi-to-swagger": "^6.2.0",
|
|
24
|
+
"lodash": "^4.17.21",
|
|
25
|
+
"mongodb": "^6.7.0",
|
|
26
|
+
"nodemon": "^3.0.3",
|
|
27
|
+
"npm": "^10.9.1",
|
|
28
|
+
"swagger-ui-express": "^5.0.0",
|
|
29
|
+
"tango-api-schema": "^2.2.59",
|
|
30
|
+
"tango-app-api-middleware": "^3.1.60",
|
|
31
|
+
"winston": "^3.11.0",
|
|
32
|
+
"winston-daily-rotate-file": "^5.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"eslint": "^8.56.0",
|
|
36
|
+
"eslint-config-google": "^0.14.0",
|
|
37
|
+
"eslint-config-semistandard": "^17.0.0",
|
|
38
|
+
"eslint-config-standard": "^17.1.0",
|
|
39
|
+
"eslint-plugin-import": "^2.29.1",
|
|
40
|
+
"eslint-plugin-promise": "^6.1.1"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -934,6 +934,7 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
934
934
|
try {
|
|
935
935
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
936
936
|
const url = JSON.parse( process.env.URL );
|
|
937
|
+
const previousData = await findOneClient( { clientId: req.params?.id }, { featureConfigs: 1 } );
|
|
937
938
|
const inputData = req.body;
|
|
938
939
|
if ( inputData?.bouncedLimitValue ) {
|
|
939
940
|
inputData.missedOpportunityFromValue = inputData?.bouncedLimitValue;
|
|
@@ -943,11 +944,12 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
943
944
|
inputData.missedOpportunityToValue = inputData?.conversionValue;
|
|
944
945
|
}
|
|
945
946
|
const updateAck = await featureConfigurationUpdate( { clientId: req.params?.id }, inputData );
|
|
946
|
-
|
|
947
|
+
const postData = await findOneClient( { clientId: req.params?.id }, { featureConfigs: 1 } );
|
|
947
948
|
let updateKeys = [];
|
|
948
949
|
|
|
949
950
|
if ( Object.keys( inputData ).length > 0 ) {
|
|
950
951
|
Object.keys( inputData ).forEach( ( element ) => {
|
|
952
|
+
element === 'billableCalculation'? 'potentialCalculation': element;
|
|
951
953
|
updateKeys.push( camelCaseToWords( element ) );
|
|
952
954
|
} );
|
|
953
955
|
}
|
|
@@ -1005,10 +1007,12 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
1005
1007
|
email: user?.email,
|
|
1006
1008
|
date: new Date(),
|
|
1007
1009
|
logType: 'configuration',
|
|
1008
|
-
logSubType: 'featureConfig',
|
|
1010
|
+
logSubType: inputData.includes['isExcludedArea', 'isPasserByData', 'isNormalized', 'isbillingDisabled', 'isCameraDisabled', 'isFootfallDirectory', 'isNOB', 'isNewTraffic', 'isTrax', 'isNewZone', 'isNewReports', 'isNewDashboard', 'streamBy']? 'dashboardConfig': 'featureConfig',
|
|
1009
1011
|
changes: updateKeys,
|
|
1010
1012
|
eventType: 'update',
|
|
1011
1013
|
showTo: [ 'client', 'tango' ],
|
|
1014
|
+
pervious: previousData,
|
|
1015
|
+
current: postData,
|
|
1012
1016
|
};
|
|
1013
1017
|
if ( updateKeys.length ) {
|
|
1014
1018
|
await insertOpenSearchData( openSearch.activityLog, logObj );
|
|
@@ -2094,7 +2098,7 @@ export async function getActivityLogs( req, res ) {
|
|
|
2094
2098
|
const previous = hit?._source?.previous;
|
|
2095
2099
|
const current=hit?._source?.current;
|
|
2096
2100
|
const logType =hit?._source?.logType;
|
|
2097
|
-
const logSubType =hit?._source?.logSubType;
|
|
2101
|
+
const logSubType =hit?._source?.logSubType === 'documentUpload'? 'documentsUpload': hit?._source?.logSubType;
|
|
2098
2102
|
respo = findDifferences( previous, current, logType, logSubType );
|
|
2099
2103
|
hit._source.updatedValue = respo;
|
|
2100
2104
|
temp.push( hit?._source );
|
|
@@ -2164,7 +2168,7 @@ function findDifferences( previous, current, logType, logSubType, path = '' ) {
|
|
|
2164
2168
|
newKey = userFriendlyKey;
|
|
2165
2169
|
}
|
|
2166
2170
|
|
|
2167
|
-
if ( newKey === 'Infra Email Alert' || newKey === 'Ip Whitelist' ) {
|
|
2171
|
+
if ( newKey === 'Infra Email Alert' || newKey === 'Ip Whitelist' || newKey === 'Excluded Area'|| newKey === 'Passer By Data'|| newKey === 'Normalized'|| newKey === 'Billing'|| newKey === 'Camera'|| newKey === 'Footfall Directory'|| newKey === 'NOB'|| newKey === 'New Traffic'|| newKey === 'Trax'|| newKey === 'New Zone'|| newKey === 'New Reports'|| newKey === 'New Dashboard'|| newKey === 'Stream Type' ) {
|
|
2168
2172
|
diff.previous = ( diff.previous == true || diff.previous == 'Enabled' ) ? 'Enabled' : 'Disabled';
|
|
2169
2173
|
diff.current = ( diff.current == true || diff.current == 'Enabled' ) ? 'Enabled' : 'Disabled';
|
|
2170
2174
|
}
|