properly creating a project
This commit is contained in:
@@ -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 });
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user