mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-05-02 23:29:34 -05:00
I really don't get what's happening, or rather the lack of anything happening
This commit is contained in:
+11
-7
@@ -1,5 +1,6 @@
|
||||
package org.dreamexposure.discal.server.endpoints.v3
|
||||
|
||||
import kotlinx.coroutines.reactor.mono
|
||||
import org.dreamexposure.discal.core.annotations.SecurityRequirement
|
||||
import org.dreamexposure.discal.core.logger.LOGGER
|
||||
import org.dreamexposure.discal.core.`object`.new.model.discal.HeartbeatV3RequestModel
|
||||
@@ -9,6 +10,7 @@ import org.dreamexposure.discal.core.`object`.new.security.TokenType.INTERNAL
|
||||
import org.dreamexposure.discal.core.`object`.rest.GenericResponse
|
||||
import org.dreamexposure.discal.server.business.NetworkStatusService
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/v3/status")
|
||||
@@ -22,15 +24,17 @@ class StatusController(
|
||||
|
||||
@SecurityRequirement(schemas = [INTERNAL], scopes = [INTERNAL_HEARTBEAT])
|
||||
@PostMapping("/heartbeat", produces = ["application/json"])
|
||||
suspend fun post(@RequestBody body: HeartbeatV3RequestModel): GenericResponse {
|
||||
fun post(@RequestBody body: HeartbeatV3RequestModel): Mono<GenericResponse> {
|
||||
LOGGER.debug("Heartbeat request received type: {}", body.type)
|
||||
|
||||
when (body.type) {
|
||||
HeartbeatV3RequestModel.Type.BOT -> networkStatusService.handleBotHeartbeat(body.bot!!)
|
||||
HeartbeatV3RequestModel.Type.WEBSITE -> networkStatusService.handleWebsiteHeartbeat(body.instance!!)
|
||||
HeartbeatV3RequestModel.Type.CAM -> networkStatusService.handleCamHeartbeat(body.instance!!)
|
||||
}
|
||||
return mono {
|
||||
when (body.type) {
|
||||
HeartbeatV3RequestModel.Type.BOT -> networkStatusService.handleBotHeartbeat(body.bot!!)
|
||||
HeartbeatV3RequestModel.Type.WEBSITE -> networkStatusService.handleWebsiteHeartbeat(body.instance!!)
|
||||
HeartbeatV3RequestModel.Type.CAM -> networkStatusService.handleCamHeartbeat(body.instance!!)
|
||||
}
|
||||
|
||||
return GenericResponse("Success!")
|
||||
return@mono GenericResponse("Success!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user