Ajout du champ 'status' lors de la création d'un projet et suppression de la vérification du Project ID dans la route POST /projects
This commit is contained in:
@@ -201,8 +201,8 @@ router.post('/projects', async (req, res) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const query = 'INSERT INTO public.projects (name, description) VALUES ($1, $2) RETURNING id';
|
||||
const result = await db.query(query, [name, description]);
|
||||
const query = `INSERT INTO public.projects (name, description, status) VALUES ('${name}', '${description}', 0) RETURNING id`;
|
||||
const result = await db.query(query);
|
||||
const projectId = result.rows[0].id;
|
||||
|
||||
fileUtils.createProjectDirectory(projectId);
|
||||
@@ -211,18 +211,6 @@ router.post('/projects', async (req, res) => {
|
||||
console.error('Error creating project:', error);
|
||||
res.status(500).json({ error: 'Internal server error' });
|
||||
}
|
||||
const { projectId } = req.body;
|
||||
if (!projectId) {
|
||||
return res.status(400).json({ error: 'Project ID is required' });
|
||||
}
|
||||
|
||||
try {
|
||||
fileUtils.createProjectDirectory(projectId);
|
||||
res.status(201).json({ message: 'Project directory created successfully' });
|
||||
} catch (error) {
|
||||
console.error('Error creating project directory:', error);
|
||||
res.status(500).json({ error: 'Internal server error' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user