BlindlyTeam/Blindly

View on GitHub
app/src/main/java/ch/epfl/sdp/blindly/database/localDB/UserEntity.kt

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
package ch.epfl.sdp.blindly.database.localDB

import androidx.room.Entity
import androidx.room.PrimaryKey
import ch.epfl.sdp.blindly.user.User

/**
 * Class representing a table in the local database.
 * It has all the data the User class have.
 *
 * @property uid
 * @property username
 * @property location
 * @property birthday
 * @property gender
 * @property sexualOrientations
 * @property showMe
 * @property passions
 * @property radius
 * @property matches
 * @property likes
 * @property recordingPath
 * @property ageRange
 */
@Entity
data class UserEntity(
    @PrimaryKey val uid: String,
    val username: String?,
    val location: List<Double>?,
    val birthday: String?,
    val gender: String?,
    val sexualOrientations: List<String>?,
    val showMe: String?,
    val passions: List<String>?,
    val radius: Int?,
    val matches: List<String>?,
    val dislikes: List<String>?,
    val likes: List<String>?,
    val recordingPath: String?,
    val ageRange: List<Int>?,
    val deleted: Boolean
) {

    constructor(uid: String, user: User) : this(
        uid,
        username = user.username,
        location = user.location,
        birthday = user.birthday,
        gender = user.gender,
        sexualOrientations = user.sexualOrientations,
        showMe = user.showMe,
        passions = user.passions,
        radius = user.radius,
        matches = user.matches,
        dislikes = user.dislikes,
        likes = user.likes,
        recordingPath = user.recordingPath,
        ageRange = user.ageRange,
        deleted = user.deleted
    )
}