add cause and region as org and creating an org

This commit is contained in:
Arjun Patel
2019-01-27 22:46:49 -08:00
parent 60590906a0
commit e77b31a8f2
5 changed files with 90 additions and 31 deletions
@@ -0,0 +1,18 @@
const db = require('../../config/db.config.js'),
errorMaker = require('../../helpers/error.maker');
const { Grant, Cause, Region, Organization } = db;
// ADD a cause into the database
exports.create = (req, res, next) => {
const { name } = req.body;
Cause.create({ name })
.then(cause => {
res.status(200).json({
message: 'Cause created',
cause
});
})
.catch(error => next(error));
};