tango-app-api-infra 3.0.19-dev → 3.0.21-dev
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
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import { infraRouter, internalInfraRouter, userInfraRouter, storeInfraRouter, clientInfraRouter } from './index.js';
|
|
4
|
+
import dotenv from 'dotenv';
|
|
5
|
+
import responseMiddleware from './config/response/response.js';
|
|
6
|
+
import errorMiddleware from './config/response/error.js';
|
|
7
|
+
import { connectdb } from './config/database/database.js';
|
|
8
|
+
import pkg from 'body-parser';
|
|
9
|
+
import cors from 'cors';
|
|
10
|
+
const { json, urlencoded } = pkg;
|
|
11
|
+
import fileUpload from 'express-fileupload';
|
|
12
|
+
const env=dotenv.config();
|
|
13
|
+
|
|
14
|
+
const app = express();
|
|
15
|
+
const PORT = process.env.PORT || 3000;
|
|
16
|
+
app.use( fileUpload() );
|
|
17
|
+
|
|
18
|
+
if ( env.error ) {
|
|
19
|
+
logger.error( '.env not found' );
|
|
20
|
+
process.exit( 1 );
|
|
21
|
+
}
|
|
22
|
+
app.use( json( { limit: '500mb' } ) );
|
|
23
|
+
app.use(
|
|
24
|
+
urlencoded( {
|
|
25
|
+
extended: true,
|
|
26
|
+
} ),
|
|
27
|
+
);
|
|
28
|
+
app.use( cors() );
|
|
29
|
+
app.use( responseMiddleware );
|
|
30
|
+
app.use( errorMiddleware );
|
|
31
|
+
app.use( '/infra', infraRouter );
|
|
32
|
+
app.use( '/internalInfra', internalInfraRouter );
|
|
33
|
+
app.use( '/userInfra', userInfraRouter );
|
|
34
|
+
app.use( '/storeInfra', storeInfraRouter );
|
|
35
|
+
app.use( '/clientInfra', clientInfraRouter );
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
app.listen( PORT, () => {
|
|
39
|
+
console.log( `server is running on port= ${PORT} ` );
|
|
40
|
+
connectdb();
|
|
41
|
+
} );
|
|
42
|
+
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-infra",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.21-dev",
|
|
4
4
|
"description": "infra",
|
|
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"
|
|
@@ -154,6 +154,7 @@ export async function activeTicketList( req, res ) {
|
|
|
154
154
|
$project: {
|
|
155
155
|
storeId: '$basicDetails.storeId',
|
|
156
156
|
ticketId: 1,
|
|
157
|
+
clientId: '$basicDetails.clientId',
|
|
157
158
|
storeName: '$basicDetails.storeName',
|
|
158
159
|
address: { $ifNull: [ '$basicDetails.address', '' ] },
|
|
159
160
|
status: 1,
|
|
@@ -401,6 +402,7 @@ export async function storeInfraList( req, res ) {
|
|
|
401
402
|
{
|
|
402
403
|
$group: {
|
|
403
404
|
_id: '$storeId',
|
|
405
|
+
store: { $first: '$_id' },
|
|
404
406
|
storeId: { $first: '$storeId' },
|
|
405
407
|
storeName: { $first: '$storeName' },
|
|
406
408
|
status: { $first: '$status' },
|
|
@@ -18,7 +18,7 @@ export async function validateDetails( req, res, next ) {
|
|
|
18
18
|
req.body.basicDetails = {
|
|
19
19
|
storeId: req.body.storeId,
|
|
20
20
|
storeName: store.storeName,
|
|
21
|
-
address: store.storeProfile&&store.storeProfile.address?store.storeProfile.address:'',
|
|
21
|
+
address: store.storeProfile && store.storeProfile.address ? store.storeProfile.address : '',
|
|
22
22
|
clientId: store.clientId,
|
|
23
23
|
clientName: client.clientName,
|
|
24
24
|
};
|
|
@@ -72,7 +72,7 @@ export async function validateTicket( req, res, next ) {
|
|
|
72
72
|
};
|
|
73
73
|
export async function ticketExists( req, res, next ) {
|
|
74
74
|
try {
|
|
75
|
-
let ticketId = req.body.ticketId?req.body.ticketId:req.params.ticketId;
|
|
75
|
+
let ticketId = req.body.ticketId ? req.body.ticketId : req.params.ticketId;
|
|
76
76
|
let Ticket = await findOneTangoTicket(
|
|
77
77
|
{
|
|
78
78
|
ticketId: ticketId,
|
|
@@ -146,17 +146,18 @@ export async function InfrastepstoResolve( req, res, next ) {
|
|
|
146
146
|
secondaryIsssue: [ ...secondaryReason.stepstoResolve ],
|
|
147
147
|
} );
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
if ( req.body.primary != 'Store Operation Issues' && req.body.primary != 'Application Issues' ) {
|
|
150
|
+
req.body.ticketActivity.push( {
|
|
151
|
+
actionType: 'stepsToResolve',
|
|
152
|
+
actionBy: 'Tango',
|
|
153
|
+
reasons: steptoReslove.map( ( item ) => ( {
|
|
154
|
+
primaryIssue: item.primaryIssue,
|
|
155
|
+
secondaryIssue: item.secondaryIsssue.map( ( issue ) => ( {
|
|
156
|
+
name: issue.name, // Assuming each object has a 'name' property
|
|
157
|
+
} ) ),
|
|
157
158
|
} ) ),
|
|
158
|
-
} )
|
|
159
|
-
}
|
|
159
|
+
} );
|
|
160
|
+
}
|
|
160
161
|
next();
|
|
161
162
|
} catch ( error ) {
|
|
162
163
|
logger.error( { error: error, function: 'InfrastepstoResolve' } );
|