File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
src/main/kotlin/infrastructure/webclient Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -115,14 +115,20 @@ class WebClient(vertx: Vertx) :
115115 preOperatingRoomId : RoomData .RoomId ? ,
116116 operatingRoomId : RoomData .RoomId ? ,
117117 ): Future <SurgicalProcess ?> =
118- client.getAbs(" $SPMS_URI /processes" ).send().map {
119- Json .decodeFromString<ResponseEntryList <SurgicalProcessDto >>(
120- it.bodyAsString(),
121- ).entries.map { processDto ->
122- processDto.toSurgicalProcess()
123- }.firstOrNull { process ->
124- process.preOperatingRoom.id.id == preOperatingRoomId?.id ||
125- process.operatingRoom.id.id == operatingRoomId?.id
118+ client.getAbs(" $SPMS_URI /processes" ).send().run {
119+ map {
120+ if (it.statusCode() == HttpResponseStatus .OK .code()) {
121+ Json .decodeFromString<ResponseEntryList <SurgicalProcessDto >>(
122+ it.bodyAsString(),
123+ ).entries.map { processDto ->
124+ processDto.toSurgicalProcess()
125+ }.firstOrNull { process ->
126+ process.preOperatingRoom.id.id == preOperatingRoomId?.id ||
127+ process.operatingRoom.id.id == operatingRoomId?.id
128+ }
129+ } else {
130+ null
131+ }
126132 }
127133 }
128134
You can’t perform that action at this time.
0 commit comments