#63 added router/projects/projectId delete request

parent 475800e8
import { Member } from "../models/Member";
\ No newline at end of file
...@@ -96,6 +96,19 @@ router.get("/:id",async (req:Request, res:Response): Promise<Response> => { ...@@ -96,6 +96,19 @@ router.get("/:id",async (req:Request, res:Response): Promise<Response> => {
}) })
router.delete('/:projectId',async (req: Request, res: Response):Promise<Response>=>{
const projectId = req.params.projectId;
await myDataSource
.createQueryBuilder()
.delete()
.from(Project)
.where("id = :id", { id: projectId })
.execute()
return res.send({message: 'Project deleted successfully'})
})
router.get('/user/:userId', async (req : Request, res : Response): Promise<Response>=>{ router.get('/user/:userId', async (req : Request, res : Response): Promise<Response>=>{
const userId:string = req.params.userId const userId:string = req.params.userId
const userProjects = await dataSource const userProjects = await dataSource
......
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