Class WorkflowController
java.lang.Object
ai.nervemind.app.api.WorkflowController
REST API controller for workflow management.
-
Constructor Summary
ConstructorsConstructorDescriptionWorkflowController(WorkflowService workflowService, FileWatcherService fileWatcherService) Creates a new workflow controller. -
Method Summary
Modifier and TypeMethodDescriptionvoidActivates or deactivates a workflow.ai.nervemind.common.dto.WorkflowDTOcreate(@Valid ai.nervemind.common.dto.WorkflowDTO dto) Creates a new workflow.voidDeletes a workflow by its ID.ai.nervemind.common.dto.WorkflowDTODuplicates an existing workflow.List<ai.nervemind.common.dto.WorkflowDTO> findAll()Retrieves all workflows.org.springframework.http.ResponseEntity<ai.nervemind.common.dto.WorkflowDTO> Retrieves a workflow by its ID.org.springframework.http.ResponseEntity<ai.nervemind.common.dto.WorkflowDTO> Updates an existing workflow.
-
Constructor Details
-
WorkflowController
Creates a new workflow controller.- Parameters:
workflowService- the workflow service for business logicfileWatcherService- the file watcher service for file monitoring
-
-
Method Details
-
findAll
Retrieves all workflows.- Returns:
- list of all workflows
-
findById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<ai.nervemind.common.dto.WorkflowDTO> findById(@PathVariable Long id) Retrieves a workflow by its ID.- Parameters:
id- the workflow ID- Returns:
- the workflow if found, 404 otherwise
-
create
@PostMapping @ResponseStatus(CREATED) public ai.nervemind.common.dto.WorkflowDTO create(@Valid @RequestBody @Valid ai.nervemind.common.dto.WorkflowDTO dto) Creates a new workflow.- Parameters:
dto- the workflow data to create- Returns:
- the created workflow
-
update
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<ai.nervemind.common.dto.WorkflowDTO> update(@PathVariable Long id, @Valid @RequestBody @Valid ai.nervemind.common.dto.WorkflowDTO dto) Updates an existing workflow.- Parameters:
id- the workflow ID to updatedto- the updated workflow data- Returns:
- the updated workflow if successful, 400 if ID mismatch
-
delete
Deletes a workflow by its ID.- Parameters:
id- the workflow ID to delete
-
duplicate
@PostMapping("/{id}/duplicate") @ResponseStatus(CREATED) public ai.nervemind.common.dto.WorkflowDTO duplicate(@PathVariable Long id) Duplicates an existing workflow.- Parameters:
id- the workflow ID to duplicate- Returns:
- the duplicated workflow DTO
-
activate
@PatchMapping("/{id}/active") @ResponseStatus(OK) public void activate(@PathVariable Long id, @RequestParam boolean active) Activates or deactivates a workflow.- Parameters:
id- the workflow ID to activate/deactivateactive- true to activate, false to deactivate
-