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/AddOrgMember.js
2022-03-30 09:46:43 -05:00

18 lines
457 B
JavaScript

const { Organization } = require('../../models/index');
async function AddOrgMember(req, res, next) {
const user = req.user;
const orgID = req.params.orgID;
const result = await Organization.findByPk(orgID);
if (!result) {
return res.status(404).send('No organization exists with that id.');
}
await result.addOrgMember(user.userID);
return res.send('User added to organization.');
}
module.exports = AddOrgMember;