properly creating a project

This commit is contained in:
Arjun Patel
2019-04-02 11:49:44 -07:00
parent e8de63bb96
commit eed7d86c89
+10 -6
View File
@@ -5,11 +5,15 @@ const db = require('../../models'),
const { Project } = db; const { Project } = db;
exports.createProject = async (req, res, next) => { exports.createProject = async (req, res, next) => {
const { org_id } = req.user.id; const organization_id = req.user.id;
var project = await db.sequelize.query(` const { title, description } = req.body;
SELECT *
FROM project const project = await Project.create({
WHERE organization_id = :org_id title,
ORDER BY created_at `); description,
organization_id
});
return res.status(201).json({ project });
}; };