Skip to content

Commit

Permalink
Add upvotes property to LoggedInUser
Browse files Browse the repository at this point in the history
Requires adding @TypeConverters annotation to AppDatabase.
  • Loading branch information
tiembo authored and florina-muntenescu committed Aug 15, 2018
1 parent 7d87934 commit 5d21c87
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class LoggedInUserDaoTest {
displayName = "Loggy L",
firstName = "Loggy",
lastName = "Loggerson",
portraitUrl = "www"
portraitUrl = "www",
upvotes = listOf("1", "2", "3")
)
}

Expand Down Expand Up @@ -86,7 +87,8 @@ class LoggedInUserDaoTest {
displayName = "Moggy M",
firstName = "Moggy",
lastName = "Moggerson",
portraitUrl = "www"
portraitUrl = "www",
upvotes = listOf("4", "5", "6")
)
loggedInUserDao.setLoggedInUser(newUser)

Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/io/plaidapp/core/data/AppDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package io.plaidapp.core.data
import android.arch.persistence.room.Database
import android.arch.persistence.room.Room
import android.arch.persistence.room.RoomDatabase
import android.arch.persistence.room.TypeConverters
import android.content.Context
import io.plaidapp.core.designernews.data.LoggedInUserDao
import io.plaidapp.core.designernews.data.users.model.LoggedInUser
Expand All @@ -27,6 +28,7 @@ import io.plaidapp.core.designernews.data.users.model.LoggedInUser
* The Room database for this app
*/
@Database(entities = [LoggedInUser::class], version = 1, exportSchema = false)
@TypeConverters(Converters::class)
abstract class AppDatabase : RoomDatabase() {
abstract fun loggedInUserDao(): LoggedInUserDao

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@ data class LoggedInUser(

@ColumnInfo(name = "potrait_url")
@SerializedName("portrait_url")
val portraitUrl: String? = null
val portraitUrl: String? = null,

@ColumnInfo(name = "upvotes")
@SerializedName("upvotes")
val upvotes: List<String>
)

0 comments on commit 5d21c87

Please sign in to comment.