feat(backup): wire ConversationCacheDatabase and DAO into DatabaseModule

This commit is contained in:
null 2026-06-30 20:42:46 -05:00
parent ab59e7e5c9
commit f94fccfc61
1 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import androidx.datastore.preferences.preferencesDataStoreFile
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
import androidx.room.Room
import app.closer.data.local.AppDatabase
import app.closer.data.local.ConversationCacheDatabase
import com.google.firebase.firestore.FirebaseFirestore
import dagger.Module
import dagger.Provides
@ -47,6 +48,17 @@ object DatabaseModule {
@Singleton
fun provideDatePlanDao(db: AppDatabase) = db.datePlanDao()
@Provides
@Singleton
fun provideConversationCacheDatabase(@ApplicationContext context: Context): ConversationCacheDatabase =
Room.databaseBuilder(context, ConversationCacheDatabase::class.java, "conversation_cache.db")
.fallbackToDestructiveMigration() // cache is rebuildable from the backup; never the source of truth
.build()
@Provides
@Singleton
fun provideConversationCacheDao(db: ConversationCacheDatabase) = db.conversationCacheDao()
@Provides
@Singleton
fun provideDataStore(@ApplicationContext context: Context): DataStore<Preferences> =