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

io.provenance.p8e.shared.domain.AffiliateIdentity.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 AffiliateIdentityTable : IdTable("affiliate_identity") {
    val publicKey = text("public_key").references(AffiliateTable.id)
    val identityUuid = uuid("identity_uuid")

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

open class AffiliateIdentityEntityClass : EntityClass(AffiliateIdentityTable) {
    fun fromAffiliateRecord(affiliateRecord: AffiliateRecord, identityUuid: UUID) = new(affiliateRecord.publicKey.value) {
        this.identityUuid = identityUuid
    }
}

class AffiliateIdentityRecord(id: EntityID): Entity(id) {
    companion object: AffiliateIdentityEntityClass()

    var publicKey by AffiliateIdentityTable.id
    var identityUuid by AffiliateIdentityTable.identityUuid
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy