From 9dcf684da9e8499e6f472ed24b05a0655a3206f3 Mon Sep 17 00:00:00 2001 From: praveenKDass Date: Thu, 16 May 2024 11:13:03 +0530 Subject: [PATCH] program transfer only to PD --- module/assets/helper.js | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/module/assets/helper.js b/module/assets/helper.js index 62e05ade..a3d6b093 100644 --- a/module/assets/helper.js +++ b/module/assets/helper.js @@ -162,9 +162,6 @@ module.exports = class AssetsHelper { : (updateUserAssetDataResult = false); } if ( - reqData.toUserProfile.roles.includes( - constants.common.PROGRAM_MANAGER - ) || reqData.toUserProfile.roles.includes( constants.common.PROGRAM_DESIGNER ) @@ -398,12 +395,9 @@ module.exports = class AssetsHelper { : (updateUserAssetDataResult = false); } if ( - (reqData.toUserProfile.roles.includes( - constants.common.PROGRAM_MANAGER - ) || - reqData.toUserProfile.roles.includes( - constants.common.PROGRAM_DESIGNER - )) && + reqData.toUserProfile.roles.includes( + constants.common.PROGRAM_DESIGNER + ) && assetTypeToTransfer === constants.common.PROGRAM ) { //get from and to user details from userExtension collection @@ -690,11 +684,8 @@ module.exports = class AssetsHelper { fromUserData.platformRoles.forEach(async (role) => { //user Role code of fromUser let userRole = role.code; - // Loop only when UserRole is PM or PD instead of looping through all the roles - if ( - userRole === constants.common.PROGRAM_MANAGER || - userRole === constants.common.PROGRAM_DESIGNER - ) { + // Loop only when UserRole is PD instead of looping through all the roles + if (userRole === constants.common.PROGRAM_DESIGNER) { // Check if user Role already exists in userExtension collection or not let toUserRoleExists = toUserData.platformRoles.some( (toRole) => toRole.code === userRole @@ -851,7 +842,8 @@ module.exports = class AssetsHelper { * @name getPlatformRolesToTransfer * @param {Array} fromUserPlatformRoleData - fromUser's platformRoles array data . * @param {String} userRoleData - UserRole's Data. - * @param {Array} [reqData={}] - request body Data. + * @param {Array} [reqData={}] - userRole === constants.common.PROGRAM_MANAGER || +request body Data. * @param {boolean} [hasAssetInformation=false] - check asset information * @returns {Promise} -Returns Array of platform roles. */ @@ -867,11 +859,8 @@ module.exports = class AssetsHelper { let platformRoles = []; for (let eachRole of fromUserPlatformRoleData) { - // Loop only when UserRole is PM or PD instead of looping through all the roles - if ( - eachRole.code === constants.common.PROGRAM_MANAGER || - eachRole.code === constants.common.PROGRAM_DESIGNER - ) { + // Loop only when UserRole is PD instead of looping through all the roles + if (eachRole.code === constants.common.PROGRAM_DESIGNER) { let matchingRole = userRoleData.find( (role) => role.code === eachRole.code ); @@ -939,15 +928,11 @@ module.exports = class AssetsHelper { let rolesToCheck = []; switch (assetsType) { case constants.common.PROGRAM: - rolesToCheck = [ - constants.common.PROGRAM_MANAGER, - constants.common.PROGRAM_DESIGNER, - ]; + rolesToCheck = [constants.common.PROGRAM_DESIGNER]; case constants.common.SOULTION: rolesToCheck = [constants.common.CONTENT_CREATOR]; default: rolesToCheck = [ - constants.common.PROGRAM_MANAGER, constants.common.PROGRAM_DESIGNER, constants.common.CONTENT_CREATOR, ];