package chats.data.local.dao import androidx.room.* import chats.data.local.database.UserProfileEntity import kotlinx.coroutines.flow.Flow /** * DAO для операций с профилями пользователей в Room Database */ @Dao interface UserProfileDao { @Query("SELECT * FROM user_profile WHERE userId = :userId LIMIT 1") suspend fun getUserById(userId: String): UserProfileEntity? @Query("SELECT * FROM user_profile WHERE userId = :userId") fun getUserByIdFlow(userId: String): Flow @Query("SELECT * FROM user_profile") fun getAllUsers(): Flow> @Insert(onConflict = OnConflictStrategy.REPLACE) suspend fun insertUser(user: UserProfileEntity) @Insert(onConflict = OnConflictStrategy.REPLACE) suspend fun insertUsers(users: List) @Update suspend fun updateUser(user: UserProfileEntity) @Delete suspend fun deleteUser(user: UserProfileEntity) @Query("DELETE FROM user_profile WHERE userId = :userId") suspend fun deleteUserById(userId: String) }