tango-app-api-infra 3.9.5-vms.4 → 3.9.5-vms.6
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,5 +1,5 @@
|
|
|
1
1
|
import { chunkArray, download, logger, sendMessageToFIFOQueue, sendMessageToQueue } from 'tango-app-api-middleware';
|
|
2
|
-
import { bulkUpdate, getOpenSearchById, getOpenSearchCount, getOpenSearchData, insertWithId, updateOpenSearchData } from 'tango-app-api-middleware/src/utils/openSearch.js';
|
|
2
|
+
import { bulkUpdate, getOpenSearchById, getOpenSearchCount, getOpenSearchData, insertWithId, updateOpenSearchData, upsertOpenSearchData } from 'tango-app-api-middleware/src/utils/openSearch.js';
|
|
3
3
|
import { findOneStore } from '../services/store.service.js';
|
|
4
4
|
import { countDocumnetsCamera } from '../services/camera.service.js';
|
|
5
5
|
import { findOneRevopDownload, upsertRevopDownload } from '../services/revopDownload.service.js';
|
|
@@ -516,32 +516,32 @@ export async function ticketList( req, res ) {
|
|
|
516
516
|
status: 'Closed',
|
|
517
517
|
},
|
|
518
518
|
{
|
|
519
|
-
ticketId: '
|
|
519
|
+
ticketId: 'TE_FDT_1763860421803',
|
|
520
520
|
storeId: '11-1716',
|
|
521
521
|
storeName: 'LKST1916',
|
|
522
|
-
ticketRaised: '2025-11-
|
|
523
|
-
issueDate: '2025-11-
|
|
524
|
-
dueDate: '2025-11-
|
|
525
|
-
footfall:
|
|
526
|
-
storeRevisedAccuracy: '
|
|
527
|
-
reviewerRevisedAccuracy: '
|
|
528
|
-
approverRevisedAccuracy: '
|
|
529
|
-
tangoRevisedAccuracy: '
|
|
522
|
+
ticketRaised: '2025-11-21',
|
|
523
|
+
issueDate: '2025-11-20',
|
|
524
|
+
dueDate: '2025-11-26',
|
|
525
|
+
footfall: 94,
|
|
526
|
+
storeRevisedAccuracy: '90%',
|
|
527
|
+
reviewerRevisedAccuracy: '--',
|
|
528
|
+
approverRevisedAccuracy: '--',
|
|
529
|
+
tangoRevisedAccuracy: '--',
|
|
530
530
|
status: 'Open',
|
|
531
531
|
},
|
|
532
532
|
{
|
|
533
|
-
ticketId: '
|
|
533
|
+
ticketId: 'TE_FDT_1763711403163',
|
|
534
534
|
storeId: '11-1716',
|
|
535
535
|
storeName: 'LKST1916',
|
|
536
|
-
ticketRaised: '2025-11-
|
|
537
|
-
issueDate: '2025-11-
|
|
538
|
-
dueDate: '
|
|
539
|
-
footfall:
|
|
540
|
-
storeRevisedAccuracy: '
|
|
541
|
-
reviewerRevisedAccuracy: '
|
|
542
|
-
approverRevisedAccuracy: '
|
|
543
|
-
tangoRevisedAccuracy: '
|
|
544
|
-
status: '
|
|
536
|
+
ticketRaised: '2025-11-20',
|
|
537
|
+
issueDate: '2025-11-19',
|
|
538
|
+
dueDate: 'Due Today',
|
|
539
|
+
footfall: 94,
|
|
540
|
+
storeRevisedAccuracy: '95%',
|
|
541
|
+
reviewerRevisedAccuracy: '--',
|
|
542
|
+
approverRevisedAccuracy: '--',
|
|
543
|
+
tangoRevisedAccuracy: '--',
|
|
544
|
+
status: 'Open',
|
|
545
545
|
},
|
|
546
546
|
{
|
|
547
547
|
ticketId: 'TE_FDT_1763539990309',
|
|
@@ -899,13 +899,13 @@ export async function ticketList( req, res ) {
|
|
|
899
899
|
approvedBy: 'mu_mu@yopmail.com',
|
|
900
900
|
},
|
|
901
901
|
{
|
|
902
|
-
ticketId: '
|
|
902
|
+
ticketId: 'TE_FDT_1763860421803',
|
|
903
903
|
storeId: '11-1716',
|
|
904
904
|
storeName: 'LKST1916',
|
|
905
|
-
ticketRaised: '2025-11-
|
|
906
|
-
issueDate: '2025-11-
|
|
907
|
-
dueDate: '2025-11-
|
|
908
|
-
footfall:
|
|
905
|
+
ticketRaised: '2025-11-21',
|
|
906
|
+
issueDate: '2025-11-20',
|
|
907
|
+
dueDate: '2025-11-26',
|
|
908
|
+
footfall: 94,
|
|
909
909
|
storeRevisedAccuracy: '90%',
|
|
910
910
|
reviewerRevisedAccuracy: '90%',
|
|
911
911
|
approverRevisedAccuracy: '90%',
|
|
@@ -914,18 +914,18 @@ export async function ticketList( req, res ) {
|
|
|
914
914
|
approvedBy: 'mu_mu@yopmail.com',
|
|
915
915
|
},
|
|
916
916
|
{
|
|
917
|
-
ticketId: '
|
|
917
|
+
ticketId: 'TE_FDT_1763711403163',
|
|
918
918
|
storeId: '11-1716',
|
|
919
919
|
storeName: 'LKST1916',
|
|
920
|
-
ticketRaised: '2025-11-
|
|
921
|
-
issueDate: '2025-11-
|
|
922
|
-
dueDate: '
|
|
923
|
-
footfall:
|
|
924
|
-
storeRevisedAccuracy: '
|
|
920
|
+
ticketRaised: '2025-11-20',
|
|
921
|
+
issueDate: '2025-11-19',
|
|
922
|
+
dueDate: 'Due Today',
|
|
923
|
+
footfall: 94,
|
|
924
|
+
storeRevisedAccuracy: '95%',
|
|
925
925
|
reviewerRevisedAccuracy: '--',
|
|
926
926
|
approverRevisedAccuracy: '--',
|
|
927
927
|
tangoRevisedAccuracy: '--',
|
|
928
|
-
status: 'In-
|
|
928
|
+
status: 'In-Progress',
|
|
929
929
|
approvedBy: 'mu_mu@yopmail.com',
|
|
930
930
|
},
|
|
931
931
|
{
|
|
@@ -2310,3 +2310,82 @@ export async function openTicketList( req, res ) {
|
|
|
2310
2310
|
}
|
|
2311
2311
|
}
|
|
2312
2312
|
|
|
2313
|
+
export async function updateiTcket( req, res ) {
|
|
2314
|
+
try {
|
|
2315
|
+
const inputData = req.body;
|
|
2316
|
+
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
2317
|
+
|
|
2318
|
+
// INSERT_YOUR_CODE
|
|
2319
|
+
// Build the query to match storeId(s) and dateString range [fromDate, toDate], format: 'yyyy-mm-dd'
|
|
2320
|
+
const { email, userName, role, actionType } = inputData;
|
|
2321
|
+
|
|
2322
|
+
// INSERT_YOUR_CODE
|
|
2323
|
+
|
|
2324
|
+
// Find and update mappingInfo fields for the provided ticketId and actionType
|
|
2325
|
+
// Requires ticketId in inputData
|
|
2326
|
+
const { ticketId } = inputData;
|
|
2327
|
+
if ( !ticketId ) {
|
|
2328
|
+
return res.sendError( 'ticketId is required', 400 );
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
// Build the OpenSearch update-by-query body
|
|
2332
|
+
const updateBody = {
|
|
2333
|
+
script: {
|
|
2334
|
+
source: `
|
|
2335
|
+
if (ctx._source.mappingInfo != null) {
|
|
2336
|
+
for (int i = 0; i < ctx._source.mappingInfo.length; i++) {
|
|
2337
|
+
if (ctx._source.mappingInfo[i].type == params.actionType) {
|
|
2338
|
+
ctx._source.mappingInfo[i].createdByEmail = params.email;
|
|
2339
|
+
ctx._source.mappingInfo[i].createdByUserName = params.userName;
|
|
2340
|
+
ctx._source.mappingInfo[i].createdByRole = params.role;
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
`,
|
|
2345
|
+
lang: 'painless',
|
|
2346
|
+
params: {
|
|
2347
|
+
email,
|
|
2348
|
+
userName,
|
|
2349
|
+
role,
|
|
2350
|
+
actionType,
|
|
2351
|
+
},
|
|
2352
|
+
},
|
|
2353
|
+
query: {
|
|
2354
|
+
bool: {
|
|
2355
|
+
must: [
|
|
2356
|
+
{ term: { 'ticketId.keyword': ticketId } },
|
|
2357
|
+
{
|
|
2358
|
+
nested: {
|
|
2359
|
+
path: 'mappingInfo',
|
|
2360
|
+
query: {
|
|
2361
|
+
bool: {
|
|
2362
|
+
must: [
|
|
2363
|
+
{ match: { 'mappingInfo.type': actionType } },
|
|
2364
|
+
],
|
|
2365
|
+
},
|
|
2366
|
+
},
|
|
2367
|
+
},
|
|
2368
|
+
},
|
|
2369
|
+
],
|
|
2370
|
+
},
|
|
2371
|
+
},
|
|
2372
|
+
};
|
|
2373
|
+
|
|
2374
|
+
// Call OpenSearch _update_by_query to update doc(s) where ticketId and mappingInfo[i].type == actionType
|
|
2375
|
+
const response = await upsertOpenSearchData(
|
|
2376
|
+
openSearch.footfallDirectory,
|
|
2377
|
+
'11-1716_2025-11-20_footfall-directory-tagging',
|
|
2378
|
+
updateBody, // custom arg to indicate passthrough for update-by-query, depends on helper implementation
|
|
2379
|
+
);
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
logger.info( { response } );
|
|
2383
|
+
|
|
2384
|
+
return res.sendSuccess( { updated: response?.body?.updated ?? 0 } );
|
|
2385
|
+
} catch ( error ) {
|
|
2386
|
+
const err = error.message || 'Internal Server Error';
|
|
2387
|
+
logger.error( { error: error, function: 'updateticket' } );
|
|
2388
|
+
return res.sendError( err, 500 );
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
|
|
@@ -461,3 +461,18 @@ export const openTicketListSchema = Joi.object().keys( {
|
|
|
461
461
|
export const openTicketListValid = {
|
|
462
462
|
body: openTicketListSchema,
|
|
463
463
|
};
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
export const updateTicketListSchema = Joi.object().keys( {
|
|
467
|
+
email: Joi.string().required(),
|
|
468
|
+
userName: Joi.string().optional(),
|
|
469
|
+
role: Joi.string().optional(),
|
|
470
|
+
actionType: Joi.string().required(),
|
|
471
|
+
ticketId: Joi.string().required(),
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
} );
|
|
475
|
+
|
|
476
|
+
export const updateTicketListValid = {
|
|
477
|
+
body: updateTicketListSchema,
|
|
478
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { getClusters, getConfig, isGrantedUsers, isTicketExists, ticketCreation } from '../validations/footfallDirectory.validation.js';
|
|
3
|
-
import { createTicket, downloadTickets, getTaggedStores, getTickets, openTicketList, reviewerList, ticketList, ticketSummary, updateStatus } from '../controllers/footfallDirectory.controllers.js';
|
|
4
|
-
import { createTicketValid, downloadTicketsValid, getTaggedStoresValid, getTicketsValid, openTicketListValid, reviewerListValid, ticketListValid, ticketSummaryValid, updateStatusValid } from '../dtos/footfallDirectory.dtos.js';
|
|
3
|
+
import { createTicket, downloadTickets, getTaggedStores, getTickets, openTicketList, reviewerList, ticketList, ticketSummary, updateiTcket, updateStatus } from '../controllers/footfallDirectory.controllers.js';
|
|
4
|
+
import { createTicketValid, downloadTicketsValid, getTaggedStoresValid, getTicketsValid, openTicketListValid, reviewerListValid, ticketListValid, ticketSummaryValid, updateStatusValid, updateTicketListValid } from '../dtos/footfallDirectory.dtos.js';
|
|
5
5
|
import { bulkValidate, getAssinedStore, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
6
6
|
|
|
7
7
|
export const footfallDirectoryRouter = express.Router();
|
|
@@ -17,4 +17,6 @@ footfallDirectoryRouter.put( '/update-status', isAllowedSessionHandler, bulkVali
|
|
|
17
17
|
footfallDirectoryRouter.get( '/download-tickets', isAllowedSessionHandler, bulkValidate( downloadTicketsValid ), isTicketExists, downloadTickets );
|
|
18
18
|
footfallDirectoryRouter.get( '/reviewer-list', isAllowedSessionHandler, bulkValidate( reviewerListValid ), reviewerList );
|
|
19
19
|
footfallDirectoryRouter.post( '/open-ticket-list', isAllowedSessionHandler, bulkValidate( openTicketListValid ), openTicketList );
|
|
20
|
+
footfallDirectoryRouter.post( '/update-ticket-user', isAllowedSessionHandler, bulkValidate( updateTicketListValid ), updateiTcket );
|
|
21
|
+
|
|
20
22
|
|