Skip to content

Commit dea89bd

Browse files
giacomoaccursiandrea-acampora
authored andcommitted
chore: use onSuccess method instead of onComplete method
1 parent 6901309 commit dea89bd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@ class SurgeryReportIntegrationHandler(
2525
) : Handler<RoutingContext> {
2626

2727
override fun handle(routingContext: RoutingContext) {
28-
routingContext.request().body().onComplete {
29-
val integration = Json.decodeFromString<SurgeryReportIntegrationDto>(it.result().toString())
28+
routingContext.request().body().onSuccess {
29+
val integration = Json.decodeFromString<SurgeryReportIntegrationDto>(it.toString())
3030
.toSurgeryReportIntegration()
31-
SurgeryReportIntegrationUseCase(integration, provider.webClient).execute().onComplete { ar ->
31+
SurgeryReportIntegrationUseCase(
32+
routingContext.pathParam("processId"),
33+
integration,
34+
provider.webClient,
35+
).execute().onSuccess { result ->
3236
routingContext
3337
.response()
3438
.setStatusCode(
35-
if (ar.result()) HttpResponseStatus.OK.code() else HttpResponseStatus.BAD_REQUEST.code(),
39+
if (result) HttpResponseStatus.OK.code() else HttpResponseStatus.BAD_REQUEST.code(),
3640
).end()
3741
}
3842
}

0 commit comments

Comments
 (0)