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

Added API routes to get open/closed/suspended tasks

parent a6730308
No related branches found
No related tags found
No related merge requests found
...@@ -129,7 +129,7 @@ task.get('/', async (req, res) => { ...@@ -129,7 +129,7 @@ task.get('/', async (req, res) => {
} }
}); });
task.get('/open', async (req, res) => { task.get('/:status(open|closed|suspended)', async (req, res) => {
try { try {
const tasks = await database('team_members') const tasks = await database('team_members')
.innerJoin('team_projects', 'team_members.team_id', 'team_projects.team_id') .innerJoin('team_projects', 'team_members.team_id', 'team_projects.team_id')
...@@ -155,7 +155,7 @@ task.get('/open', async (req, res) => { ...@@ -155,7 +155,7 @@ task.get('/open', async (req, res) => {
}) })
.where({ .where({
'team_members.user_id': req.body.token.id, 'team_members.user_id': req.body.token.id,
'tasks.status': 'open', 'tasks.status': req.params.status,
}); });
res.status(200).json({ res.status(200).json({
status: 'success', status: 'success',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment