Так, проверяем, норм ли создать 4 ветка и коммит в нее (+ репозиторий)
This commit is contained in:
parent
eb79619b6c
commit
e3bc68c14c
@ -0,0 +1,27 @@
|
|||||||
|
package com.example.labwork.repository
|
||||||
|
|
||||||
|
import com.example.labwork.database.DAO.BicycleDao
|
||||||
|
import com.example.labwork.models.Bicycle
|
||||||
|
|
||||||
|
class BicycleRepository(private val bicycleDao: BicycleDao) {
|
||||||
|
suspend fun insertBicycle(bicycle: Bicycle) {
|
||||||
|
bicycleDao.insertBicycle(bicycle)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun updateBicycle(bicycle: Bicycle) {
|
||||||
|
bicycleDao.updateBicycle(bicycle)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun deleteBicycle(bicycle: Bicycle) {
|
||||||
|
bicycleDao.deleteBicycle(bicycle)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getAllBicycles(): List<Bicycle> {
|
||||||
|
return bicycleDao.getAllBicycles()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getBicyclesByUserId(userId: Int): List<Bicycle> {
|
||||||
|
return bicycleDao.getBicyclesByUserId(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.example.labwork.repository
|
||||||
|
|
||||||
|
import com.example.labwork.database.DAO.UserDao
|
||||||
|
import com.example.labwork.models.User
|
||||||
|
|
||||||
|
class UserRepository(private val userDao: UserDao) {
|
||||||
|
|
||||||
|
suspend fun insertUser(user: User) {
|
||||||
|
userDao.insertUser(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun updateUser(user: User) {
|
||||||
|
userDao.updateUser(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun deleteUser(user: User) {
|
||||||
|
userDao.deleteUser(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getUserById(userId: Int): User {
|
||||||
|
return userDao.getUserById(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getUserByEmail(email: String): User {
|
||||||
|
return userDao.getUserByEmail(email)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getUserByEmailAndPassword(email: String, password: String): User? {
|
||||||
|
return userDao.getUserByEmailAndPassword(email, password)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user