40 lines
839 B
Kotlin
40 lines
839 B
Kotlin
package chats.data.local.database
|
||
|
||
import androidx.room.Entity
|
||
import androidx.room.Index
|
||
import androidx.room.PrimaryKey
|
||
|
||
/**
|
||
* Entity для хранения чатов в локальной БД Room
|
||
*/
|
||
@Entity(
|
||
tableName = "chats",
|
||
indices = [
|
||
Index(value = ["remoteId"], unique = true)
|
||
]
|
||
)
|
||
data class ChatEntity(
|
||
@PrimaryKey(autoGenerate = false)
|
||
val localId: String,
|
||
|
||
val remoteId: String?, // ID с сервера
|
||
|
||
val type: String, // PRIVATE, GROUP, CHANNEL
|
||
|
||
val name: String,
|
||
|
||
val avatar: String? = null,
|
||
|
||
val unreadCount: Int = 0,
|
||
|
||
val lastMessageId: String? = null,
|
||
|
||
val lastMessageText: String? = null,
|
||
|
||
val lastMessageTimestamp: Long? = null,
|
||
|
||
val lastMessageJson: String? = null,
|
||
|
||
val updatedAtMillis: Long = System.currentTimeMillis()
|
||
)
|