add entities and db migrations
This commit is contained in:
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonDeserializer
|
||||
import com.fasterxml.jackson.databind.JsonNode
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
||||
import com.restapi.domain.*
|
||||
import com.restapi.domain.PurchaseOrder
|
||||
import com.restapi.domain.Session.currentUser
|
||||
import com.restapi.domain.Session.database
|
||||
import com.restapi.domain.Session.findDataModelByEntityAndUniqId
|
||||
@@ -371,4 +372,17 @@ object Entities {
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
object PurchaseOrder {
|
||||
fun get(ctx :Context){
|
||||
val id = ctx.pathParam("id")
|
||||
val po = database.find(PurchaseOrder::class.java, id) ?: throw NotFoundResponse("po not found for $id")
|
||||
|
||||
ctx.json(po)
|
||||
}
|
||||
fun create(ctx :Context){
|
||||
val po = ctx.bodyAsClass<PurchaseOrder>()
|
||||
database.save(po)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user