tango-app-api-trax 3.7.4-runai-airtelv2-10 → 3.7.5-halfshutter-1

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/app.js ADDED
@@ -0,0 +1,56 @@
1
+ import express from 'express';
2
+ import { traxDashboardRouter, traxFlagRouter, traxRouter, downloadRouter, mobileRouter, locusOrderRouter, internalTraxRouter, traxActivityLogRouter, galleryRouter } from './index.js';
3
+ import dotenv from 'dotenv';
4
+ import pkg from 'body-parser';
5
+ const { json, urlencoded } = pkg;
6
+ import { logger } from 'tango-app-api-middleware';
7
+ import { connectdb } from './config/database/database.js';
8
+ import responseMiddleware from './config/response/response.js';
9
+ import errorMiddleware from './config/response/error.js';
10
+ import cors from 'cors';
11
+ import admin from 'firebase-admin';
12
+ import fileupload from 'express-fileupload';
13
+
14
+
15
+ const serviceAccountPath = JSON.parse( process.env.FIREBASE );
16
+ admin.initializeApp( {
17
+ credential: admin.credential.cert( serviceAccountPath ),
18
+ } );
19
+
20
+ const env=dotenv.config();
21
+
22
+ const app = express();
23
+ const PORT = process.env.PORT || 3000;
24
+ app.use( cors() );
25
+
26
+
27
+ if ( env.error ) {
28
+ logger.error( '.env not found' );
29
+ process.exit( 1 );
30
+ }
31
+
32
+ app.use( json( { limit: '500mb' } ) );
33
+ app.use( fileupload() );
34
+ app.use(
35
+ urlencoded( {
36
+ extended: true,
37
+ } ),
38
+ );
39
+
40
+ app.use( responseMiddleware );
41
+ app.use( errorMiddleware );
42
+
43
+ app.use( '/trax/dashboard', traxDashboardRouter );
44
+ app.use( '/trax', traxRouter );
45
+ app.use( '/trax/flag', traxFlagRouter );
46
+ app.use( '/trax/downloads', downloadRouter );
47
+ app.use( '/trax/mobileAPI', mobileRouter );
48
+ app.use( '/trax/locusorder', locusOrderRouter );
49
+ app.use( '/trax/internalAPI', internalTraxRouter );
50
+ app.use( '/trax/activityLog', traxActivityLogRouter );
51
+ app.use( '/trax/gallery', galleryRouter );
52
+
53
+ app.listen( PORT, () => {
54
+ console.log( `server is running on port= ${PORT} ` );
55
+ connectdb();
56
+ } );
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.7.4-runai-airtelv2-10",
3
+ "version": "3.7.5-halfshutter-1",
4
4
  "description": "Trax",
5
- "main": "index.js",
5
+ "main": "app.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node index.js\""
8
+ "start": "nodemon --exec \"eslint --fix . && node app.js\""
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=18.10.0"
@@ -27,7 +27,7 @@
27
27
  "mongodb": "^6.8.0",
28
28
  "nodemon": "^3.1.4",
29
29
  "path": "^0.12.7",
30
- "tango-api-schema": "^2.3.20",
30
+ "tango-api-schema": "^2.4.4",
31
31
  "tango-app-api-middleware": "^3.5.2",
32
32
  "url": "^0.11.4",
33
33
  "winston": "^3.13.1",
@@ -548,7 +548,17 @@ export const flagCardsV1 = async ( req, res ) => {
548
548
  // $or: [ { store_id: { $in: storeId } }, { aiStoreList: { $in: storeId } } ],
549
549
  date_iso: { $gte: adjustedFromDate, $lte: adjustedToDate },
550
550
  // $or: [ { store_id: { $in: storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: storeId } } ],
551
- $or: [ { store_id: { $in: storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
551
+ // $or: [ { store_id: { $in: storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
552
+ $or: clientId === '11' ?
553
+ [
554
+ { store_id: { $in: storeId } },
555
+ { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } },
556
+ ] :
557
+ [
558
+ { store_id: { $in: storeId } },
559
+ { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } },
560
+ { aiStoreList: { $in: storeId } },
561
+ ],
552
562
  },
553
563
  },
554
564
  {
@@ -568,7 +578,6 @@ export const flagCardsV1 = async ( req, res ) => {
568
578
  ];
569
579
 
570
580
  const getOverallChecklistData = await processedchecklistService.aggregate( findQuery );
571
- console.log( 'getOverallChecklistData =>', getOverallChecklistData );
572
581
 
573
582
  if ( !getOverallChecklistData.length ) {
574
583
  const resVal = {
@@ -2879,7 +2888,17 @@ export const flagComparisonCardsV2 = async ( req, res ) => {
2879
2888
  { $match: { client_id: requestData.clientId,
2880
2889
  date_iso: { $gte: fromDate, $lte: toDate },
2881
2890
  // $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ],
2882
- $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
2891
+ // $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
2892
+ $or: requestData.clientId === '11' ?
2893
+ [
2894
+ { store_id: { $in: requestData.storeId } },
2895
+ { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } },
2896
+ ] :
2897
+ [
2898
+ { store_id: { $in: requestData.storeId } },
2899
+ { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } },
2900
+ { aiStoreList: { $in: requestData.storeId } },
2901
+ ],
2883
2902
  } },
2884
2903
  {
2885
2904
  $project: {
@@ -3010,8 +3029,17 @@ export const flagTablesV2 = async ( req, res ) => {
3010
3029
  { client_id: requestData.clientId },
3011
3030
  { date_iso: { $gte: fromDate, $lte: toDate } },
3012
3031
  // { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ] },
3013
- { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
3032
+ // { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
3014
3033
  );
3034
+ if ( requestData.clientId == '11' ) {
3035
+ findAndQuery.push(
3036
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
3037
+ );
3038
+ } else {
3039
+ findAndQuery.push(
3040
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ] },
3041
+ );
3042
+ }
3015
3043
 
3016
3044
  if ( requestData?.filter === 'all' ) {
3017
3045
  findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking' ] } } ] } );
@@ -546,7 +546,12 @@ export const zoneList = async ( req, res ) => {
546
546
  try {
547
547
  let inputBody = req.query;
548
548
 
549
- if ( inputBody.checkListName && inputBody.checkListName == 'Outside Business Hours Queue Tracking' ) {
549
+ const allowedChecklists = [
550
+ 'Outside Business Hours Queue Tracking',
551
+ 'Store Half Shutter Detection',
552
+ ];
553
+
554
+ if ( inputBody.checkListName && allowedChecklists.includes( inputBody.checkListName ) ) {
550
555
  let query = [
551
556
  {
552
557
  $match: {
@@ -3945,7 +3950,7 @@ async function updateOpenSearch( user, data ) {
3945
3950
  export const aiChecklist = async ( req, res ) => {
3946
3951
  try {
3947
3952
  let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
3948
- let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking' ];
3953
+ let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ];
3949
3954
  let checklistDetails = [];
3950
3955
  let publishList = [];
3951
3956
  let unpublishList = [];
@@ -3958,7 +3963,7 @@ export const aiChecklist = async ( req, res ) => {
3958
3963
  checklistDetails = [ ...publishList, ...unpublishList ];
3959
3964
 
3960
3965
  checklistDetails.forEach( ( item ) => {
3961
- if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking' ].includes( item.checkListType ) ) {
3966
+ if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( item.checkListType ) ) {
3962
3967
  item.storeCount = storeDetails;
3963
3968
  }
3964
3969
  } );