Use companion objects for static version and health
This commit is contained in:
parent
85ffbbf244
commit
ad112e7b40
@ -8,15 +8,17 @@ data class HealthResponse(
|
|||||||
val healthy: Boolean,
|
val healthy: Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
val healthResponse = HealthResponse(
|
|
||||||
healthy = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
class HealthController {
|
class HealthController {
|
||||||
|
companion object {
|
||||||
|
val HEALTH = HealthResponse(
|
||||||
|
healthy = true,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/health")
|
@GetMapping("/health")
|
||||||
fun healthCheck(): ResponseEntity<HealthResponse> {
|
fun healthCheck(): ResponseEntity<HealthResponse> {
|
||||||
return ResponseEntity.ok(healthResponse)
|
return ResponseEntity.ok(HEALTH)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,12 +8,14 @@ data class VersionResponse(
|
|||||||
val version: String,
|
val version: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
val versionResponse = VersionResponse(
|
|
||||||
version = "v20250310",
|
|
||||||
)
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
class VersionController {
|
class VersionController {
|
||||||
@GetMapping("/version")
|
companion object {
|
||||||
fun getVersion(): ResponseEntity<VersionResponse> = ResponseEntity.ok(versionResponse)
|
val VERSION = VersionResponse(
|
||||||
|
version = "v20250310",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/version")
|
||||||
|
fun getVersion(): ResponseEntity<VersionResponse> = ResponseEntity.ok(VERSION)
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user