Making eventId as primary key

This commit is contained in:
Maxime NATUREL 2022-04-29 13:10:37 +02:00
parent a2aafb9b6b
commit 61b1e84e61
2 changed files with 3 additions and 2 deletions

View file

@ -17,6 +17,7 @@
package org.matrix.android.sdk.internal.database.model.livelocation
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
/**
* Aggregation info concerning a live location share.
@ -25,6 +26,7 @@ internal open class LiveLocationAggregatedSummaryEntity(
/**
* Event id of the event that started the live.
*/
@PrimaryKey
var eventId: String = "",
var roomId: String = "",

View file

@ -38,8 +38,7 @@ internal fun LiveLocationAggregatedSummaryEntity.Companion.create(
roomId: String,
eventId: String,
): LiveLocationAggregatedSummaryEntity {
val obj = realm.createObject(LiveLocationAggregatedSummaryEntity::class.java).apply {
this.eventId = eventId
val obj = realm.createObject(LiveLocationAggregatedSummaryEntity::class.java, eventId).apply {
this.roomId = roomId
}
val annotationSummary = EventAnnotationsSummaryEntity.getOrCreate(realm, roomId = roomId, eventId = eventId)