nise/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/StatisticsController.kt
2024-02-14 17:43:11 +01:00

22 lines
620 B
Kotlin

package com.nisemoe.nise.controller
import com.nisemoe.nise.Statistics
import com.nisemoe.nise.scheduler.GlobalCache
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
@RestController
class StatisticsController (
private val globalCache: GlobalCache
) {
@GetMapping("stats")
fun getStatistics(): ResponseEntity<Statistics> {
val statistics = this.globalCache.statistics
?: return ResponseEntity.status(503).build()
return ResponseEntity.ok(statistics)
}
}