Skip to content

Commit

Permalink
Add Poll Entity to Message Entities
Browse files Browse the repository at this point in the history
  • Loading branch information
JcMinarro committed Jun 13, 2024
1 parent c00e3cd commit d02041e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ internal data class MessageInnerEntity(
val moderationDetails: ModerationDetailsEntity? = null,
/** When the message text was updated */
val messageTextUpdatedAt: Date? = null,
val poll: PollEntity? = null,
)

internal const val MESSAGE_ENTITY_TABLE_NAME = "stream_chat_message"
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ internal suspend fun MessageEntity.toModel(
skipPushNotification = skipPushNotification,
moderationDetails = moderationDetails?.toModel(),
messageTextUpdatedAt = messageTextUpdatedAt,
poll = poll?.toModel(getUser),
)
}

Expand Down Expand Up @@ -118,6 +119,7 @@ internal fun Message.toEntity(): MessageEntity = MessageEntity(
skipEnrichUrl = skipEnrichUrl,
moderationDetails = moderationDetails?.toEntity(),
messageTextUpdatedAt = messageTextUpdatedAt,
poll = poll?.toEntity(),
),
attachments = attachments.mapIndexed { index, attachment -> attachment.toEntity(id, index) },
latestReactions = latestReactions.map(Reaction::toEntity),
Expand Down Expand Up @@ -164,6 +166,7 @@ internal suspend fun ReplyMessageEntity.toModel(
pinnedBy = pinnedByUserId?.let { getUser(it) },
moderationDetails = moderationDetails?.toModel(),
messageTextUpdatedAt = messageTextUpdatedAt,
poll = poll?.toModel(getUser),
)
}
}
Expand Down Expand Up @@ -199,6 +202,7 @@ internal fun Message.toReplyEntity(): ReplyMessageEntity =
pinExpires = pinExpires,
pinnedByUserId = pinnedBy?.id,
moderationDetails = moderationDetails?.toEntity(),
poll = poll?.toEntity(),
),
attachments = attachments.mapIndexed { index, attachment -> attachment.toReplyEntity(id, index) },
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ internal data class ReplyMessageInnerEntity(
val moderationDetails: ModerationDetailsEntity? = null,
/** Date when the message text was updated **/
val messageTextUpdatedAt: Date? = null,
val poll: PollEntity? = null,
)

internal const val REPLY_MESSAGE_ENTITY_TABLE_NAME = "stream_chat_reply_message"

0 comments on commit d02041e

Please sign in to comment.