Skip to content

Commit

Permalink
Merge pull request #1085 from OneCommunityGlobal/jatin_make_columns_e…
Browse files Browse the repository at this point in the history
…ditable_by_owner

Jatin make columns editable by owner
  • Loading branch information
one-community authored Oct 15, 2024
2 parents 97a2e55 + 3abe236 commit 2118c51
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion src/controllers/userProfileController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,21 @@ const userProfileController = function (UserProfile, Project) {
}
};

const updateUserInformation = async function (req,res){
try {
const data=req.body;
data.map(async (e)=> {
let result = await UserProfile.findById(e.user_id);
result[e.item]=e.value
let newdata=await result.save()
})
res.status(200).send({ message: 'Update successful'});
} catch (error) {
console.log(error)
return res.status(500)
}
}

return {
postUserProfile,
getUserProfiles,
Expand Down Expand Up @@ -1825,7 +1840,8 @@ const userProfileController = function (UserProfile, Project) {
getProjectsByPerson,
getAllTeamCode,
getAllTeamCodeHelper,
getUserProfileBasicInfo,
updateUserInformation,
getUserProfileBasicInfo
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/routes/userProfileRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const routes = function (userProfile, project) {
controller.postUserProfile,
);

userProfileRouter.route('/userProfile/update').patch(controller.updateUserInformation);
// Endpoint to retrieve basic user profile information
userProfileRouter.route('/userProfile/basicInfo').get(controller.getUserProfileBasicInfo);

userProfileRouter
.route('/userProfile/:userId')
.get(controller.getUserById)
Expand Down

0 comments on commit 2118c51

Please sign in to comment.