tango-app-api-infra 3.0.63-dev → 3.0.65-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.
@@ -4,7 +4,7 @@ import { aggregateTangoTicket } from '../services/tangoTicket.service.js';
4
4
  import { findOneStore } from '../services/store.service.js';
5
5
  import dayjs from 'dayjs';
6
6
  import { findinfraReason } from '../services/infraReason.service.js';
7
- import { signedUrl, appConfig } from 'tango-app-api-middleware';
7
+ import { signedUrl } from 'tango-app-api-middleware';
8
8
  export async function storeTicketList( req, res ) {
9
9
  try {
10
10
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
@@ -330,7 +330,6 @@ export async function edgeAppLogTable( req, res ) {
330
330
  };
331
331
  const downtime = await getOpenSearchData( 'live_downtime_hourly', downTimeQuery );
332
332
  let streamwiseDowntime = downtime.body.hits.hits.length > 0 ? downtime.body.hits.hits[0]._source.doc.streamwise_downtime : [];
333
- // console.log( obj.hour, streamwiseDowntime );
334
333
  if ( streamwiseDowntime.length > 0 ) {
335
334
  const sum = streamwiseDowntime.reduce( ( accumulator, currentValue ) => {
336
335
  return accumulator + currentValue.down_time;
@@ -338,7 +337,7 @@ export async function edgeAppLogTable( req, res ) {
338
337
  const average = sum / streamwiseDowntime.length;
339
338
  obj.downtime = Math.round( average );
340
339
  } else {
341
- obj.downtime ='';
340
+ obj.downtime = '';
342
341
  }
343
342
  let appStatusQuery = {
344
343
  'size': 1,
@@ -804,7 +803,7 @@ export async function cameraAngleChange( req, res ) {
804
803
  let changeDetected = result.camera_info.filter( ( cam ) => cam.stream == req.body.StreamName );
805
804
  if ( changeDetected.length == 1 ) {
806
805
  let params = {
807
- Bucket: appConfig.cloud.aws.bucket.cameraAngle,
806
+ Bucket: 'tango-client-sandbox',
808
807
  file_path: changeDetected[0].path,
809
808
  };
810
809
  let Image = await signedUrl( params );
@@ -71,26 +71,6 @@ export async function userTakeTicket( req, res ) {
71
71
  }
72
72
  userTicket = await findOneTangoTicket( query );
73
73
  }
74
- } else if ( req.body.issueType == 'mat' ) {
75
- let query = {
76
- 'status': { $ne: 'closed' },
77
- 'issueType': 'mat',
78
- 'ticketDetails.addressingUser': { $exists: false },
79
- };
80
- if ( assignedClients.length > 0 ) {
81
- query =( { ...query, ...{ 'basicDetails.clientId': { $in: assignedClients } } } );
82
- }
83
- userTicket = await findOneTangoTicket( query );
84
- } else if ( req.body.issueType == 'dataMismatch' ) {
85
- let query = {
86
- 'status': { $ne: 'closed' },
87
- 'issueType': { $in: [ 'highcount', 'lowcount' ] },
88
- 'ticketDetails.addressingUser': { $exists: false },
89
- };
90
- if ( assignedClients.length > 0 ) {
91
- query =( { ...query, ...{ 'basicDetails.clientId': { $in: assignedClients } } } );
92
- }
93
- userTicket = await findOneTangoTicket( query );
94
74
  }
95
75
  if ( userTicket ) {
96
76
  let assignTicket = await updateOneTangoTicket( { ticketId: userTicket.ticketId }, { 'ticketDetails.addressingUser': req.body.userId } );
@@ -108,26 +88,15 @@ export async function userTakeTicket( req, res ) {
108
88
  export async function userTicketList( req, res ) {
109
89
  try {
110
90
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
111
- let query = [];
112
- if ( req.body.issueType!='dataMismatch' ) {
113
- query.push( {
114
- $match: {
115
- $and: [
116
- { issueType: req.body.issueType },
117
- { 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
118
- ],
119
- },
120
- } );
121
- } else {
122
- query.push( {
123
- $match: {
124
- $and: [
125
- { issueType: { $in: [ 'highcount', 'lowcount' ] } },
126
- { 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
127
- ],
128
- },
129
- } );
130
- }
91
+ let query = [ {
92
+ $match: {
93
+ $and: [
94
+
95
+ { issueType: req.body.issueType },
96
+ { 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
97
+ ],
98
+ },
99
+ } ];
131
100
  if ( req.body.status != 'closed' || req.body.export ) {
132
101
  query.push( {
133
102
  $match: {
@@ -154,7 +123,6 @@ export async function userTicketList( req, res ) {
154
123
  query.push( {
155
124
  $project: {
156
125
  storeId: '$basicDetails.storeId',
157
- storeName: '$basicDetails.storeName',
158
126
  Date: { $dateToString: { format: '%d-%m-%Y', date: '$issueDate' } },
159
127
  updatedAt: 1,
160
128
  ticketId: 1,
@@ -185,7 +153,6 @@ export async function userTicketList( req, res ) {
185
153
  {
186
154
  $project: {
187
155
  storeId: 1,
188
- storeName: 1,
189
156
  updatedAt: 1,
190
157
  Date: 1,
191
158
  ticketId: 1,
@@ -201,7 +168,6 @@ export async function userTicketList( req, res ) {
201
168
  $group: {
202
169
  _id: '$ticketId',
203
170
  storeId: { $first: '$storeId' },
204
- storeName: { $first: '$storeName' },
205
171
  updatedAt: { $first: '$updatedAt' },
206
172
  Date: { $first: '$Date' },
207
173
  ticketId: { $first: '$ticketId' },
@@ -221,7 +187,6 @@ export async function userTicketList( req, res ) {
221
187
  $or: [
222
188
  { storeId: { $regex: req.body.searchValue, $options: 'i' } },
223
189
  { infraIssue: { $regex: req.body.searchValue, $options: 'i' } },
224
- { storeName: { $regex: req.body.searchValue, $options: 'i' } },
225
190
  ],
226
191
  },
227
192
  } );
@@ -329,28 +294,16 @@ export async function basicDetails( req, res ) {
329
294
  export async function workHistory( req, res ) {
330
295
  try {
331
296
  let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
332
- let query = [ ];
333
- if ( req.body.issueType!='dataMismatch' ) {
334
- query.push( {
335
- $match: {
336
- $and: [
337
- { 'status': 'closed' },
338
- { issueType: req.body.issueType },
339
- { 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
340
- ],
341
- },
342
- } );
343
- } else {
344
- query.push( {
345
- $match: {
346
- $and: [
347
- { 'status': 'closed' },
348
- { issueType: { $in: [ 'highcount', 'lowcount' ] } },
349
- { 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
350
- ],
351
- },
352
- } );
353
- }
297
+ let query = [ {
298
+ $match: {
299
+ $and: [
300
+ { 'status': 'closed' },
301
+ { issueType: req.body.issueType },
302
+ { 'ticketDetails.addressingUser': new mongoose.Types.ObjectId( req.body.userId ) },
303
+ ],
304
+ },
305
+ } ];
306
+
354
307
  if ( req.body.dateFilter && req.body.dateFilter != '' ) {
355
308
  if ( req.body.dateFilter === 'issueIdentifiedDate' ) {
356
309
  query.push(
@@ -411,7 +364,6 @@ export async function workHistory( req, res ) {
411
364
  issueClosedDate: { $dateToString: { format: '%Y-%m-%d', date: '$issueClosedDate' } },
412
365
  issueIdentifiedDate: { $dateToString: { format: '%Y-%m-%d', date: '$ticketDetails.issueIdentifiedDate' } },
413
366
  ticketId: 1,
414
- status: 1,
415
367
  issueStatus: '$ticketDetails.issueStatus',
416
368
  ticketType: '$ticketDetails.ticketType',
417
369
  primaryIssue: {
@@ -485,15 +437,15 @@ export async function workHistory( req, res ) {
485
437
  const exportdata = [];
486
438
  result.forEach( ( element ) => {
487
439
  exportdata.push( {
488
- 'CREATED ON': dayjs( element.issueDate ).format( 'DD-MM-YYYY' ),
440
+ 'CREATED ON': element.createdAt,
489
441
  'TICKET ID': element.ticketId,
490
442
  'STORE ID': element.storeId,
491
443
  'STORE NAME': element.storeName,
492
444
  'CLIENT ID': element.clientId,
493
445
  'CLIENT NAME': element.clientName,
446
+ 'CREATED STATUS': element.status,
494
447
  'ISSUE IDENTIFIED DATE': element.issueIdentifiedDate,
495
448
  'CLOSED ON': element.issueClosedDate,
496
- 'ISSUE': element.infraIssue?element.infraIssue:'-',
497
449
  'STATUS': element.status,
498
450
  } );
499
451
  } );
@@ -639,7 +591,7 @@ export async function storeInfraList( req, res ) {
639
591
  if ( installationcheck ) {
640
592
  store.ticketId = installationcheck.ticketId;
641
593
  store.status = installationcheck.ticketDetails.installationStatus;
642
- if ( store.status === 'onboarded' ) {
594
+ if ( store.status === 'onboareded' ) {
643
595
  store.statusDetail = 'Ready to pair';
644
596
  }
645
597
  if ( store.status === 'paired' ) {
@@ -0,0 +1,28 @@
1
+ import j2s from 'joi-to-swagger';
2
+ import { getInfraIssueValid } from '../dtos/infra.dtos.js';
3
+
4
+ export const infraDocs = {
5
+
6
+ '/v3/infraRouter/get-infra-issues': {
7
+ post: {
8
+ tags: [ 'infra' ],
9
+ description: `Get infra issues against store`,
10
+ operationId: 'get-infra-issues',
11
+ parameters: {},
12
+ requestBody: {
13
+ content: {
14
+ 'application/json': {
15
+ schema: j2s( getInfraIssueValid ).swagger,
16
+ },
17
+ },
18
+ },
19
+ responses: {
20
+ 200: { description: 'Group has been created successfully' },
21
+ 401: { description: 'Unauthorized User' },
22
+ 422: { description: 'Field Error' },
23
+ 500: { description: 'Server Error' },
24
+ 204: { description: 'Not Found' },
25
+ },
26
+ },
27
+ },
28
+ };
@@ -0,0 +1,12 @@
1
+ import Joi from 'joi';
2
+
3
+ export const getInfraIssueSchema = Joi.object().keys( {
4
+ fromDate: Joi.string().required(),
5
+ toDate: Joi.string().required(),
6
+ storeId: Joi.string().required(),
7
+
8
+ } );
9
+
10
+ export const getInfraIssueValid = {
11
+ body: getInfraIssueSchema,
12
+ };
@@ -1,10 +1,12 @@
1
1
 
2
2
  import express from 'express';
3
- import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
4
- import { validateDetails, bulkvalidateDetails, validateTicket, bulkvalidateTicket, validateTicketstatus, ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert } from '../validations/infra.validation.js';
5
- import { createTicket, bulkcreateTicket, updateStatus, createReason, PrimaryReasons, matTable,
3
+ import { isAllowedSessionHandler, authorize, validate } from 'tango-app-api-middleware';
4
+ import { validateDetails, bulkvalidateDetails, validateTicket, bulkvalidateTicket, ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert } from '../validations/infra.validation.js';
5
+ import { createTicket, bulkcreateTicket, updateStatus, createReason, PrimaryReasons,
6
6
  secondaryReason, updateTicketIssue, viewTicket, AlertTicketReply, uploadAttachments,
7
- updateInstallationTicket, emailUserList, saveInfraEmailConfig, invoice, infraTable, storeFilter, assignTicket, installationTable } from '../controllers/infra.controllers.js';
7
+ updateInstallationTicket, emailUserList, saveInfraEmailConfig, invoice,
8
+ getInfraIssues } from '../controllers/infra.controllers.js';
9
+ import { getInfraIssueValid } from '../dtos/infra.dtos.js';
8
10
 
9
11
 
10
12
  export const infraRouter = express.Router();
@@ -29,7 +31,7 @@ infraRouter.post( '/secondaryReason', isAllowedSessionHandler, authorize( {
29
31
  infraRouter.post( '/updateTicketIssue', isAllowedSessionHandler, authorize( {
30
32
  userType: [ 'client', 'tango' ], access: [
31
33
  { featureName: 'manage', name: 'tickets', permissions: [ 'isEdit' ] } ],
32
- } ), ticketExists, validateTicketstatus, infraReasonExists, InfrastepstoResolve, InfraAlert, updateTicketIssue );
34
+ } ), ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert, updateTicketIssue );
33
35
  infraRouter.post( '/viewTicket', isAllowedSessionHandler, authorize( {
34
36
  userType: [ 'client', 'tango' ], access: [
35
37
  { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
@@ -55,23 +57,4 @@ infraRouter.post( '/saveInfraEmailConfig', isAllowedSessionHandler, authorize( {
55
57
  { featureName: 'settings', name: 'configuration', permissions: [ 'isEdit', 'isView' ] } ],
56
58
  } ), saveInfraEmailConfig );
57
59
  infraRouter.post( '/invoice', invoice );
58
- infraRouter.post( '/infraTable', isAllowedSessionHandler, authorize( {
59
- userType: [ 'client', 'tango' ], access: [
60
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
61
- } ), infraTable );
62
- infraRouter.post( '/installationTable', isAllowedSessionHandler, authorize( {
63
- userType: [ 'client', 'tango' ], access: [
64
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
65
- } ), installationTable );
66
- infraRouter.post( '/matTable', isAllowedSessionHandler, authorize( {
67
- userType: [ 'client', 'tango' ], access: [
68
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
69
- } ), matTable );
70
- infraRouter.post( '/assignTicket', isAllowedSessionHandler, authorize( {
71
- userType: [ 'client', 'tango' ], access: [
72
- { featureName: 'manage', name: 'tickets', permissions: [ 'isEdit', 'isView' ] } ],
73
- } ), assignTicket );
74
- infraRouter.post( '/storeFilter', isAllowedSessionHandler, authorize( {
75
- userType: [ 'client', 'tango' ], access: [
76
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
77
- } ), storeFilter );
60
+ infraRouter.post( '/get-infra-issues', validate( getInfraIssueValid ), getInfraIssues );
@@ -2,7 +2,7 @@
2
2
  import express from 'express';
3
3
  import {
4
4
  migrateClient, migrateStores, basicList, clientList, setTicketTime, downStoresList,
5
- openTicketList, assigntoUser, updateRefreshTicket, closeTicket, edgeApplogsCheck, camAngleChangeReport, spocmailchange, emailUserList, infraReportSent,
5
+ openTicketList, assigntoUser, updateRefreshTicket, closeTicket, emailUserList, infraReportSent,
6
6
  } from '../controllers/internalInfra.controller.js';
7
7
 
8
8
  export const internalInfraRouter = express.Router();
@@ -19,8 +19,5 @@ internalInfraRouter.post( '/updateRefreshTicket', updateRefreshTicket );
19
19
  internalInfraRouter.post( '/closeTicket', closeTicket );
20
20
  internalInfraRouter.get( '/emailUserList', emailUserList );
21
21
  internalInfraRouter.post( '/infraReportSent', infraReportSent );
22
- internalInfraRouter.post( '/spocmailchange', spocmailchange );
23
- internalInfraRouter.post( '/camAngleChangeReport', camAngleChangeReport );
24
- internalInfraRouter.post( '/edgeApplogsCheck', edgeApplogsCheck );
25
22
 
26
23
 
@@ -13,9 +13,6 @@ export async function findOneTangoTicket( query, project ) {
13
13
  export async function updateOneTangoTicket( query, data ) {
14
14
  return await dataModel.tangoTicketModel.updateOne( query, { $set: data } );
15
15
  }
16
- export async function updateManyTangoTicket( query, data ) {
17
- return await dataModel.tangoTicketModel.updateMany( query, { $set: data } );
18
- }
19
16
  export async function countDocumentsTangoTicket( query, data ) {
20
17
  return await dataModel.tangoTicketModel.countDocuments( query );
21
18
  }
@@ -28,20 +28,17 @@ export async function validateDetails( req, res, next ) {
28
28
  clientId: store.clientId,
29
29
  clientName: client.clientName,
30
30
  };
31
- req.body.emailAlert = client.ticketConfigs.emailAlert;
31
+
32
32
  if ( req.body.issueType == 'infra' ) {
33
- let refreshdate = dayjs().add( client.ticketConfigs.refreshAlert, 'days' );
34
33
  req.body.ticketDetails = {
35
- ticketRefreshTime: new Date( dayjs( refreshdate ).format( 'YYYY-MM-DD' ) ),
34
+ ticketRefreshTime: dayjs().add( client.ticketConfigs.refreshAlert, 'days' ),
36
35
  };
37
36
  } else if ( req.body.issueType == 'installation' ) {
38
- let refreshdate = dayjs().add( client.ticketConfigs.installationReAssign, 'days' );
39
37
  req.body.ticketDetails = {
40
- ticketRefreshTime: new Date( dayjs( refreshdate ).format( 'YYYY-MM-DD' ) ),
38
+ ticketRefreshTime: dayjs().add( client.ticketConfigs.installationReAssign, 'days' ),
41
39
  };
42
40
  }
43
41
 
44
-
45
42
  next();
46
43
  } catch ( error ) {
47
44
  logger.error( { error: error, function: 'validateDetails' } );
@@ -62,13 +59,12 @@ export async function validateTicket( req, res, next ) {
62
59
  if ( Ticket ) {
63
60
  return res.sendSuccess( 'Infra Ticket Already Exists for the day' );
64
61
  }
65
-
66
62
  let refreshTicket = await findOneTangoTicket(
67
63
  {
68
64
  'basicDetails.storeId': req.body.basicDetails.storeId,
69
65
  'issueType': 'infra',
70
66
  'status': { $ne: 'closed' },
71
- 'ticketDetails.ticketRefreshTime': { $lte: new Date() },
67
+ 'ticketDetails.ticketType': 'refreshticket',
72
68
  },
73
69
  );
74
70
  if ( refreshTicket ) {
@@ -184,47 +180,12 @@ export async function ticketExists( req, res, next ) {
184
180
  req.body.basicDetails = Ticket.basicDetails;
185
181
  req.body.ticketDetails = Ticket.ticketDetails;
186
182
  req.body.ticketActivity = Ticket.ticketActivity;
187
- req.body.status = Ticket.status;
188
- req.body.issueDate = Ticket.issueDate;
189
-
190
-
191
183
  next();
192
184
  } catch ( error ) {
193
185
  logger.error( { error: error, function: 'ticketExists' } );
194
186
  return res.sendError( error, 500 );
195
187
  }
196
188
  };
197
-
198
- export async function validateTicketstatus( req, res, next ) {
199
- try {
200
- if ( req.body.issueType == 'infra' ) {
201
- if ( req.body.secondary.length>0 ) {
202
- if ( req.body.status == 'closed' ) {
203
- return res.sendSuccess( 'Ticket already closed' );
204
- }
205
- console.log( req.body.ticketDetails );
206
-
207
- if ( req.body.ticketDetails.ticketType==='firsttimeticket'&&req.body.ticketDetails.issueStatus==='identified' ) {
208
- return res.sendSuccess( 'Ticket already Addressed' );
209
- }
210
- } else {
211
- if ( req.body.primary == 'Application Issues' ) {
212
- if ( req.body.status == 'closed' ) {
213
- return res.sendSuccess( 'Ticket already closed' );
214
- }
215
- if ( req.body.ticketDetails.ticketType==='firsttimeticket'&&req.body.ticketDetails.issueStatus==='identified' ) {
216
- return res.sendSuccess( 'Ticket already Addressed' );
217
- }
218
- }
219
- }
220
- }
221
- next();
222
- } catch ( error ) {
223
- logger.error( { error: error, function: 'validateTicket' } );
224
- return res.sendError( error, 500 );
225
- }
226
- }
227
-
228
189
  export async function infraReasonExists( req, res, next ) {
229
190
  try {
230
191
  if ( req.body.primary && req.body.secondary && req.body.secondary.length ) {
@@ -341,24 +302,15 @@ export async function InfrastepstoResolve( req, res, next ) {
341
302
  export async function InfraAlert( req, res, next ) {
342
303
  try {
343
304
  if ( req.body.hibernationDays ) {
344
- let actionBy = '';
345
- if ( req.user.userType == 'tango' ) {
346
- actionBy = 'Tango';
347
- } else if ( req.user.userType == 'client' ) {
348
- actionBy = 'User';
349
- }
350
-
305
+ req.body.hibernationDays = dayjs().add( req.body.hibernationDays, 'days' ).format( 'YYYY-MM-DD' );
306
+ await updateOneStore( { storeId: req.body.basicDetails.storeId }, { 'ticketConfigs.hibernation': new Date( req.body.hibernationDays ) } );
351
307
  req.body.ticketActivity.push( {
352
308
  actionType: 'statusCheckReply',
353
- actionBy: actionBy,
309
+ actionBy: 'User',
354
310
  timeStamp: new Date(),
355
- statusCheckReply: 'No',
356
311
  IdentifiedBy: req.user.userName,
357
312
  hibernationDays: req.body.hibernationDays,
358
313
  } );
359
- req.body.hibernationDays = dayjs().add( req.body.hibernationDays, 'days' ).format( 'YYYY-MM-DD' );
360
- await updateOneStore( { storeId: req.body.basicDetails.storeId }, { 'ticketConfigs.hibernation': new Date( req.body.hibernationDays ) } );
361
-
362
314
  await updateOneTangoTicket( { ticketId: req.body.ticketId }, { 'hibernation': new Date( req.body.hibernationDays ) } );
363
315
  } else {
364
316
  if ( req.body.issueType == 'infra' ) {
@@ -1,23 +0,0 @@
1
-
2
- import { findOneTangoTicket, createTangoTicket } from '../services/tangoTicket.service.js';
3
- import { logger } from 'tango-app-api-middleware';
4
- export async function createTicket( req, res ) {
5
- try {
6
- let ticketExist = await findOneTangoTicket( { 'issueType': req.body.issueType, 'issueDate': ( new Date( req.body.Date ) ), 'basicDetails.storeId': req.body.storeId } );
7
-
8
- if ( ticketExist ) {
9
- return res.sendSuccess( 'MAT Ticket Already Exists for the store' );
10
- }
11
- req.body.ticketDetails = {};
12
- req.body.ticketDetails.dataMismatch = req.body.dataMismatch;
13
- req.body.issueDate = new Date( req.body.Date );
14
- req.body.ticketId = 'TE_DM_' + new Date().valueOf();
15
- let create = await createTangoTicket( req.body );
16
- if ( create ) {
17
- res.sendSuccess( 'Ticket Created Successfully' );
18
- }
19
- } catch ( error ) {
20
- logger.error( { error: error, function: 'createTicket Data Mismatch' } );
21
- return res.sendError( error, 500 );
22
- }
23
- }
@@ -1,50 +0,0 @@
1
-
2
- import { createTangoTicket, findOneTangoTicket, updateOneTangoTicket } from '../services/tangoTicket.service.js';
3
- import { logger } from 'tango-app-api-middleware';
4
- export async function createTicket( req, res ) {
5
- try {
6
- let ticketExist = await findOneTangoTicket( { 'issueType': req.body.issueType, 'basicDetails.storeId': req.body.storeId } );
7
- if ( ticketExist ) {
8
- return res.sendSuccess( 'MAT Ticket Already Exists for the store' );
9
- }
10
-
11
- req.body.issueDate = new Date( req.body.Date );
12
- req.body.ticketId = 'TE_MAT_' + new Date().valueOf();
13
- let create = await createTangoTicket( req.body );
14
- if ( create ) {
15
- res.sendSuccess( 'Ticket Created Successfully' );
16
- }
17
- } catch ( error ) {
18
- logger.error( { error: error, function: 'createTicket mat' } );
19
- return res.sendError( error, 500 );
20
- }
21
- }
22
-
23
- export async function updatecomment( req, res ) {
24
- try {
25
- if ( req.body.comment != '' ) {
26
- req.body.ticketActivity.push( {
27
- actionType: 'comment',
28
- actionBy: 'Tango',
29
- timeStamp: new Date(),
30
- IdentifiedBy: req.user.userName,
31
- comment: req.body.comment,
32
- } );
33
- }
34
- let updateTicket = await updateOneTangoTicket( { ticketId: req.body.ticketId }, { ticketActivity: req.body.ticketActivity } );
35
- if ( updateTicket ) {
36
- res.sendSuccess( 'Ticket Updated Successfully' );
37
- }
38
- } catch ( error ) {
39
- logger.error( { error: error, function: 'updatecomment mat' } );
40
- return res.sendError( error, 500 );
41
- }
42
- }
43
- export async function activityLog( req, res ) {
44
- try {
45
- res.sendSuccess( req.body );
46
- } catch ( error ) {
47
- logger.error( { error: error, function: 'activityLog mat' } );
48
- return res.sendError( error, 500 );
49
- }
50
- }
@@ -1,10 +0,0 @@
1
- import express from 'express';
2
- import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
3
- import { createTicket } from '../controllers/dataMismatch.controller.js';
4
- import { validateDetails } from '../validations/infra.validation.js';
5
- export const dataMismatchTicketRouter = express.Router();
6
-
7
- dataMismatchTicketRouter.post( '/createTicket', isAllowedSessionHandler, authorize( {
8
- userType: [ 'client', 'tango' ], access: [
9
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView', 'isEdit' ] } ],
10
- } ), validateDetails, createTicket );
@@ -1,17 +0,0 @@
1
- import { createTicket, updatecomment, activityLog } from '../controllers/employeeTraning.controller.js';
2
- import { ticketExists, validateDetails } from '../validations/infra.validation.js';
3
- import express from 'express';
4
- import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
5
- export const employeeTrainigRouter = express.Router();
6
-
7
-
8
- employeeTrainigRouter.post( '/createTicket', validateDetails, createTicket );
9
- employeeTrainigRouter.post( '/updatecomment', isAllowedSessionHandler, authorize( {
10
- userType: [ 'tango' ], access: [
11
- { featureName: 'manage', name: 'tickets', permissions: [ 'isEdit' ] } ],
12
- } ), ticketExists, updatecomment );
13
-
14
- employeeTrainigRouter.post( '/activityLog', isAllowedSessionHandler, authorize( {
15
- userType: [ 'tango' ], access: [
16
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
17
- } ), ticketExists, activityLog );