mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2024-11-17 13:33:47 +00:00
more fixes to god of fixes
This commit is contained in:
parent
8730c67084
commit
44b2b849e4
@ -151,7 +151,11 @@ class ExposedPostsRepo(
|
||||
override suspend fun getIdByChatAndMessage(chatId: IdChatIdentifier, messageId: MessageIdentifier): PostId? {
|
||||
return transaction(database) {
|
||||
with(contentRepo) {
|
||||
select { chatIdColumn.eq(chatId.chatId).and(threadIdColumn.eq(chatId.threadId)).and(messageIdColumn.eq(messageId)) }.limit(1).firstOrNull() ?.get(postIdColumn)
|
||||
select {
|
||||
chatIdColumn.eq(chatId.chatId)
|
||||
.and(chatId.threadId ?.let { threadIdColumn.eq(it) } ?: threadIdColumn.isNull())
|
||||
.and(messageIdColumn.eq(messageId))
|
||||
}.limit(1).firstOrNull() ?.get(postIdColumn)
|
||||
} ?.let(::PostId)
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.PollIdentifier
|
||||
import org.jetbrains.exposed.sql.*
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.isNull
|
||||
import org.jetbrains.exposed.sql.statements.*
|
||||
|
||||
class ExposedPollsToMessagesInfoRepo(
|
||||
@ -21,7 +23,7 @@ class ExposedPollsToMessagesInfoRepo(
|
||||
private val messageIdColumn = long("message_id")
|
||||
override val selectById: ISqlExpressionBuilder.(PollIdentifier) -> Op<Boolean> = { keyColumn.eq(it) }
|
||||
override val selectByValue: ISqlExpressionBuilder.(ShortMessageInfo) -> Op<Boolean> = {
|
||||
chatIdColumn.eq(it.chatId.chatId).and(threadIdColumn.eq(it.chatId.threadId)).and(
|
||||
chatIdColumn.eq(it.chatId.chatId).and(it.chatId.threadId ?.let { threadIdColumn.eq(it) } ?: threadIdColumn.isNull()).and(
|
||||
messageIdColumn.eq(it.messageId)
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user