Skip to content

Commit 81eb9fb

Browse files
fix: use query parameter instead of body
1 parent 41269bd commit 81eb9fb

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

src/main/kotlin/application/presenter/api/room/ZoneInfoDto.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,3 @@ data class ZoneInfoDto(
2020
val preOperatingRoomId: String?,
2121
val operatingRoomId: String?,
2222
)
23-
24-
/**
25-
* The Dto for the information about the [preOperatingRoomId]
26-
* and [operatingRoomId] in a zone.
27-
*/
28-
@Serializable
29-
data class RoomsInZoneDto(
30-
val preOperatingRoomId: String,
31-
val operatingRoomId: String,
32-
)

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
package infrastructure.api.handlers
1010

1111
import application.presenter.api.process.toSurgicalProcessDto
12-
import application.presenter.api.room.RoomsInZoneDto
1312
import application.service.ProcessService
1413
import entity.room.RoomData
1514
import infrastructure.provider.Provider
@@ -28,18 +27,20 @@ class ProcessInfoHandler(
2827

2928
override fun handle(routingContext: RoutingContext) {
3029
routingContext.request().body().onSuccess {
31-
Json.decodeFromString<RoomsInZoneDto>(it.toString()).run {
32-
ProcessService.GetProcessInfoByRoomId(
33-
RoomData.RoomId(this.preOperatingRoomId),
34-
RoomData.RoomId(this.operatingRoomId),
35-
provider.webClient,
36-
).execute().onSuccess { surgicalProcess ->
37-
if (surgicalProcess != null) {
38-
routingContext.response().setStatusCode(HttpResponseStatus.OK.code())
39-
.putHeader("content-type", "application/json")
40-
.end(Json.encodeToString(surgicalProcess.toSurgicalProcessDto()))
41-
} else {
42-
routingContext.response().setStatusCode(HttpResponseStatus.NO_CONTENT.code()).end()
30+
routingContext.queryParam("preOperatingRoomId").firstOrNull()?.let { preOrId ->
31+
routingContext.queryParam("operatingRoomId").firstOrNull()?.let { orId ->
32+
ProcessService.GetProcessInfoByRoomId(
33+
RoomData.RoomId(preOrId),
34+
RoomData.RoomId(orId),
35+
provider.webClient,
36+
).execute().onSuccess { surgicalProcess ->
37+
if (surgicalProcess != null) {
38+
routingContext.response().setStatusCode(HttpResponseStatus.OK.code())
39+
.putHeader("content-type", "application/json")
40+
.end(Json.encodeToString(surgicalProcess.toSurgicalProcessDto()))
41+
} else {
42+
routingContext.response().setStatusCode(HttpResponseStatus.NO_CONTENT.code()).end()
43+
}
4344
}
4445
}
4546
}

0 commit comments

Comments
 (0)