File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
src/main/kotlin/infrastructure/api/handlers Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ package infrastructure.api.handlers
1111import application.presenter.api.report.toSurgeryReportEntryDto
1212import application.service.SurgeryReportService.SurgeryReportArchiveService
1313import infrastructure.provider.Provider
14+ import io.netty.handler.codec.http.HttpResponseStatus
1415import io.vertx.core.Handler
1516import io.vertx.ext.web.RoutingContext
1617import kotlinx.serialization.encodeToString
@@ -24,18 +25,14 @@ class SurgeryReportsArchiveHandler(
2425) : Handler<RoutingContext> {
2526
2627 override fun handle (routingContext : RoutingContext ) {
27- SurgeryReportArchiveService (provider.webClient).execute().onComplete {
28- routingContext
29- .response()
30- .end(
31- Json .encodeToString(
32- it.map { list ->
33- list.map { sr ->
34- sr.toSurgeryReportEntryDto()
35- }
36- }.result(),
37- ),
28+ SurgeryReportArchiveService (provider.webClient).execute().onSuccess { reports ->
29+ reports.map { report ->
30+ report.toSurgeryReportEntryDto()
31+ }.run {
32+ routingContext.response().setStatusCode(HttpResponseStatus .OK .code()).end(
33+ Json .encodeToString(this ),
3834 )
35+ }
3936 }
4037 }
4138}
You can’t perform that action at this time.
0 commit comments