Skip to content
Snippets Groups Projects
Commit dcebd2c8 authored by Bernard Roland (Student Com20)'s avatar Bernard Roland (Student Com20)
Browse files

Fixed the project API requests

parent 8afde80a
No related branches found
No related tags found
No related merge requests found
...@@ -19,8 +19,11 @@ project.get('/', async (req, res) => { ...@@ -19,8 +19,11 @@ project.get('/', async (req, res) => {
.select({ .select({
id: 'projects.id', id: 'projects.id',
name: 'projects.name', name: 'projects.name',
text: 'projects.text',
color: 'projects.color',
status: 'projects.status', status: 'projects.status',
}) deadline: 'projects.deadline',
})
.where({ .where({
'team_members.user_id': req.body.token.id, 'team_members.user_id': req.body.token.id,
}) })
...@@ -51,6 +54,7 @@ project.get('/:uuid', async (req, res) => { ...@@ -51,6 +54,7 @@ project.get('/:uuid', async (req, res) => {
text: 'projects.text', text: 'projects.text',
color: 'projects.color', color: 'projects.color',
status: 'projects.status', status: 'projects.status',
deadline: 'projects.deadline',
team_id: 'tms.team_id', team_id: 'tms.team_id',
}) })
.where({ .where({
...@@ -64,7 +68,10 @@ project.get('/:uuid', async (req, res) => { ...@@ -64,7 +68,10 @@ project.get('/:uuid', async (req, res) => {
project: { project: {
id: projects[0].id, id: projects[0].id,
name: projects[0].name, name: projects[0].name,
text: projects[0].text,
status: projects[0].status, status: projects[0].status,
color: projects[0].color,
deadline: projects[0].deadline,
teams: projects.map(task => task.team_id), teams: projects.map(task => task.team_id),
} }
}); });
...@@ -301,6 +308,7 @@ interface UpdateProjectBody { ...@@ -301,6 +308,7 @@ interface UpdateProjectBody {
text?: string; text?: string;
color?: string; color?: string;
status?: string; status?: string;
deadline?: string;
token: Token; token: Token;
} }
...@@ -336,6 +344,7 @@ project.put('/:uuid', async (req, res) => { ...@@ -336,6 +344,7 @@ project.put('/:uuid', async (req, res) => {
text: req.body.text, text: req.body.text,
color: req.body.color, color: req.body.color,
status: req.body.status, status: req.body.status,
deadline: req.body.deadline,
}).where({ }).where({
id: id, id: id,
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment