This repository has been archived on 2025-11-04. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
know-it-all/server/routes/org/UpdateOrgDetails.js
2022-03-30 09:46:43 -05:00

23 lines
597 B
JavaScript

async function UpdateOrgDetails(req, res, next) {
const user = req.user;
const orgName = req.body.orgName;
const orgID = req.body.orgID;
if (!orgName || !orgID) {
return res.status(400).send('Form missing required information.');
}
const result = await user.getOwnedOrg({ where: { orgID: orgID } });
if (result.length < 1) {
return res
.status(500)
.send('You do not own an organization with that id.');
}
result[0].update({ orgName: orgName });
return res.send(result[0]);
}
module.exports = UpdateOrgDetails;