Add Mapping

This commit is contained in:
2024-11-23 03:14:59 +01:00
parent 973da40603
commit c753d241e1
2 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
package ltd.hlaeja.util
import ltd.hlaeja.entity.TypeEntity
import ltd.hlaeja.library.deviceRegistry.Type
import org.springframework.http.HttpStatus.EXPECTATION_FAILED
import org.springframework.web.server.ResponseStatusException
fun TypeEntity.toTypeResponse(): Type.Response {
return Type.Response(id ?: throw ResponseStatusException(EXPECTATION_FAILED), name)
}