Add Mapping
This commit is contained in:
10
src/main/kotlin/ltd/hlaeja/util/Mapping.kt
Normal file
10
src/main/kotlin/ltd/hlaeja/util/Mapping.kt
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user