add NodeController

This commit is contained in:
2024-11-22 23:00:55 +01:00
parent 8a5a86abc3
commit 1fadfad323
3 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package ltd.hlaeja.controller
import ltd.hlaeja.library.deviceRegistry.Node
import ltd.hlaeja.service.NodeService
import ltd.hlaeja.util.toEntity
import ltd.hlaeja.util.toNodeResponse
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController
@RestController
class NodeController(
private val nodeService: NodeService,
) {
@PostMapping("/node")
suspend fun addNode(
@RequestBody request: Node.Request,
): Node.Response = nodeService.addNode(request.toEntity()).toNodeResponse()
}