#110 setup of router post tasks/my

parent 0871584f
...@@ -75,10 +75,8 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{ ...@@ -75,10 +75,8 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
newMember.project=newPersonalProject; newMember.project=newPersonalProject;
newMember.roleProject = MemberRole.ADMIN; newMember.roleProject = MemberRole.ADMIN;
await newMember.save(); await newMember.save();
console.log ('newPersonalProject ', newPersonalProject)
} }
} }
newTask.dateTimeDeadLine=dateTimeDeadLine; newTask.dateTimeDeadLine=dateTimeDeadLine;
newTask.author= user; newTask.author= user;
newTask.executor= executor; newTask.executor= executor;
...@@ -142,7 +140,6 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=> ...@@ -142,7 +140,6 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
newMember.project=newPersonalProject; newMember.project=newPersonalProject;
newMember.roleProject = MemberRole.ADMIN; newMember.roleProject = MemberRole.ADMIN;
await newMember.save(); await newMember.save();
console.log ('newPersonalProject ', newPersonalProject)
} }
} }
...@@ -181,7 +178,7 @@ router.get('/user/:userId', async (req: Request, res: Response):Promise<Response ...@@ -181,7 +178,7 @@ router.get('/user/:userId', async (req: Request, res: Response):Promise<Response
}) })
/**check tasks of current user where he is executor, search by id*/ /**check tasks of current user where he is executor(works for tbl MyTasks), search by id*/
router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
const user = req.body.user const user = req.body.user
const tasks = await dataSource const tasks = await dataSource
...@@ -196,14 +193,18 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{ ...@@ -196,14 +193,18 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
id:user.id id:user.id
} }
}, },
{
author:{
id:user.id
}
},
] ]
}) })
return res.send({tasks}) const projects= await dataSource
.getRepository(Project)
.find({where:{
members:{
user:{
id:user.id
}
}
}})
return res.send({tasks, projects})
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment