cloudroam
2025-02-26 b653b90d4598ee2a65bceffa793bb75353b6d186
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.example.firstapp.database.repository
 
import com.example.firstapp.database.dao.ReminderDao
import androidx.annotation.WorkerThread
import com.example.firstapp.database.entity.Reminder
import kotlinx.coroutines.flow.Flow
 
class ReminderRepository(private val reminderDao: ReminderDao) {
 
    val allReminders: Flow<List<Reminder>> = reminderDao.getAllReminders()
 
    @WorkerThread
     fun insert(reminder: Reminder) {
        reminderDao.insert(reminder)
    }
 
    @WorkerThread
     fun delete(reminder: Reminder) {
        reminderDao.delete(reminder)
    }
 
    @WorkerThread
    fun getByType(type: String): List<Reminder> {
        return reminderDao.getByType(type)
    }