diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9383d6f..fd4e49e 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -9,7 +9,7 @@
-
+
\ No newline at end of file
diff --git a/api.http b/api.http
index 3b3df0c..3b4c02a 100644
--- a/api.http
+++ b/api.http
@@ -9,22 +9,33 @@ Content-Type: application/json
"uniqueIdentifier": "KA03HD6064"
}
+### create row, with autogenerated identifier
+POST http://localhost:9001/api/log
+Content-Type: application/json
+
+{
+ "data": {
+ "user": "gowthaman",
+ "action": "logout"
+ }
+}
+
### get row
-GET http://localhost:9001/api/vehicle/1
+GET http://localhost:9001/api/vehicle/KA03HD6064
### query row
POST http://localhost:9001/api/vehicle/query
Content-Type: application/json
{
- "sql": "select id, tenant_id, deleted_on, deleted_by, deleted, version, created_at, modified_at, created_by, modified_by, data, tags, comments, unique_identifier, entity_name from data_model where data ->> 'number' = :number",
+ "sql": "select sys_pk, tenant_id, deleted_on, deleted_by, deleted, version, created_at, modified_at, created_by, modified_by, data, tags, comments, unique_identifier, entity_name from data_model where data ->> 'number' = :number",
"params": {
"number": "KA03HD6064"
}
}
### update field
-PATCH http://localhost:9001/api/vehicle/1
+PATCH http://localhost:9001/api/vehicle/KA03HD6064
Content-Type: application/json
{
@@ -34,7 +45,7 @@ Content-Type: application/json
### upate a row
-PUT http://localhost:9001/api/vehicle/1
+PUT http://localhost:9001/api/vehicle/KA03HD6064
Content-Type: application/json
{
@@ -44,4 +55,4 @@ Content-Type: application/json
}
### delete a row
-DELETE http://localhost:9001/api/vehicle/1
\ No newline at end of file
+DELETE http://localhost:9001/api/vehicle/KA03HD6064
\ No newline at end of file
diff --git a/app-sample.properties b/app-sample.properties
new file mode 100644
index 0000000..61b1b23
--- /dev/null
+++ b/app-sample.properties
@@ -0,0 +1,7 @@
+app.port=9001
+app.cors.enabled=true
+app.cors.hosts=www.readymixerp.com,app.readymixerp.com
+app.db.user=postgres
+app.db.pass=postgres
+app.db.url=jdbc:postgresql://192.168.64.6/modules_app
+app.db.run_migration=true
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 42cf0c1..c66d053 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -27,7 +27,8 @@ dependencies {
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.+")
implementation("org.slf4j:slf4j-simple:2.0.7")
-
+ api ("net.cactusthorn.config:config-core:0.81")
+ kapt("net.cactusthorn.config:config-compiler:0.81")
kapt("io.ebean:kotlin-querybean-generator:13.23.2")
}
@@ -40,5 +41,5 @@ kotlin {
}
application {
- mainClass.set("com.readymixerp.MainKt")
+ mainClass.set("com.restapi.MainKt")
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/readymixerp/Main.kt b/src/main/kotlin/com/readymixerp/Main.kt
deleted file mode 100644
index 33183d8..0000000
--- a/src/main/kotlin/com/readymixerp/Main.kt
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.readymixerp
-
-import com.readymixerp.domain.DataModel
-import com.readymixerp.domain.Session
-import com.readymixerp.domain.Session.database
-import io.ebean.CallableSql
-import io.ebean.DuplicateKeyException
-import io.ebean.RawSqlBuilder
-import io.javalin.Javalin
-import io.javalin.apibuilder.ApiBuilder.*
-import io.javalin.http.*
-import io.javalin.json.JavalinJackson
-import java.time.LocalDateTime
-
-fun main(args: Array) {
- Javalin
- .create { cfg ->
- cfg.http.generateEtags = true
- cfg.plugins.enableCors { container ->
- container.add {
- it.allowHost(
- "http://localhost:5173",
- "https://www.readymixerp.com",
- "https://app.readymixerp.com"
- )
- }
- }
- cfg.http.defaultContentType = ContentType.JSON
- cfg.compression.gzipOnly()
- cfg.jsonMapper(JavalinJackson(Session.objectMapper))
- }
- .routes {
- before("/*") {
- //validate, auth token
- }
- path("/api") {
- post("/execute/{name}"){
- val name = it.pathParam("name")
- val params = it.bodyAsClass