move sql to new model

This commit is contained in:
gowthaman.b
2023-11-13 19:59:41 +05:30
parent 5c13e0efdd
commit 25a5852e65
9 changed files with 125 additions and 27 deletions

View File

@@ -163,10 +163,10 @@ object Session {
fun currentToken() = currentUser.get().token
fun jwk() = keypair.toParams(JsonWebKey.OutputControlLevel.PUBLIC_ONLY)
fun Database.findByEntityAndId(entity: String, id: String): DataModel {
fun Database.findDataModelByEntityAndUniqId(entity: String, uniqId: String): DataModel {
return find(DataModel::class.java)
.where()
.eq("uniqueIdentifier", id)
.eq("uniqueIdentifier", uniqId)
.eq("entityName", entity)
.findOne() ?: throw DataNotFoundException
}

View File

@@ -169,6 +169,18 @@ enum class JobType {
SCRIPT, DB
}
@Entity
@Index(unique = true, name = "sql_unique_id", columnNames = ["entity_name", "sql_id", "tenant_id"])
open class SqlModel : BaseTenantModel(){
@JsonDeserialize(using = SafeStringDeserializer::class)
var sqlId: String = ""
var entityName: String = ""
@Column(columnDefinition = "text")
var sql: String = ""
}
@Entity
open class JobModel : BaseTenantModel() {
@Index(unique = true)