diff --git a/openbas-api/src/main/java/io/openbas/opencti/OpenCTIApi.java b/openbas-api/src/main/java/io/openbas/opencti/OpenCTIApi.java index 72bf376632..5da7f331e8 100644 --- a/openbas-api/src/main/java/io/openbas/opencti/OpenCTIApi.java +++ b/openbas-api/src/main/java/io/openbas/opencti/OpenCTIApi.java @@ -1,5 +1,6 @@ package io.openbas.opencti; +import io.openbas.aop.LogExecutionTime; import io.openbas.rest.exercise.form.ExerciseSimple; import io.openbas.service.ScenarioService; import io.swagger.v3.oas.annotations.Operation; @@ -33,6 +34,7 @@ public class OpenCTIApi { }), @ApiResponse(responseCode = "404", description = "Exercise not found", content = @Content) }) + @LogExecutionTime @GetMapping(OPENCTI_URI + "/exercises/latest/{externalReferenceId}") public ExerciseSimple latestExerciseByExternalReference(@PathVariable @NotBlank final String externalReferenceId) { return scenarioService.latestExerciseByExternalReference(externalReferenceId); diff --git a/openbas-api/src/main/java/io/openbas/rest/exercise/ExerciseApi.java b/openbas-api/src/main/java/io/openbas/rest/exercise/ExerciseApi.java index b2602ebee3..c2c595d72d 100644 --- a/openbas-api/src/main/java/io/openbas/rest/exercise/ExerciseApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/exercise/ExerciseApi.java @@ -1,6 +1,7 @@ package io.openbas.rest.exercise; import com.fasterxml.jackson.databind.ObjectMapper; +import io.openbas.aop.LogExecutionTime; import io.openbas.database.model.*; import io.openbas.database.raw.*; import io.openbas.database.repository.*; @@ -622,11 +623,13 @@ public Exercise changeExerciseStatus( return exerciseRepository.save(exercise); } + @LogExecutionTime @GetMapping(EXERCISE_URI) public List exercises() { return exerciseService.exercises(); } + @LogExecutionTime @PostMapping(EXERCISE_URI + "/search") public Page exercises(@RequestBody @Valid final SearchPaginationInput searchPaginationInput) { if (currentUser().isAdmin()) { diff --git a/openbas-api/src/main/java/io/openbas/rest/scenario/ScenarioExerciseApi.java b/openbas-api/src/main/java/io/openbas/rest/scenario/ScenarioExerciseApi.java index cb11877ce3..ac1efe5fdc 100644 --- a/openbas-api/src/main/java/io/openbas/rest/scenario/ScenarioExerciseApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/scenario/ScenarioExerciseApi.java @@ -1,5 +1,6 @@ package io.openbas.rest.scenario; +import io.openbas.aop.LogExecutionTime; import io.openbas.database.model.Exercise; import io.openbas.rest.exercise.ExerciseService; import io.openbas.rest.exercise.form.ExerciseSimple; @@ -25,12 +26,14 @@ public class ScenarioExerciseApi { private final ExerciseService exerciseService; + @LogExecutionTime @GetMapping(SCENARIO_URI + "/{scenarioId}/exercises") @PreAuthorize("isScenarioObserver(#scenarioId)") public Iterable scenarioExercises(@PathVariable @NotBlank final String scenarioId) { return exerciseService.scenarioExercises(scenarioId); } + @LogExecutionTime @PostMapping(SCENARIO_URI + "/{scenarioId}/exercises/search") @PreAuthorize("isScenarioObserver(#scenarioId)") public Iterable scenarioExercises(