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/DeleteOrg.js

18 lines
426 B
JavaScript

const { Organization } = require('../../db/models/index');
async function DeleteOrg(req, res, next) {
const user = req.user;
const orgID = req.query.orgID;
if (!orgID) {
return res.status(400).send('Form missing required fields');
}
await Organization.destroy({
where: { id: orgID, ownerID: user.id },
});
return res.send('Organization deleted');
}
module.exports = DeleteOrg;