20 lines
654 B
Kotlin
20 lines
654 B
Kotlin
package net.keinekekse.app.books.db.schema
|
|
|
|
import net.keinekekse.app.books.model.ArtistRole
|
|
import org.jetbrains.exposed.v1.core.dao.id.EntityID
|
|
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable
|
|
import org.jetbrains.exposed.v1.dao.IntEntity
|
|
import org.jetbrains.exposed.v1.dao.IntEntityClass
|
|
|
|
object ArtistRolesTable : IntIdTable("artist_roles") {
|
|
var role = varchar("role", 50).index()
|
|
}
|
|
|
|
class ArtistRoleDAO(id: EntityID<Int>) : IntEntity(id) {
|
|
companion object : IntEntityClass<ArtistRoleDAO>(ArtistRolesTable)
|
|
|
|
var role by ArtistRolesTable.role
|
|
}
|
|
|
|
fun artistToRoleDaoToModel(dao: ArtistRoleDAO) = ArtistRole(dao.id.value, dao.role)
|