Skip to content

Commit 936d315

Browse files
authored
Merge pull request #413 from navikt/delete_entry
End point for deleting entry from index.
2 parents 1c59f0b + 2de41af commit 936d315

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/main/kotlin/no/nav/klage/search/api/controller/AdminController.kt

+15-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import no.nav.klage.search.service.saksbehandler.OAuthTokenService
77
import no.nav.klage.search.util.getLogger
88
import no.nav.security.token.support.core.api.ProtectedWithClaims
99
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.*
1312

1413
@RestController
1514

@@ -36,6 +35,19 @@ class AdminController(
3635
}
3736
}
3837

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+
3951
private fun validateUserIsAdmin() {
4052
if (!oAuthTokenService.isAdmin()) {
4153
throw MissingTilgangException("Not an admin")

0 commit comments

Comments
 (0)