data class ChannelEntity
ChannelStateEntity stores both the channel information as well as references to all of the channel's state
note that we don't store channel watchers or watcher_count. as that information is likely to go stale when you go offline.
messages are stored on their own table for easier pagination and updates
<init> |
create a ChannelStateEntity from a Channel object ChannelEntity(c: Channel)
ChannelStateEntity stores both the channel information as well as references to all of the channel's state ChannelEntity(type: String, channelId: String) |
channelId |
var channelId: String |
cid |
var cid: String |
createdAt |
when the channel was created var createdAt: Date? |
createdByUserId |
created by user id var createdByUserId: String? |
deletedAt |
when the channel was deleted var deletedAt: Date? |
extraData |
all the custom data provided for this channel var extraData: MutableMap<String, Any> |
frozen |
if the channel is frozen or not (new messages wont be allowed) var frozen: Boolean |
hidden |
if the channel is hidden (new messages will cause to reappear) var hidden: Boolean |
hideMessagesBefore |
hide messages before this date var hideMessagesBefore: Date? |
lastMessageAt |
denormalize the last message date so we can sort on it var lastMessageAt: Date? |
members |
list of the channel members, can be regular members, moderators or admins var members: MutableMap<String, MemberEntity> |
mutedTill |
till when the channel is muted var mutedTill: Date? |
reads |
list of how far each user has read var reads: MutableMap<String, ChannelUserReadEntity> |
syncStatus |
if the channel has been synced to the servers var syncStatus: SyncStatus |
type |
var type: String |
updatedAt |
when the channel was updated var updatedAt: Date? |
addMessage |
updates last message and lastmessagedate on this channel entity fun addMessage(messageEntity: MessageEntity): Unit |
setMember |
fun setMember(userId: String, member: Member?): Unit |
toChannel |
convert a channelEntity into a channel object fun toChannel(userMap: Map<String, User>): Channel |
updateReads |
updates last message and lastmessagedate on this channel entity fun updateReads(read: ChannelUserRead): Unit |