tango-app-api-infra 3.9.5-vms.72 → 3.9.5-vms.73

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.9.5-vms.72",
3
+ "version": "3.9.5-vms.73",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "mongodb": "^6.4.0",
28
28
  "nodemon": "^3.1.0",
29
29
  "swagger-ui-express": "^5.0.0",
30
- "tango-api-schema": "^2.4.28",
30
+ "tango-api-schema": "^2.5.1",
31
31
  "tango-app-api-infra": "^3.9.5-vms.56",
32
32
  "tango-app-api-middleware": "^3.1.93",
33
33
  "winston": "^3.12.0",
@@ -9,6 +9,7 @@ import timezone from 'dayjs/plugin/timezone.js';
9
9
  import { findOneClient } from '../services/client.service.js';
10
10
  import { findUser, findOneUser } from '../services/user.service.js';
11
11
  import { sendPushNotification } from 'tango-app-api-middleware';
12
+ import { findStoreAccuracIssues, upsertStoreAccuracIssues } from '../services/storeAccuracyIssues.service.js';
12
13
  dayjs.extend( utc );
13
14
  dayjs.extend( timezone );
14
15
 
@@ -3222,3 +3223,36 @@ export async function checkTicketExists( req, res ) {
3222
3223
  return res.sendError( err, 500 );
3223
3224
  }
3224
3225
  }
3226
+
3227
+
3228
+ export async function getAccuracyIssues( req, res ) {
3229
+ try {
3230
+ const inputData = req.query;
3231
+
3232
+
3233
+ const getIsues = await findStoreAccuracIssues( { clientId: inputData.clientId, isActive: true }, { issueName: 1 } );
3234
+ // const mode = inputData.mode || '';
3235
+ res.sendSuccess( { result: getIsues|| [] } );
3236
+ // Return batch summary
3237
+ } catch ( error ) {
3238
+ const err = error.message;
3239
+ logger.info( { error: err, function: 'getAccuracyIssues' } );
3240
+ return res.sendError( err, 500 );
3241
+ }
3242
+ }
3243
+
3244
+ export async function updateAccuracyIssues( req, res ) {
3245
+ try {
3246
+ const inputData = req.query;
3247
+
3248
+
3249
+ const getIsues = await upsertStoreAccuracIssues( { clientId: inputData.clientId, issueName: inputData?.issueName }, { issueName: inputData?.issueName, isActive: true } );
3250
+ // const mode = inputData.mode || '';
3251
+ res.sendSuccess( { result: getIsues|| [] } );
3252
+ // Return batch summary
3253
+ } catch ( error ) {
3254
+ const err = error.message;
3255
+ logger.info( { error: err, function: 'putAccuracyIssues' } );
3256
+ return res.sendError( err, 500 );
3257
+ }
3258
+ }
@@ -589,3 +589,27 @@ export const multiCloseTicketSchema = Joi.object().keys( {
589
589
  export const multiCloseTicketValid = {
590
590
  body: multiCloseTicketSchema,
591
591
  };
592
+
593
+
594
+ export const getAccuracyIssuesSchema = Joi.object().keys( {
595
+
596
+
597
+ clientId: Joi.string().required(),
598
+
599
+ } );
600
+
601
+ export const getAccuracyIssuesValid = {
602
+ query: getAccuracyIssuesSchema,
603
+ };
604
+
605
+ export const updateAccuracyIssuesSchema = Joi.object().keys( {
606
+
607
+
608
+ clientId: Joi.string().required(),
609
+ issueName: Joi.string().required(),
610
+
611
+ } );
612
+
613
+ export const updateAccuracyIssuesValid = {
614
+ query: updateAccuracyIssuesSchema,
615
+ };
@@ -1,7 +1,7 @@
1
1
  import express from 'express';
2
2
  import { getClusters, getConfig, isGrantedUsers, isTicketExists, ticketApprove, ticketCreation, ticketReview } from '../validations/footfallDirectory.validation.js';
3
- import { assignTicket, createTicket, downloadTickets, getTaggedStores, getTickets, multiCloseTicket, openTicketList, reviewerList, tangoReviewTicket, ticketList, ticketSummary, updateStatus, updateTempStatus, updateUserTicketStatus, createinternalTicket, checkTicketExists, tangoReviewAccuracyClosedTicket } from '../controllers/footfallDirectory.controllers.js';
4
- import { createTicketValid, downloadTicketsValid, getTaggedStoresValid, getTicketsValid, openTicketListValid, reviewerListValid, ticketListValid, ticketSummaryValid, updateStatusValid, assignTicketValid, updateTempStatusValid, updateTicketStatusValid, tangoReviewTicketValid, multiCloseTicketValid, tangoReviewAccuracyClosedTicketValid } from '../dtos/footfallDirectory.dtos.js';
3
+ import { assignTicket, createTicket, downloadTickets, getTaggedStores, getTickets, multiCloseTicket, openTicketList, reviewerList, tangoReviewTicket, ticketList, ticketSummary, updateStatus, updateTempStatus, updateUserTicketStatus, createinternalTicket, checkTicketExists, tangoReviewAccuracyClosedTicket, getAccuracyIssues, updateAccuracyIssues } from '../controllers/footfallDirectory.controllers.js';
4
+ import { createTicketValid, downloadTicketsValid, getTaggedStoresValid, getTicketsValid, openTicketListValid, reviewerListValid, ticketListValid, ticketSummaryValid, updateStatusValid, assignTicketValid, updateTempStatusValid, updateTicketStatusValid, tangoReviewTicketValid, multiCloseTicketValid, tangoReviewAccuracyClosedTicketValid, getAccuracyIssuesValid, updateAccuracyIssuesValid } 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();
@@ -28,4 +28,7 @@ footfallDirectoryRouter.post( '/update-temp-status', isAllowedSessionHandler, bu
28
28
  footfallDirectoryRouter.post( '/update-ticket-status', isAllowedSessionHandler, bulkValidate( updateTicketStatusValid ), updateUserTicketStatus );
29
29
  footfallDirectoryRouter.post( '/multi-close-tickets', isAllowedSessionHandler, bulkValidate( multiCloseTicketValid ), multiCloseTicket );
30
30
 
31
+ footfallDirectoryRouter.get( '/get-accuarcy-issues', isAllowedSessionHandler, bulkValidate( getAccuracyIssuesValid ), getAccuracyIssues );
32
+ footfallDirectoryRouter.put( '/update-accuarcy-issues', isAllowedSessionHandler, bulkValidate( updateAccuracyIssuesValid ), updateAccuracyIssues );
33
+
31
34
 
@@ -0,0 +1,9 @@
1
+ import storeAccuracyIssuesModel from 'tango-api-schema/schema/storeAccuracyIssues.model.js';
2
+
3
+ export async function findStoreAccuracIssues( query, fiels ) {
4
+ return await storeAccuracyIssuesModel.find( query, fiels );
5
+ }
6
+
7
+ export async function upsertStoreAccuracIssues( query, record ) {
8
+ return await storeAccuracyIssuesModel.updateOne( query, { $set: record }, { upsert: true } );
9
+ }