issue-106 #107
@ -196,4 +196,15 @@ public class TaskController {
|
||||
Collection<Task> subtasks = taskPermissionResult.getResult().getSubtasks();
|
||||
return ResponseEntity.ok(subtasks.stream().map(TaskEntityInfo::new).toList());
|
||||
}
|
||||
|
||||
@DeleteMapping("/tasks/{taskID}/subtasks")
|
||||
public ResponseEntity<?> onClearSubtasks(@PathVariable long taskID) {
|
||||
var taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(taskPermissionResult.hasIssue()) {
|
||||
return taskPermissionResult.mapToResponseEntity();
|
||||
}
|
||||
|
||||
ServiceExitCode result = taskService.clearSubTasks(taskPermissionResult.getResult());
|
||||
return result.mapToResponseEntity();
|
||||
}
|
||||
}
|
||||
|
@ -44,4 +44,9 @@ public interface TaskRepository extends CrudRepository<Task, Long> {
|
||||
@Transactional
|
||||
@Query(value = "UPDATE Task t SET t.parent = null WHERE t.taskgroup = ?1")
|
||||
void deleteTaskHierarchyWhereTaskgroup(Taskgroup taskgroup);
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "DELETE Task t WHERE t.parent = ?1")
|
||||
void deleteTasksByParent(Task parentTask);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class TaskSeriesService {
|
||||
}
|
||||
taskSerie.getTasks().clear();
|
||||
taskSeriesRepository.delete(taskSerie);
|
||||
} else {
|
||||
} else if(task.getParent() == null){
|
||||
repearIndexing(taskSerie, item.getSeriesIndex());
|
||||
}
|
||||
}
|
||||
|
@ -159,4 +159,9 @@ public class TaskService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ServiceExitCode clearSubTasks(Task parentTask) {
|
||||
taskRepository.deleteTasksByParent(parentTask);
|
||||
return ServiceExitCode.OK;
|
||||
}
|
||||
}
|
||||
|
33
openapi.yaml
33
openapi.yaml
@ -1349,7 +1349,38 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
|
||||
delete:
|
||||
security:
|
||||
- API_TOKEN: []
|
||||
tags:
|
||||
- task
|
||||
parameters:
|
||||
- name: taskID
|
||||
in: path
|
||||
description: internal id of task
|
||||
required: true
|
||||
schema:
|
||||
type: number
|
||||
example: 1
|
||||
responses:
|
||||
200:
|
||||
description: Operation successfull
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
403:
|
||||
description: No permission
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
404:
|
||||
description: Task not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
|
||||
|
||||
/schedules:
|
||||
|
Loading…
Reference in New Issue
Block a user