add method "getContentsIds"

This commit is contained in:
2019-11-11 00:20:55 +06:00
parent 4e3e59435b
commit 1328a0c84d
3 changed files with 11 additions and 0 deletions
core/src
commonMain
kotlin
com
insanusmokrassar
postssystem
core
commonTest
kotlin
com
insanusmokrassar
postssystem
exposed/src/main/kotlin/com/insanusmokrassar/postssystem/core/exposed

@ -64,6 +64,11 @@ private class ContentAPIDatabaseTable(
Json.plain.parse(Content.serializer(), get(dataColumn))
)
override suspend fun getContentsIds(): Set<ContentId> {
return transaction {
selectAll().map { it[idColumn] }
}.toSet()
}
override suspend fun getContentById(id: ContentId): RegisteredContent? {
return transaction {
select { idColumn.eq(id) }.firstOrNull() ?.asRegisteredContent()