Send message to existing chat
This commit is contained in:
1 parent
5103588519
commit
49eb22f146
10 files changed
+247
-177
No files matched your search
@@ -3,16 +3,17 @@ package at.torch.compose.database.dao
|
||||
import androidx.room3.Dao
|
||||
import androidx.room3.Query
|
||||
import androidx.room3.Upsert
|
||||
import at.torch.compose.database.model.Participant
|
||||
|
||||
@Dao
|
||||
interface ParticipantDao {
|
||||
@Query("SELECT * FROM Participant WHERE participantPublicKey = :participantPublicKey")
|
||||
fun findParticipantByPublicKey(participantPublicKey: String): at.torch.compose.database.model.Participant?
|
||||
fun findParticipantByPublicKey(participantPublicKey: String): List<Participant>
|
||||
|
||||
@Query("SELECT * FROM Participant WHERE chatRoomId = :chatRoomId")
|
||||
fun findParticipantsByChatRoomId(chatRoomId: String): List<at.torch.compose.database.model.Participant>
|
||||
fun findParticipantsByChatRoomId(chatRoomId: String): List<Participant>
|
||||
|
||||
@Upsert
|
||||
suspend fun upsert(participants: List<at.torch.compose.database.model.Participant>)
|
||||
suspend fun upsert(participants: List<Participant>)
|
||||
|
||||
}
|
||||
+5
-1
@@ -3,6 +3,7 @@ package at.torch.compose.database.repository
|
||||
import at.torch.compose.database.model.ChatMessage
|
||||
import at.torch.compose.database.model.GiftWrapPayload
|
||||
import at.torch.compose.database.model.MarmotInnerEvent
|
||||
import at.torch.compose.database.model.Participant
|
||||
import co.touchlab.kermit.Logger
|
||||
import com.vitorpamplona.quartz.marmot.mls.group.MlsGroup
|
||||
import com.vitorpamplona.quartz.marmot.mls.group.MlsGroupState
|
||||
@@ -38,10 +39,13 @@ class DatabaseChatRepository(
|
||||
return database.chatRoomDao().getChatRoomListByUserPublicKey(publicKey)
|
||||
}
|
||||
|
||||
override suspend fun getChatRoomByIdentifier(id: String): at.torch.compose.database.model.intermdiate.LocalChatRoom? {
|
||||
override suspend fun getChatRoomByIdentifier(id: HexKey): at.torch.compose.database.model.intermdiate.LocalChatRoom? {
|
||||
return database.chatRoomDao().findChatRoomById(id)
|
||||
}
|
||||
|
||||
override suspend fun getAllParticipantsWithPubKey(publicKey: HexKey): List<Participant> {
|
||||
return database.participantDao().findParticipantByPublicKey(publicKey)
|
||||
}
|
||||
override suspend fun getChatMessageListByChatRoomId(chatRoomId: String): List<at.torch.compose.database.model.intermdiate.LocalChatMessage> {
|
||||
return database.chatMessageDao().getChatMessagesByChatRoomId(chatRoomId)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user