tango-app-api-infra 3.0.78-dev → 3.0.79-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-infra",
3
- "version": "3.0.78-dev",
3
+ "version": "3.0.79-dev",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "mongodb": "^6.4.0",
27
27
  "nodemon": "^3.1.0",
28
28
  "swagger-ui-express": "^5.0.0",
29
- "tango-api-schema": "^2.0.101",
29
+ "tango-api-schema": "^2.0.103",
30
30
  "tango-app-api-middleware": "^1.0.70-test",
31
31
  "winston": "^3.12.0",
32
32
  "winston-daily-rotate-file": "^5.0.0"
@@ -48,3 +48,16 @@ export async function activityLog( req, res ) {
48
48
  return res.sendError( error, 500 );
49
49
  }
50
50
  }
51
+
52
+
53
+ export async function updateMatStatus( req, res ) {
54
+ try {
55
+ let update = await updateOneTangoTicket( { ticketId: req.body.ticketId }, { 'ticketDetails.matStatus': req.body.matStatus } );
56
+ if ( update ) {
57
+ res.sendSuccess( 'Updated Successfully' );
58
+ }
59
+ } catch ( error ) {
60
+ logger.error( { error: error, function: 'updateMatStatus' } );
61
+ return res.sendError( error, 500 );
62
+ }
63
+ }
@@ -1444,14 +1444,14 @@ export async function matTable( req, res ) {
1444
1444
  result.forEach( ( element ) => {
1445
1445
  exportdata.push( {
1446
1446
  'ticketId': element.ticketId,
1447
- 'issueDate': dayjs( element.issueDate ).format( 'DD-MM-YYYY' ),
1447
+ 'Date': dayjs( element.issueDate ).format( 'DD-MM-YYYY' ),
1448
1448
  'storeId': element.storeId,
1449
1449
  'storeName': element.storeName,
1450
1450
  'clientId': element.clientId,
1451
1451
  'clientName': element.clientName,
1452
1452
  'userName': element.userName,
1453
1453
  'userEmail': element.userEmail,
1454
- 'Status': element.installationStatus,
1454
+ 'Status': element.status,
1455
1455
  } );
1456
1456
  } );
1457
1457
  await download( exportdata, res );
@@ -165,6 +165,7 @@ export async function userTicketList( req, res ) {
165
165
  issueStatus: '$ticketDetails.issueStatus',
166
166
  ticketType: '$ticketDetails.ticketType',
167
167
  installationStatus: '$ticketDetails.installationStatus',
168
+ matStatus: '$ticketDetails.matStatus',
168
169
  primaryIssue: {
169
170
  $filter: {
170
171
  input: '$ticketActivity',
@@ -196,6 +197,7 @@ export async function userTicketList( req, res ) {
196
197
  status: 1,
197
198
  issueType: 1,
198
199
  installationStatus: 1,
200
+ matStatus: 1,
199
201
  infraIssue: '$primaryIssue.reasons.primaryIssue',
200
202
  },
201
203
  },
@@ -210,6 +212,7 @@ export async function userTicketList( req, res ) {
210
212
  issueType: { $first: '$issueType' },
211
213
  status: { $first: '$status' },
212
214
  installationStatus: { $first: '$installationStatus' },
215
+ matStatus: { $first: '$matStatus' },
213
216
  issueStatus: { $first: '$issueStatus' },
214
217
  ticketType: { $first: '$ticketType' },
215
218
  infraIssue: { $last: '$infraIssue' },
@@ -234,6 +237,7 @@ export async function userTicketList( req, res ) {
234
237
  $or: [
235
238
  { issueStatus: req.body.filter },
236
239
  { infraIssue: req.body.filter },
240
+ { issueType: req.body.filter },
237
241
  ],
238
242
  },
239
243
  } );
@@ -242,13 +246,23 @@ export async function userTicketList( req, res ) {
242
246
  if ( req.body.export ) {
243
247
  const exportdata = [];
244
248
  ticketList.forEach( ( element ) => {
245
- exportdata.push( {
249
+ let data = {
246
250
  'DATE': element.Date,
247
251
  'TICKET ID': element.ticketId,
248
252
  'STORE ID': element.storeId,
249
- 'ISSUE': element.issueStatus,
253
+ 'STORE NAME': element.storeName,
250
254
  'STATUS': element.status,
251
- } );
255
+ };
256
+ if ( req.body.issueType ==='infra' ) {
257
+ data = { ...data, ...{ 'ISSUE': element.issueStatus } };
258
+ }
259
+ if ( req.body.issueType ==='installation' ) {
260
+ data = { ...data, ...{ 'ISSUE': element.issueStatus } };
261
+ }
262
+ if ( req.body.issueType ==='dataMismatch' ) {
263
+ data = { ...data, ...{ 'ISSUE TYPE': element.issueType } };
264
+ }
265
+ exportdata.push( data );
252
266
  } );
253
267
  await download( exportdata, res );
254
268
  return;
@@ -510,19 +524,24 @@ export async function workHistory( req, res ) {
510
524
  if ( req.body.export ) {
511
525
  const exportdata = [];
512
526
  result.forEach( ( element ) => {
513
- exportdata.push( {
527
+ let data ={
514
528
  'CREATED ON': dayjs( element.issueDate ).format( 'DD-MM-YYYY' ),
515
529
  'TICKET ID': element.ticketId,
516
530
  'STORE ID': element.storeId,
517
531
  'STORE NAME': element.storeName,
518
532
  'CLIENT ID': element.clientId,
519
533
  'CLIENT NAME': element.clientName,
520
- 'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate,
521
534
  'CLOSED ON': element.issueClosedDate,
522
- 'ISSUE': element.infraIssue?element.infraIssue:'-',
523
535
  'STATUS': element.status,
524
- } );
536
+ };
537
+ exportdata.push( data );
525
538
  } );
539
+ if ( req.body.issueType==='infra'||req.body.issueType==='installation' ) {
540
+ data = { ...data, ...{ 'ISSUE': element.infraIssue?element.infraIssue:'-', 'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate } };
541
+ }
542
+ if ( req.body.issueType==='dataMismatch' ) {
543
+ data = { ...data, ...{ 'issueType': element.issueType?element.issueType:'-' } };
544
+ }
526
545
  await download( exportdata, res );
527
546
  return;
528
547
  }
@@ -1,4 +1,4 @@
1
- import { createTicket, updatecomment, activityLog } from '../controllers/employeeTraning.controller.js';
1
+ import { createTicket, updatecomment, activityLog, updateMatStatus } from '../controllers/employeeTraning.controller.js';
2
2
  import { ticketExists, validateDetails } from '../validations/infra.validation.js';
3
3
  import express from 'express';
4
4
  import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
@@ -15,3 +15,7 @@ employeeTrainigRouter.post( '/activityLog', isAllowedSessionHandler, authorize(
15
15
  userType: [ 'tango' ], access: [
16
16
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
17
17
  } ), ticketExists, activityLog );
18
+ employeeTrainigRouter.post( '/updateMatStatus', isAllowedSessionHandler, authorize( {
19
+ userType: [ 'tango' ], access: [
20
+ { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
21
+ } ), ticketExists, updateMatStatus );
@@ -186,7 +186,7 @@ export async function ticketExists( req, res, next ) {
186
186
  req.body.ticketActivity = Ticket.ticketActivity;
187
187
  req.body.status = Ticket.status;
188
188
  req.body.issueDate = Ticket.issueDate;
189
-
189
+ req.body.dataMismatch = Ticket.dataMismatch;
190
190
 
191
191
  next();
192
192
  } catch ( error ) {