refactor: database multi-period schedule storage

This commit is contained in:
2026-09-03 19:41:26 +03:00
parent 47ca253d6a
commit ebe1c3c4a3
20 changed files with 777 additions and 190 deletions
@@ -1,7 +1,6 @@
package agzam.vyatsu.di
import agzam.vyatsu.data.local.AppDatabase
import agzam.vyatsu.data.local.ScheduleCodec
import agzam.vyatsu.data.remote.GroupsParser
import agzam.vyatsu.data.remote.VyatsuHttpClient
import agzam.vyatsu.data.repository.GroupRepositoryImpl
@@ -12,18 +11,15 @@ import agzam.vyatsu.domain.repository.PreferencesRepository
import agzam.vyatsu.domain.repository.ScheduleRepository
import android.content.Context
import androidx.room.Room
import com.squareup.moshi.Moshi
class AppContainer(context: Context) {
private val moshi: Moshi = Moshi.Builder().build()
private val database: AppDatabase = Room.databaseBuilder(
context.applicationContext,
AppDatabase::class.java,
"vyatsu_schedule.db"
).build()
private val codec: ScheduleCodec = ScheduleCodec(moshi)
)
.fallbackToDestructiveMigration(dropAllTables = true)
.build()
val groupRepository: GroupRepository by lazy {
GroupRepositoryImpl(
@@ -35,7 +31,6 @@ class AppContainer(context: Context) {
ScheduleRepositoryImpl(
scheduleDao = database.scheduleDao(),
groupDao = database.groupDao(),
codec = codec
)
}