@ExecuteOn(TaskExecutors.IO)
    @Delete(uri = "{namespace}/{id}")
    @Operation(tags = {"Templates"}, summary = "Delete a template")
    @ApiResponse(responseCode = "204", description = "On success")
    public HttpResponse<Void> delete(
        @Parameter(description = "The template namespace") @PathVariable String namespace,
        @Parameter(description = "The template id") @PathVariable String id
    ) {
        Optional<Template> template = templateRepository.findById(tenantService.resolveTenant(), namespace, id);
        if (template.isPresent()) {
            templateRepository.delete(template.get());
            return HttpResponse.status(HttpStatus.NO_CONTENT);
        } else {
            return HttpResponse.status(HttpStatus.NOT_FOUND);
        }
    }
@Test
    void deleteTemplatesByIds() {
        postTemplate("template-a", "kestra.test.delete");
        postTemplate("template-b", "kestra.test.delete");
        postTemplate("template-c", "kestra.test.delete");

        List<IdWithNamespace> ids = List.of(
            new IdWithNamespace("kestra.test.delete", "template-a"),
            new IdWithNamespace("kestra.test.delete", "template-b"),
            new IdWithNamespace("kestra.test.delete", "template-c")
        );

        HttpResponse<BulkResponse> response = client
            .toBlocking()
            .exchange(DELETE("/api/v1/templates/delete/by-ids", ids), BulkResponse.class);

        assertThat(response.getBody().get().getCount(), is(3));

        HttpClientResponseException templateA = assertThrows(HttpClientResponseException.class, () -> {
            client.toBlocking().retrieve(HttpRequest.GET("/api/v1/templates/kestra.test.delete/template-a"));
        });
        HttpClientResponseException templateB = assertThrows(HttpClientResponseException.class, () -> {
            client.toBlocking().retrieve(HttpRequest.GET("/api/v1/templates/kestra.test.delete/template-b"));
        });
        HttpClientResponseException templateC = assertThrows(HttpClientResponseException.class, () -> {
            client.toBlocking().retrieve(HttpRequest.GET("/api/v1/templates/kestra.test.delete/template-c"));
        });

        assertThat(templateA.getStatus(), is(HttpStatus.NOT_FOUND));
        assertThat(templateB.getStatus(), is(HttpStatus.NOT_FOUND));
        assertThat(templateC.getStatus(), is(HttpStatus.NOT_FOUND));
    }