All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.provenance.p8e.shared.domain.ServiceIdentity.kt Maven / Gradle / Ivy

package io.provenance.p8e.shared.domain

import org.jetbrains.exposed.dao.Entity
import org.jetbrains.exposed.dao.EntityClass
import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.dao.id.IdTable
import org.jetbrains.exposed.sql.Column
import java.util.*

object ServiceIdentityTable : IdTable("service_identity") {
    val publicKey = text("public_key").references(ServiceAccountTable.id)
    val identityUuid = uuid("identity_uuid")

    override val id: Column> = publicKey.entityId()
}

open class ServiceIdentityEntityClass : EntityClass(ServiceIdentityTable) {
    fun fromServiceRecord(serviceRecord: ServiceAccountRecord, identityUuid: UUID) = new(serviceRecord.publicKey.value) {
        this.identityUuid = identityUuid
    }
}

class ServiceIdentityRecord(id: EntityID): Entity(id) {
    companion object: ServiceIdentityEntityClass()

    var publicKey by ServiceIdentityTable.id
    var identityUuid by ServiceIdentityTable.identityUuid
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy