From 4bc562c7f20423a277e7e4c62ef44f6fcf017332 Mon Sep 17 00:00:00 2001 From: Danya_Mochalov Date: Thu, 28 Dec 2023 05:53:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20DAO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/shawarma/data/db/dao/OrderDao.kt | 6 ------ .../com/example/shawarma/data/db/dao/OrderProductDao.kt | 2 -- .../java/com/example/shawarma/data/db/dao/ProductDao.kt | 9 --------- 3 files changed, 17 deletions(-) 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