#95 check if excutor could delete the last copytask is in progress

parent 705cbccc
...@@ -46,9 +46,28 @@ router.put("/change-copy/:dateTimeTaskId", authAuthorOrExecutorOfTask, async(req ...@@ -46,9 +46,28 @@ router.put("/change-copy/:dateTimeTaskId", authAuthorOrExecutorOfTask, async(req
/**delete copyTask by dateTimeTaskId */ /**delete copyTask by dateTimeTaskId */
router.delete('/:dateTimeTaskId',authAuthorOrExecutorOfDateTimeTask, async(req:Request, res:Response):Promise<Response|void>=>{ router.delete('/:dateTimeTaskId',authAuthorOrExecutorOfDateTimeTask, async(req:Request, res:Response):Promise<Response|void>=>{
const {executorStatus} = req.body const {executorStatus, authorStatus} = req.body
if(executorStatus){ if(executorStatus){
const {dateTimeTaskId} = req.params const {dateTimeTaskId} = req.params
const task =await dataSource
.getRepository(Task)
.findOne({
relations:
{
dateTimeTasks: true
},
where:{
dateTimeTasks:
{
id:dateTimeTaskId
}
}})
if (executorStatus) {
const deadLine = task?.dateTimeDeadLine
let dateTimeTasks = task?.dateTimeTasks
const deadlineTaskCopy = dateTimeTasks?.map(dateTimeTask=> {if (dateTimeTask.dateTimeDue===deadLine) return dateTimeTask})
}
await myDataSource await myDataSource
.createQueryBuilder() .createQueryBuilder()
.delete() .delete()
......
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