handle job

This commit is contained in:
gowthaman 2024-06-15 10:37:52 +05:30
parent fc43e84302
commit 9aafe5a95c
4 changed files with 16 additions and 1 deletions

View File

@ -33,6 +33,7 @@ enum class QueryParamType {
sealed class QueryParam {
data class StrParam(val str: String) : QueryParam()
data class NumberParam(val nbr: Number) : QueryParam()
data class BooleanParam(val bool: Boolean) : QueryParam()
data class ComplexParam(val type: QueryParamType, val value: String) : QueryParam() {
fun getValueComplex(): Any {
return when (type) {
@ -63,6 +64,7 @@ sealed class QueryParam {
is ComplexParam -> getValueComplex()
is StrParam -> str
is NumberParam -> nbr
is BooleanParam -> bool
}
}
}
@ -74,6 +76,8 @@ class QueryParamDeSerializer : JsonDeserializer<QueryParam>() {
QueryParam.StrParam(node.asText())
} else if (node.isNumber) {
QueryParam.NumberParam(node.numberValue())
} else if (node.isBoolean) {
QueryParam.BooleanParam(node.booleanValue())
} else if (node.isObject) {
QueryParam.ComplexParam(
QueryParamType.valueOf(node.get("type").textValue()),
@ -109,6 +113,7 @@ object Entities {
}
e.update()
ctx.json(OK)
}
fun update(ctx: Context) {

View File

@ -38,7 +38,7 @@ open class IncomingInventory : BaseTenantModel() {
}
enum class OutMode {
PERSON, VEHICLE, ALL
PERSON, VEHICLE, ALL, JOB, OFFICE
}
@Entity

View File

@ -0,0 +1,4 @@
-- drop dependencies
alter table outgoing_inventory drop constraint if exists ck_outgoing_inventory_out_mode;
-- apply post alter
alter table outgoing_inventory add constraint ck_outgoing_inventory_out_mode check ( out_mode in ('PERSON','VEHICLE','ALL','JOB','OFFICE'));

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
<changeSet type="apply">
<alterColumn columnName="out_mode" tableName="outgoing_inventory" checkConstraint="check ( out_mode in ('PERSON','VEHICLE','ALL','JOB','OFFICE'))" checkConstraintName="ck_outgoing_inventory_out_mode"/>
</changeSet>
</migration>