tango-app-api-infra 3.0.48-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.48-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
- { 'ticketDetails.issueStatus': 'identified' },
19
+ { status: { $ne: 'closed' } },
20
20
  { 'basicDetails.clientId': { $in: req.body.clientId } },
21
21
  { createdAt: { $gte: date.start } },
22
22
  { createdAt: { $lte: date.end } },
@@ -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;
@@ -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
  {