Skip to content

Commit bc25d9e

Browse files
giacomoaccursiandrea-acampora
authored andcommitted
chore: use onSuccess instead of onComplete method
1 parent 865cc71 commit bc25d9e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main/kotlin/infrastructure/api/handlers/SurgeryReportInfoHandler.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
package infrastructure.api.handlers
1010

11-
import application.presenter.api.report.toSurgeryReportInfoDto
11+
import application.presenter.serialization.SurgeryReportSerializer.toApiDto
1212
import application.service.SurgeryReportService.SurgeryReportInfoService
1313
import infrastructure.provider.Provider
1414
import io.netty.handler.codec.http.HttpResponseStatus
1515
import io.vertx.core.Handler
1616
import io.vertx.ext.web.RoutingContext
17-
import kotlinx.serialization.encodeToString
1817
import kotlinx.serialization.json.Json
18+
import kotlinx.serialization.json.encodeToJsonElement
1919

2020
/**
2121
* The handler for the authentication API.
@@ -28,16 +28,12 @@ class SurgeryReportInfoHandler(
2828
SurgeryReportInfoService(
2929
routingContext.pathParam("processId"),
3030
provider.webClient,
31-
).execute().onComplete {
31+
).execute().onSuccess { report ->
3232
routingContext
3333
.response()
3434
.setStatusCode(HttpResponseStatus.OK.code())
3535
.end(
36-
Json.encodeToString(
37-
it.map { sr ->
38-
sr.toSurgeryReportInfoDto()
39-
}.result(),
40-
),
36+
Json.encodeToJsonElement(report.toApiDto()).toString(),
4137
)
4238
}
4339
}

0 commit comments

Comments
 (0)