diff --git a/app/src/main/java/com/example/shawarma/data/db/dao/OrderDao.kt b/app/src/main/java/com/example/shawarma/data/db/dao/OrderDao.kt index 4e1fa4e..772ef35 100644 --- a/app/src/main/java/com/example/shawarma/data/db/dao/OrderDao.kt +++ b/app/src/main/java/com/example/shawarma/data/db/dao/OrderDao.kt @@ -18,16 +18,10 @@ interface OrderDao { suspend fun update(order: OrderModel) @Delete suspend fun delete(order: OrderModel) - @Query("select * from orders") - fun getAll(): Flow> @Query("select * from orders where orders.id =:id") fun getById(id: Int): Flow - @Query("select * from orders where orders.user_id =:userId") - fun getByUserId(userId: Int): Flow> @Query("select * from orders where orders.user_id =:userId and orders.order_status = 'Неоплачено'") fun getUnpaidByUser(userId: Int) : Flow - @Query("select * from orders where orders.user_id =:userId and (orders.order_status = 'Готовится' or orders.order_status = 'Готово')") - fun getPaidByUser(userId: Int) : Flow> suspend fun insertAll(orders: List) { for (order in orders) { diff --git a/app/src/main/java/com/example/shawarma/data/db/dao/OrderProductDao.kt b/app/src/main/java/com/example/shawarma/data/db/dao/OrderProductDao.kt index 03b6609..0b436c3 100644 --- a/app/src/main/java/com/example/shawarma/data/db/dao/OrderProductDao.kt +++ b/app/src/main/java/com/example/shawarma/data/db/dao/OrderProductDao.kt @@ -13,8 +13,6 @@ interface OrderProductDao { suspend fun insert(order: OrderProductModel) @Update suspend fun update(order: OrderProductModel) - @Query("delete from order_product WHERE product_id = :productId") - suspend fun deleteByProductId(productId: Int); @Query("delete from order_product WHERE order_id = :orderId") suspend fun deleteByOrderId(orderId: Int); @Delete diff --git a/app/src/main/java/com/example/shawarma/data/db/dao/ProductDao.kt b/app/src/main/java/com/example/shawarma/data/db/dao/ProductDao.kt index 4815e15..7d0715c 100644 --- a/app/src/main/java/com/example/shawarma/data/db/dao/ProductDao.kt +++ b/app/src/main/java/com/example/shawarma/data/db/dao/ProductDao.kt @@ -27,15 +27,6 @@ interface ProductDao { @Delete() suspend fun delete(product: ProductModel) - @Query("select * from products where products.product_old_price is null") - fun getAll() : Flow> - - @Query("select * from products where products.product_old_price is not null") - fun getDiscounts() : Flow> - - @Query("select * from products") - fun getItems() : Flow> - @Query("select * from products where products.id = :id") fun getById(id: Int): Flow