UserDao не нужон
This commit is contained in:
parent
32991b2e14
commit
28bd9e35c8
@ -10,7 +10,6 @@ import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import com.example.shawarma.data.db.dao.OrderDao
|
||||
import com.example.shawarma.data.db.dao.OrderProductDao
|
||||
import com.example.shawarma.data.db.dao.ProductDao
|
||||
import com.example.shawarma.data.db.dao.UserDao
|
||||
import com.example.shawarma.data.db.models.OrderModel
|
||||
import com.example.shawarma.data.db.models.OrderProductModel
|
||||
import com.example.shawarma.data.db.models.ProductModel
|
||||
@ -33,7 +32,6 @@ import kotlinx.coroutines.launch
|
||||
)
|
||||
@TypeConverters(Converter::class)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
abstract fun userDao() : UserDao
|
||||
abstract fun productDao() : ProductDao
|
||||
abstract fun orderDao() : OrderDao
|
||||
abstract fun orderProductDao() : OrderProductDao
|
||||
|
@ -1,26 +0,0 @@
|
||||
package com.example.shawarma.data.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Delete
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy.Companion.ABORT
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import com.example.shawarma.data.db.models.UserModel
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface UserDao {
|
||||
@Insert(onConflict = ABORT)
|
||||
suspend fun insert(user: UserModel)
|
||||
@Update
|
||||
suspend fun update(user: UserModel)
|
||||
@Delete
|
||||
suspend fun delete(user: UserModel)
|
||||
@Query("select * from users order by user_login collate nocase asc")
|
||||
fun getAll(): Flow<List<UserModel>>
|
||||
@Query("select * from users where id = :id")
|
||||
fun getById(id: Int): Flow<UserModel>
|
||||
@Query("select * from users where user_login = :login and user_password = :password limit 1")
|
||||
fun login(login: String, password: String) : Flow<UserModel?>
|
||||
}
|
Loading…
Reference in New Issue
Block a user