4-ую начал, пользователя связал с карточками
This commit is contained in:
parent
f1c0642cf7
commit
21dace91cd
@ -29,4 +29,7 @@ interface UserDao {
|
|||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
suspend fun delete(user: User)
|
suspend fun delete(user: User)
|
||||||
|
|
||||||
|
@Query("select count(*) from cards where user_id = :userId")
|
||||||
|
fun getAdsCount(userId: Int): Int?
|
||||||
}
|
}
|
@ -40,6 +40,7 @@ fun UserSettings(navController: NavHostController) {
|
|||||||
|
|
||||||
val login = remember { mutableStateOf("") }
|
val login = remember { mutableStateOf("") }
|
||||||
val password = remember { mutableStateOf("") }
|
val password = remember { mutableStateOf("") }
|
||||||
|
val adsCount = remember { mutableStateOf(0) }
|
||||||
val userId = 1
|
val userId = 1
|
||||||
|
|
||||||
userId?.let {
|
userId?.let {
|
||||||
@ -48,6 +49,7 @@ fun UserSettings(navController: NavHostController) {
|
|||||||
val user = MobileAppDataBase.getInstance(context).userDao().getById(userId!!)
|
val user = MobileAppDataBase.getInstance(context).userDao().getById(userId!!)
|
||||||
login.value = user!!.login
|
login.value = user!!.login
|
||||||
password.value = user!!.password
|
password.value = user!!.password
|
||||||
|
adsCount.value = MobileAppDataBase.getInstance(context).userDao().getAdsCount(userId)?: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,6 +69,7 @@ fun UserSettings(navController: NavHostController) {
|
|||||||
)
|
)
|
||||||
LoginField(text = "Логин пользователя: ${login.value}")
|
LoginField(text = "Логин пользователя: ${login.value}")
|
||||||
LoginField(text = "Пароль пользователя: ${password.value}")
|
LoginField(text = "Пароль пользователя: ${password.value}")
|
||||||
|
LoginField(text = "Количество объявлений пользователя: ${adsCount.value}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column(modifier = Modifier
|
Column(modifier = Modifier
|
||||||
|
Loading…
Reference in New Issue
Block a user