tango-app-api-trax 3.3.1-beta-13 → 3.3.1-beta-15

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-13",
3
+ "version": "3.3.1-beta-15",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -863,7 +863,7 @@ export const assignedUserDetails = async ( req, res ) => {
863
863
  let page = parseInt( req.query.offset ) || 0;
864
864
  let skip = limit * page;
865
865
 
866
- let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ), coverage: req.body.coverage } } ];
866
+ let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ) } } ];
867
867
  if ( req.query.search.trim() && req.query.search.trim() != '' ) {
868
868
  let searchValue = req.query.search;
869
869
  searchValue = searchValue.split( ',' ).map( ( item ) => item.trim().toLowerCase() );
@@ -1483,6 +1483,9 @@ export const updateConfigurev1 =async ( req, res ) => {
1483
1483
  // await assignUsers( data );
1484
1484
  // } ) );
1485
1485
  // }
1486
+ if ( inputBody.coverage ) {
1487
+ await assignedService.deleteMany( { coverage: { $ne: inputBody.coverage } } );
1488
+ }
1486
1489
  if ( inputBody.submitType == 'publish' ) {
1487
1490
  if ( inputBody.checkListDetails.checkListType == 'custom' ) {
1488
1491
  let currentDate = dayjs.utc().format();
@@ -3036,6 +3039,7 @@ async function assignUsers( data ) {
3036
3039
  client_id: data?.clientId,
3037
3040
  clusterName: clusterDetails?.clusterName,
3038
3041
  assignId: data?.id || clusterDetails?._id,
3042
+ coverage: 'store',
3039
3043
  };
3040
3044
  }
3041
3045
  } else {
@@ -3067,6 +3071,7 @@ async function assignUsers( data ) {
3067
3071
  checkListName: data.checkListName,
3068
3072
  client_id: data.clientId,
3069
3073
  assignId: data?.id || storeDetails._id,
3074
+ coverage: 'store',
3070
3075
  };
3071
3076
  }
3072
3077
  }
@@ -3082,6 +3087,7 @@ async function assignUsers( data ) {
3082
3087
  client_id: data.clientId,
3083
3088
  teamName: teamDetails?.teamName,
3084
3089
  assignId: data?.id || teamDetails?._id,
3090
+ coverage: 'user',
3085
3091
  };
3086
3092
  }
3087
3093
  } else {
@@ -3098,12 +3104,13 @@ async function assignUsers( data ) {
3098
3104
  checkListName: data.checkListName,
3099
3105
  client_id: data.clientId,
3100
3106
  assignId: data?.id || userDetails?._id,
3107
+ coverage: 'user',
3101
3108
  };
3102
3109
  }
3103
3110
  }
3104
3111
  }
3105
3112
  if ( assignedData ) {
3106
- await assignedService.create( assignedData );
3113
+ await assignedService.updateOne( { checkListId: assignedData.checkListId, assignId: assignedData.assignId }, assignedData );
3107
3114
  }
3108
3115
  }
3109
3116
 
@@ -3137,25 +3144,25 @@ export async function checklistAssign( req, res ) {
3137
3144
  }
3138
3145
  }
3139
3146
 
3140
- export async function removeAssign( req, res ) {
3141
- try {
3142
- if ( !req.body.id ) {
3143
- return res.sendError( 'Id is required', 400 );
3144
- }
3145
- if ( !req.body.checkListId ) {
3146
- return res.sendError( 'Checklist id is required', 400 );
3147
- }
3148
- let checklistDetails = await checklistService.findOne( { _id: req.body.checkListId } );
3149
- if ( !checklistDetails ) {
3150
- return res.sendError( 'No data found', 204 );
3151
- }
3152
- await assignedService.deleteMany( { assignId: req.body.id } );
3153
- return res.sendSuccess( 'Details removed successfully' );
3154
- } catch ( e ) {
3155
- logger.error( { functionName: 'removeAssign', error: e } );
3156
- return res.sendError( e, 500 );
3157
- }
3158
- }
3147
+ // export async function removeAssign( req, res ) {
3148
+ // try {
3149
+ // if ( !req.body.id ) {
3150
+ // return res.sendError( 'Id is required', 400 );
3151
+ // }
3152
+ // if ( !req.body.checkListId ) {
3153
+ // return res.sendError( 'Checklist id is required', 400 );
3154
+ // }
3155
+ // let checklistDetails = await checklistService.findOne( { _id: req.body.checkListId } );
3156
+ // if ( !checklistDetails ) {
3157
+ // return res.sendError( 'No data found', 204 );
3158
+ // }
3159
+ // await assignedService.updateMany( { assignId: { $in: req.body.id } }, { isdeleted: true } );
3160
+ // return res.sendSuccess( 'Details removed successfully' );
3161
+ // } catch ( e ) {
3162
+ // logger.error( { functionName: 'removeAssign', error: e } );
3163
+ // return res.sendError( e, 500 );
3164
+ // }
3165
+ // }
3159
3166
 
3160
3167
  export async function deleteAssignList( req, res ) {
3161
3168
  try {
@@ -13,7 +13,8 @@ traxRouter
13
13
  .post( '/runAIInsert', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( runaiValidation ), traxController.runAIInsert )
14
14
  .get( '/duplicateChecklist/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( duplicateValidation ), traxController.duplicateChecklist )
15
15
  .put( '/checklist/update/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( updateChecklistValidation ), traxController.update )
16
- .post( '/validateUser', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( uploadUserValidation ), traxController.validateUserv1 )
16
+ .post( '/validateUser', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( uploadUserValidation ), traxController.validateUser )
17
+ .post( '/validateUserv1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( uploadUserValidation ), traxController.validateUserv1 )
17
18
  .get( '/userDetails/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( duplicateValidation ), traxController.assignedUserDetails )
18
19
  .post( '/checklistConfigure', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), traxController.updateConfigure )
19
20
  .post( '/checklistConfigurev1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), traxController.updateConfigurev1 )
@@ -25,7 +26,7 @@ traxRouter
25
26
  .get( '/predefinedChecklist', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( aichecklistValidation ), traxController.preDefinedChecklist )
26
27
  .post( '/selectAssign', validate( selectAssign ), traxController.selectAssign )
27
28
  .post( '/assign', isAllowedSessionHandler, traxController.checklistAssign )
28
- .post( '/remove', isAllowedSessionHandler, traxController.removeAssign )
29
+ // .post( '/remove', isAllowedSessionHandler, traxController.removeAssign )
29
30
  .post( '/removeAssignList', isAllowedSessionHandler, traxController.deleteAssignList )
30
31
  .post( '/assignUpload', isAllowedSessionHandler, traxController.assignChecklistUser );
31
32
 
@@ -24,6 +24,10 @@ export const updateMany = async ( query = {}, record={} ) => {
24
24
  return model.checklistassignconfigModel.updateMany( query, { $set: record } );
25
25
  };
26
26
 
27
+ export const updateOne = async ( query = {}, record={} ) => {
28
+ return model.checklistassignconfigModel.updateOne( query, { $set: record }, { upsert: true } );
29
+ };
30
+
27
31
  export const aggregate = async ( query = {} ) => {
28
32
  return model.checklistassignconfigModel.aggregate( query );
29
33
  };