Change to variable fields

This commit is contained in:
Ash 2022-05-16 11:11:24 +08:00
parent b010fe940b
commit 2f1263c82c
7 changed files with 23 additions and 23 deletions

View File

@ -18,13 +18,13 @@ import java.util.*
) )
data class Article( data class Article(
@PrimaryKey @PrimaryKey
val id: String, var id: String,
@ColumnInfo @ColumnInfo
val date: Date, var date: Date,
@ColumnInfo @ColumnInfo
val title: String, var title: String,
@ColumnInfo @ColumnInfo
val author: String? = null, var author: String? = null,
@ColumnInfo @ColumnInfo
var rawDescription: String, var rawDescription: String,
@ColumnInfo @ColumnInfo
@ -32,13 +32,13 @@ data class Article(
@ColumnInfo @ColumnInfo
var fullContent: String? = null, var fullContent: String? = null,
@ColumnInfo @ColumnInfo
val img: String? = null, var img: String? = null,
@ColumnInfo @ColumnInfo
val link: String, var link: String,
@ColumnInfo(index = true) @ColumnInfo(index = true)
val feedId: String, var feedId: String,
@ColumnInfo(index = true) @ColumnInfo(index = true)
val accountId: Int, var accountId: Int,
@ColumnInfo(defaultValue = "true") @ColumnInfo(defaultValue = "true")
var isUnread: Boolean = true, var isUnread: Boolean = true,
@ColumnInfo(defaultValue = "false") @ColumnInfo(defaultValue = "false")

View File

@ -5,7 +5,7 @@ import androidx.room.Relation
data class ArticleWithFeed( data class ArticleWithFeed(
@Embedded @Embedded
val article: Article, var article: Article,
@Relation(parentColumn = "feedId", entityColumn = "id") @Relation(parentColumn = "feedId", entityColumn = "id")
val feed: Feed, var feed: Feed,
) )

View File

@ -14,17 +14,17 @@ import androidx.room.*
) )
data class Feed( data class Feed(
@PrimaryKey @PrimaryKey
val id: String, var id: String,
@ColumnInfo @ColumnInfo
val name: String, var name: String,
@ColumnInfo @ColumnInfo
var icon: String? = null, var icon: String? = null,
@ColumnInfo @ColumnInfo
val url: String, var url: String,
@ColumnInfo(index = true) @ColumnInfo(index = true)
var groupId: String, var groupId: String,
@ColumnInfo(index = true) @ColumnInfo(index = true)
val accountId: Int, var accountId: Int,
@ColumnInfo(defaultValue = "false") @ColumnInfo(defaultValue = "false")
var isNotification: Boolean = false, var isNotification: Boolean = false,
@ColumnInfo(defaultValue = "false") @ColumnInfo(defaultValue = "false")

View File

@ -5,7 +5,7 @@ import androidx.room.Relation
data class FeedWithArticle( data class FeedWithArticle(
@Embedded @Embedded
val feed: Feed, var feed: Feed,
@Relation(parentColumn = "id", entityColumn = "feedId") @Relation(parentColumn = "id", entityColumn = "feedId")
val articles: List<Article> var articles: List<Article>
) )

View File

@ -5,7 +5,7 @@ import androidx.room.Relation
data class FeedWithGroup( data class FeedWithGroup(
@Embedded @Embedded
val feed: Feed, var feed: Feed,
@Relation(parentColumn = "groupId", entityColumn = "id") @Relation(parentColumn = "groupId", entityColumn = "id")
val group: Group var group: Group
) )

View File

@ -8,11 +8,11 @@ import androidx.room.PrimaryKey
@Entity(tableName = "group") @Entity(tableName = "group")
data class Group( data class Group(
@PrimaryKey @PrimaryKey
val id: String, var id: String,
@ColumnInfo @ColumnInfo
val name: String, var name: String,
@ColumnInfo(index = true) @ColumnInfo(index = true)
val accountId: Int, var accountId: Int,
) { ) {
@Ignore @Ignore
var important: Int? = 0 var important: Int? = 0

View File

@ -5,7 +5,7 @@ import androidx.room.Relation
data class GroupWithFeed( data class GroupWithFeed(
@Embedded @Embedded
val group: Group, var group: Group,
@Relation(parentColumn = "id", entityColumn = "groupId") @Relation(parentColumn = "id", entityColumn = "groupId")
val feeds: MutableList<Feed> var feeds: MutableList<Feed>
) )