Skip to content

Commit

Permalink
Json Serialization added for MessageEntity. (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
divyesh11 authored Feb 17, 2025
1 parent c94799a commit f59a3c8
Showing 1 changed file with 40 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,54 @@ import androidx.room.Entity
import androidx.room.Fts4
import com.eka.conversation.common.Constants
import com.eka.conversation.data.local.db.entities.models.MessageRole
import com.google.gson.annotations.SerializedName

@Keep
@Entity(tableName = Constants.MESSAGES_TABLE_NAME,
primaryKeys = ["msg_id","session_id"])
data class MessageEntity(
@ColumnInfo(name = "msg_id") val msgId : Int,
@ColumnInfo(name = "session_id") val sessionId : String,
@ColumnInfo(name = "session_identity") val sessionIdentity: String? = null,
@ColumnInfo(name = "role") val role : MessageRole,
@ColumnInfo(name = "message_files") val messageFiles: List<String>? = null,
@ColumnInfo(name = "message_text") val messageText : String? = null,
@ColumnInfo(name = "message_html_text") val htmlString : String? = null,
@ColumnInfo(name = "created_at") val createdAt: Long,
@ColumnInfo(name = "chat_context") val chatContext: String? = null,
@ColumnInfo(name = "chat_sub_context") val chatSubContext: String? = null,
@ColumnInfo(name = "chat_session_config") val chatSessionConfig: String? = null,
@ColumnInfo(name = "msg_type") val msgType: String = "TEXT",
@ColumnInfo(name = "msg_id")
@SerializedName("msg_id")
val msgId: Int,
@ColumnInfo(name = "session_id")
@SerializedName("session_id")
val sessionId: String,
@ColumnInfo(name = "session_identity")
@SerializedName("session_identity")
val sessionIdentity: String? = null,
@ColumnInfo(name = "role")
@SerializedName("role")
val role: MessageRole,
@ColumnInfo(name = "message_files")
@SerializedName("message_files")
val messageFiles: List<String>? = null,
@ColumnInfo(name = "message_text")
@SerializedName("message_text")
val messageText: String? = null,
@ColumnInfo(name = "message_html_text")
@SerializedName("message_html_text")
val htmlString: String? = null,
@ColumnInfo(name = "created_at")
@SerializedName("created_at")
val createdAt: Long,
@ColumnInfo(name = "chat_context")
@SerializedName("chat_context")
val chatContext: String? = null,
@ColumnInfo(name = "chat_sub_context")
@SerializedName("chat_sub_context")
val chatSubContext: String? = null,
@ColumnInfo(name = "chat_session_config")
@SerializedName("chat_session_config")
val chatSessionConfig: String? = null,
@ColumnInfo(name = "msg_type")
@SerializedName("msg_type")
val msgType: String = "TEXT",
@ColumnInfo(
name = "owner_id",
defaultValue = "owner_id_default"
) val ownerId: String? = "owner_id_default",
)
@SerializedName("owner_id")
val ownerId: String? = "owner_id_default",
)

@Keep
Expand Down

0 comments on commit f59a3c8

Please sign in to comment.