forked from agzam/vyatsu-schedule
refactor: database multi-period schedule storage
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package agzam.vyatsu.data.local
|
||||
|
||||
import agzam.vyatsu.domain.model.LessonType
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
import androidx.room.Index
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(
|
||||
tableName = "lessons",
|
||||
foreignKeys = [
|
||||
ForeignKey(
|
||||
entity = DayEntity::class,
|
||||
parentColumns = ["id"],
|
||||
childColumns = ["dayId"],
|
||||
onDelete = ForeignKey.CASCADE
|
||||
)
|
||||
],
|
||||
indices = [
|
||||
Index("dayId"),
|
||||
Index("date"),
|
||||
Index("subject"),
|
||||
Index("room")
|
||||
]
|
||||
)
|
||||
data class LessonEntity(
|
||||
@PrimaryKey(autoGenerate = true) val id: Long = 0,
|
||||
val dayId: Long,
|
||||
val date: Long,
|
||||
val slotIndex: Int,
|
||||
val start: Int,
|
||||
val end: Int,
|
||||
val lessonIndex: Int,
|
||||
val raw: String,
|
||||
val room: String?,
|
||||
val groupName: String?,
|
||||
val subgroup: String?,
|
||||
val subject: String?,
|
||||
val type: LessonType,
|
||||
val teacher: String?
|
||||
)
|
||||
Reference in New Issue
Block a user