diff --git a/api.http b/api.http index 00d5557..1e6a02c 100644 --- a/api.http +++ b/api.http @@ -7,8 +7,7 @@ Authorization: {{auth-token}} "data": { "number": "KA01HD6677", "owner": "gowthaman" - }, - "uniqueIdentifier": "KA01HD6677" + } } ### create row @@ -55,17 +54,6 @@ Authorization: Bearer {{auth-token}} GET http://localhost:9001/api/vehicle/KA01HD6677 Authorization: Bearer {{auth-token}} -### query row -POST http://localhost:9001/api/vehicle/query -Content-Type: application/json -Authorization: {{set-auth-token}} - -{ - "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" - } -} ### search row POST http://localhost:9001/api/vehicle/search @@ -73,7 +61,8 @@ Content-Type: application/json Authorization: {{auth-token}} { - "number": "KA01HD6677" + "number": "KA01HD6677", + "owner": "gowthaman" } ### update field diff --git a/src/main/kotlin/com/restapi/domain/db.kt b/src/main/kotlin/com/restapi/domain/db.kt index 6c90239..5c91bbf 100644 --- a/src/main/kotlin/com/restapi/domain/db.kt +++ b/src/main/kotlin/com/restapi/domain/db.kt @@ -206,7 +206,8 @@ object Session { .findOne() ?: throw DataNotFoundException } - private fun seqName(entity: String) = "sequence_$entity" + private fun seqName(entity: String) = "sequence_${entity}_${currentTenant()}" + fun creatSeq(entity: String): Int { return database.sqlUpdate("CREATE SEQUENCE IF NOT EXISTS ${seqName(entity)} START 1;").execute() }