File tree 1 file changed +15
-3
lines changed
src/main/kotlin/no/nav/klage/search/api/controller
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,8 @@ import no.nav.klage.search.service.saksbehandler.OAuthTokenService
7
7
import no.nav.klage.search.util.getLogger
8
8
import no.nav.security.token.support.core.api.ProtectedWithClaims
9
9
import org.springframework.http.HttpStatus
10
- import org.springframework.web.bind.annotation.PostMapping
11
- import org.springframework.web.bind.annotation.ResponseStatus
12
- import org.springframework.web.bind.annotation.RestController
10
+ import org.springframework.web.bind.annotation.*
11
+ import java.util.*
13
12
14
13
@RestController
15
14
@@ -36,6 +35,19 @@ class AdminController(
36
35
}
37
36
}
38
37
38
+ @GetMapping(" /internal/behandlinger/{id}/delete" , produces = [" application/json" ])
39
+ fun deleteBehandlingFromElasticIndex (
40
+ @PathVariable(" id" ) behandlingId : UUID ,
41
+ ) {
42
+ validateUserIsAdmin()
43
+ try {
44
+ adminService.deleteBehandling(behandlingId)
45
+ } catch (e: Exception ) {
46
+ logger.warn(" Failed to delete behandling with id $behandlingId " , e)
47
+ throw e
48
+ }
49
+ }
50
+
39
51
private fun validateUserIsAdmin () {
40
52
if (! oAuthTokenService.isAdmin()) {
41
53
throw MissingTilgangException (" Not an admin" )
You can’t perform that action at this time.
0 commit comments