Add TypeController

This commit is contained in:
2024-11-18 15:57:08 +01:00
parent 96f09bc749
commit b5d1c04d6b
3 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
package ltd.hlaeja.controller
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import ltd.hlaeja.library.deviceRegistry.Type
import ltd.hlaeja.service.TypeService
import ltd.hlaeja.util.toTypeResponse
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
@RestController
class TypeController(
private val service: TypeService,
) {
@GetMapping("/types")
fun getTypes(): Flow<Type.Response> = service.getTypes().map { it.toTypeResponse() }
}