add IdentityController

This commit is contained in:
2024-11-22 23:59:48 +01:00
parent 919ede7da8
commit f6eedeb321
3 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package ltd.hlaeja.controller
import java.util.UUID
import ltd.hlaeja.library.deviceRegistry.Identity
import ltd.hlaeja.service.NodeService
import ltd.hlaeja.util.toIdentityResponse
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/identity")
class IdentityController(
private val nodeService: NodeService,
) {
@GetMapping("/device-{device}")
suspend fun getIdentityFromDevice(
@PathVariable device: UUID,
): Identity.Response = nodeService.getNodeFromDevice(device).toIdentityResponse()
}