tango-app-api-trax 3.3.1-beta-69 → 3.3.1-beta-70

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-trax",
3
- "version": "3.3.1-beta-69",
3
+ "version": "3.3.1-beta-70",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1048,11 +1048,10 @@ export const flagTablesV1 = async ( req, res ) => {
1048
1048
  const data = {
1049
1049
  'Checklist Name': element.checkListName,
1050
1050
  'Flag Type': element?.checkListType === 'custom' ? 'Question' : 'Detection',
1051
- 'coverage': element.coverage,
1052
1051
  'Assigned Stores': element?.assignedStores,
1053
1052
  'Flagged Stores': element?.flaggedStores,
1054
1053
  'Compliance': element?.complianceRate,
1055
- // 'Flagged Count': element?.flagCount,
1054
+ 'Flagged Count': element?.flagCount,
1056
1055
  'Question Flags': element?.customQuestionFlagCount,
1057
1056
  'Not Submitted Flags': element?.customTimeFlagCount,
1058
1057
  };
@@ -2446,10 +2445,10 @@ export const flagChecklistTableV1 = async ( req, res ) => {
2446
2445
  total.forEach( ( element ) => {
2447
2446
  exportdata.push( {
2448
2447
  'Date': dayjs( element.dateString ).format( 'DD MMM, YYYY' ),
2449
- 'Store Name': element?.storeName?element?.storeName:'--',
2450
- 'Store Id': element?.storeId?element?.storeId:'--',
2451
- 'User Email': element?.storeSpocEmail,
2452
- 'No. of flags': element?.detections,
2448
+ 'Store Name': element?.storeName,
2449
+ 'Store Id': element?.storeId,
2450
+ 'Store Spoc Email': element?.storeSpocEmail,
2451
+ 'Detections': element?.detections,
2453
2452
  } );
2454
2453
  } );
2455
2454
  return await download( exportdata, res );
@@ -3818,6 +3818,24 @@ export async function sendAlert( req, res ) {
3818
3818
  }
3819
3819
  }
3820
3820
 
3821
+ export async function getUserEmails( req, res ) {
3822
+ try {
3823
+ let requestData = req.body;
3824
+ // Get User Based Checklist //
3825
+ let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
3826
+ let getUserEmails = await getChecklistUsers( loginUser );
3827
+ // End: Get User Based Checklist////
3828
+ if ( !getUserEmails.length ) {
3829
+ return res.sendError( { error: 'No Users Found' }, 204 );
3830
+ } else {
3831
+ return res.sendSuccess( { userEmailData: getUserEmails } );
3832
+ }
3833
+ } catch ( e ) {
3834
+ logger.error( { function: 'getUserEmails', error: e, message: req.body } );
3835
+ return res.sendError( e, 500 );
3836
+ }
3837
+ }
3838
+
3821
3839
  // async function getChecklistUsers( loginUser ) {
3822
3840
  // try {
3823
3841
  // // userType, role, clientId, userEmail All Key Required Fields
@@ -29,6 +29,7 @@ import {
29
29
  reportChecklistTableV1,
30
30
  reinitiatechecklist,
31
31
  sendAlert,
32
+ getUserEmails,
32
33
  } from '../controllers/traxDashboard.controllers.js';
33
34
 
34
35
  traxDashboardRouter
@@ -56,6 +57,7 @@ traxDashboardRouter
56
57
  .post( '/reportChecklistData', reportChecklistTable )
57
58
  .post( '/reportChecklistDataV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [] } ] } ), validate( dashboardValidationDtos.validateReportChecklistTableParams ), reportChecklistTableV1 )
58
59
  .post( '/reinitiatechecklist', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isAdd', 'isEdit' ] } ] } ), reinitiatechecklist )
59
- .post( '/sendAlert', isAllowedSessionHandler, sendAlert );
60
+ .post( '/sendAlert', isAllowedSessionHandler, sendAlert )
61
+ .post( '/getUserEmails', isAllowedSessionHandler, getUserEmails );
60
62
 
61
63
  export default traxDashboardRouter;