add toIdentityResponse to mapping
This commit is contained in:
@@ -3,6 +3,7 @@ package ltd.hlaeja.util
|
||||
import java.time.ZonedDateTime
|
||||
import ltd.hlaeja.entity.NodeEntity
|
||||
import ltd.hlaeja.entity.TypeEntity
|
||||
import ltd.hlaeja.library.deviceRegistry.Identity
|
||||
import ltd.hlaeja.library.deviceRegistry.Node
|
||||
import ltd.hlaeja.library.deviceRegistry.Type
|
||||
import org.springframework.http.HttpStatus.EXPECTATION_FAILED
|
||||
@@ -29,3 +30,9 @@ fun NodeEntity.toNodeResponse(): Node.Response = Node.Response(
|
||||
device,
|
||||
name,
|
||||
)
|
||||
|
||||
fun NodeEntity.toIdentityResponse(): Identity.Response = Identity.Response(
|
||||
client,
|
||||
id ?: throw ResponseStatusException(EXPECTATION_FAILED),
|
||||
device,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user