This commit is contained in:
Alessandro Ferro 2024-03-12 14:46:53 +01:00
parent 44a797a57a
commit 91d7ba5e48
2 changed files with 13 additions and 13 deletions

View File

@ -62,19 +62,19 @@ async function updateOrganization(req, res) {
const updateOrganization = {}; const updateOrganization = {};
if (req.body.name != undefined) { if (req.body.name !== undefined) {
updateOrganization.name = req.body.name; updateOrganization.name = req.body.name;
} }
if (req.body.location != undefined) { if (req.body.location !== undefined) {
updateOrganization.location = req.body.location; updateOrganization.location = req.body.location;
} }
if (req.body.description != undefined) { if (req.body.description !== undefined) {
updateOrganization.description = req.body.description; updateOrganization.description = req.body.description;
} }
if (req.body.is_hiring != undefined) { if (req.body.is_hiring !== undefined) {
updateOrganization.is_hiring = req.body.is_hiring; updateOrganization.is_hiring = req.body.is_hiring;
} }

View File

@ -205,38 +205,38 @@ async function updatePerson(req, res) {
const updatePerson = {}; const updatePerson = {};
if (req.body.display_name != undefined) { if (req.body.display_name !== undefined) {
updatePerson.display_name = req.body.display_name; updatePerson.display_name = req.body.display_name;
} }
if (req.body.date_of_birth != undefined) { if (req.body.date_of_birth !== undefined) {
updatePerson.date_of_birth = req.body.date_of_birth; updatePerson.date_of_birth = req.body.date_of_birth;
} }
if (req.body.available != undefined) { if (req.body.available !== undefined) {
updatePerson.available = req.body.available; updatePerson.available = req.body.available;
} }
if (req.body.place_of_living != undefined) { if (req.body.place_of_living !== undefined) {
updatePerson.place_of_living = req.body.place_of_living; updatePerson.place_of_living = req.body.place_of_living;
} }
if (req.body.about_me != undefined) { if (req.body.about_me !== undefined) {
updatePerson.about_me = req.body.about_me; updatePerson.about_me = req.body.about_me;
} }
if (req.body.qualification != undefined) { if (req.body.qualification !== undefined) {
updatePerson.qualification = req.body.qualification; updatePerson.qualification = req.body.qualification;
} }
// If we are tying to change password, the old password must be provided // If we are tying to change password, the old password must be provided
if (req.body.old_password != undefined || req.body.new_password != undefined) { if (req.body.old_password !== undefined || req.body.new_password !== undefined) {
if (req.body.old_password == undefined) { if (req.body.old_password === undefined) {
return res.status(401).json({ return res.status(401).json({
error: 'The old password must be specified' error: 'The old password must be specified'
}); });
} }
if (req.body.new_password == undefined) { if (req.body.new_password === undefined) {
return res.status(401).json({ return res.status(401).json({
error: 'The new password must be specified' error: 'The new password must be specified'
}); });