tango-app-api-infra 3.0.47-dev → 3.0.49-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.47-dev",
3
+ "version": "3.0.49-dev",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -16,7 +16,7 @@ export async function infraCard( req, res ) {
16
16
  $match: {
17
17
  $and: [
18
18
  { issueType: 'infra' },
19
- { 'status': { $ne: 'closed' } },
19
+ { status: { $ne: 'closed' } },
20
20
  { 'basicDetails.clientId': { $in: req.body.clientId } },
21
21
  { createdAt: { $gte: date.start } },
22
22
  { createdAt: { $lte: date.end } },
@@ -50,7 +50,7 @@ export async function infraCard( req, res ) {
50
50
  $match: {
51
51
  $and: [
52
52
  { issueType: 'infra' },
53
- { 'status': { $ne: 'closed' } },
53
+ { 'ticketDetails.issueStatus': 'identified' },
54
54
  { 'basicDetails.clientId': { $in: req.body.clientId } },
55
55
  { 'ticketDetails.issueStatus': 'identified' },
56
56
  { createdAt: { $gte: date.start } },
@@ -12,6 +12,7 @@ import { join } from 'path';
12
12
  import handlebars from 'handlebars';
13
13
  import { findOneGroup } from '../services/group.service.js';
14
14
  import htmlpdf from 'html-pdf-node';
15
+ import mongoose from 'mongoose';
15
16
  export async function createTicket( req, res ) {
16
17
  try {
17
18
  req.body.issueDate = new Date( req.body.Date );
@@ -478,7 +479,7 @@ export async function emailUserList( req, res ) {
478
479
  } else if ( user.role != 'superadmin' ) {
479
480
  if ( user.assignedType == 'group' ) {
480
481
  for ( let group of user.assignedValue ) {
481
- let groupdata = await findOneGroup( { groupName: group } );
482
+ let groupdata = await findOneGroup( { _id: new mongoose.Types.ObjectId( group ), clientId: inputData.clientId } );
482
483
  let storelist = await findStore( { clientId: inputData.clientId, storeId: { $in: groupdata.storeList } }, { storeName: 1 } );
483
484
  user.assigned = storelist.length;
484
485
  user.assignedValue = storelist;
@@ -334,11 +334,10 @@ export async function edgeAppLogTable( req, res ) {
334
334
  const sum = streamwiseDowntime.reduce( ( accumulator, currentValue ) => {
335
335
  return accumulator + currentValue.down_time;
336
336
  }, 0 );
337
- // Calculate the average
338
337
  const average = sum / streamwiseDowntime.length;
339
338
  obj.downtime = Math.round( average );
340
339
  } else {
341
- obj.downtime = 0;
340
+ obj.downtime = '';
342
341
  }
343
342
  let appStatusQuery = {
344
343
  'size': 1,
@@ -399,10 +399,10 @@ export async function workHistory( req, res ) {
399
399
  infraIssue: { $ifNull: [ '$primaryIssue.reasons.primaryIssue', '' ] },
400
400
  },
401
401
  } );
402
- if ( req.body.issueFilter && req.body.issueFilter !== '' ) {
402
+ if ( req.body.issueFilter && req.body.issueFilter.length>0 ) {
403
403
  query.push( {
404
404
  $match: {
405
- infraIssue: req.body.issueFilter,
405
+ infraIssue: { $in: req.body.issueFilter },
406
406
  },
407
407
  } );
408
408
  }
@@ -59,6 +59,17 @@ export async function validateTicket( req, res, next ) {
59
59
  if ( Ticket ) {
60
60
  return res.sendSuccess( 'Infra Ticket Already Exists for the day' );
61
61
  }
62
+ let refreshTicket = await findOneTangoTicket(
63
+ {
64
+ 'basicDetails.storeId': req.body.basicDetails.storeId,
65
+ 'issueType': 'infra',
66
+ 'status': { $ne: 'closed' },
67
+ 'ticketDetails.ticketType': 'refreshticket',
68
+ },
69
+ );
70
+ if ( refreshTicket ) {
71
+ return res.sendSuccess( 'refreshTicket Ticket Already Exists for the Store' );
72
+ }
62
73
  } else if ( req.body.issueType == 'installation' ) {
63
74
  let Ticket = await findOneTangoTicket(
64
75
  {