#167 remove some spaces in rotures/projects.ts

parent 2503a13e
...@@ -34,9 +34,7 @@ router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> { ...@@ -34,9 +34,7 @@ router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> {
if (rawProjects.length>0){ if (rawProjects.length>0){
for(let project of rawProjects){ for(let project of rawProjects){
projectIds.push(project.id projectIds.push(project.id
) )}}
}
}
const projects = await dataSource const projects = await dataSource
.createQueryBuilder() .createQueryBuilder()
.from(Project, "project") .from(Project, "project")
...@@ -53,8 +51,6 @@ router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> { ...@@ -53,8 +51,6 @@ router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> {
}) })
/**create new project */ /**create new project */
router.post('/',auth, async (req:Request, res:Response): Promise<Response> => { router.post('/',auth, async (req:Request, res:Response): Promise<Response> => {
try{ try{
...@@ -65,8 +61,7 @@ router.post('/',auth, async (req:Request, res:Response): Promise<Response> => { ...@@ -65,8 +61,7 @@ router.post('/',auth, async (req:Request, res:Response): Promise<Response> => {
.find({ .find({
where:{ where:{
title:title title:title
} }})
})
if(projectCheck.length>0) {return res.status(400).send({message:"suchc Project already exists"})} if(projectCheck.length>0) {return res.status(400).send({message:"suchc Project already exists"})}
const member:Member = new Member; const member:Member = new Member;
member.user= user; member.user= user;
...@@ -105,10 +100,7 @@ try{ ...@@ -105,10 +100,7 @@ try{
where:{ where:{
project:{ project:{
id:req.params.id id:req.params.id
} }}})
}
}
)
return res.send({project, tasks}) return res.send({project, tasks})
} catch(e) { } catch(e) {
return res.status(502).send({message:(e as Error).message}) return res.status(502).send({message:(e as Error).message})
...@@ -188,8 +180,7 @@ router.delete('/remove-user/:userId', authAdminProject,async (req: Request, res: ...@@ -188,8 +180,7 @@ router.delete('/remove-user/:userId', authAdminProject,async (req: Request, res:
project:{ project:{
id:projectId id:projectId
} }
} }})
})
if(!projectMember) return res.status(404).send({message:"this member is not present"}) if(!projectMember) return res.status(404).send({message:"this member is not present"})
await Member.delete({id:projectMember.id}) await Member.delete({id:projectMember.id})
return res.send({message:"User removed from project successfully" }) return res.send({message:"User removed from project successfully" })
......
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