mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-24 03:42:15 +00:00
Add: Update category to query functions
This commit is contained in:
parent
8a9060e4d6
commit
371165010a
@ -8,6 +8,7 @@ import com.looker.droidify.*
|
|||||||
import com.looker.droidify.database.entity.*
|
import com.looker.droidify.database.entity.*
|
||||||
import com.looker.droidify.entity.Order
|
import com.looker.droidify.entity.Order
|
||||||
import com.looker.droidify.entity.Section
|
import com.looker.droidify.entity.Section
|
||||||
|
import com.looker.droidify.entity.UpdateCategory
|
||||||
import com.looker.droidify.ui.fragments.Request
|
import com.looker.droidify.ui.fragments.Request
|
||||||
|
|
||||||
interface BaseDao<T> {
|
interface BaseDao<T> {
|
||||||
@ -80,20 +81,32 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
fun queryObject(query: SupportSQLiteQuery): List<Product>
|
fun queryObject(query: SupportSQLiteQuery): List<Product>
|
||||||
|
|
||||||
fun queryObject(request: Request): List<Product> = queryObject(
|
fun queryObject(request: Request): List<Product> = queryObject(
|
||||||
|
buildProductQuery(
|
||||||
request.installed,
|
request.installed,
|
||||||
request.updates,
|
request.updates,
|
||||||
request.searchQuery,
|
request.searchQuery,
|
||||||
request.section,
|
request.section,
|
||||||
request.order,
|
request.order,
|
||||||
request.numberOfItems
|
request.numberOfItems,
|
||||||
|
request.updateCategory
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@Transaction
|
@Transaction
|
||||||
fun queryObject(
|
fun queryObject(
|
||||||
installed: Boolean, updates: Boolean, searchQuery: String,
|
installed: Boolean, updates: Boolean, searchQuery: String,
|
||||||
section: Section, order: Order, numberOfItems: Int = 0
|
section: Section, order: Order, numberOfItems: Int = 0,
|
||||||
|
updateCategory: UpdateCategory = UpdateCategory.ALL
|
||||||
): List<Product> = queryObject(
|
): List<Product> = queryObject(
|
||||||
buildProductQuery(installed, updates, searchQuery, section, order, numberOfItems)
|
buildProductQuery(
|
||||||
|
installed,
|
||||||
|
updates,
|
||||||
|
searchQuery,
|
||||||
|
section,
|
||||||
|
order,
|
||||||
|
numberOfItems,
|
||||||
|
updateCategory
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@RawQuery(observedEntities = [Product::class])
|
@RawQuery(observedEntities = [Product::class])
|
||||||
@ -106,14 +119,19 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
request.searchQuery,
|
request.searchQuery,
|
||||||
request.section,
|
request.section,
|
||||||
request.order,
|
request.order,
|
||||||
request.numberOfItems
|
request.numberOfItems,
|
||||||
|
request.updateCategory
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO add an UpdateCategory argument
|
|
||||||
fun buildProductQuery(
|
fun buildProductQuery(
|
||||||
installed: Boolean, updates: Boolean, searchQuery: String,
|
installed: Boolean,
|
||||||
section: Section, order: Order, numberOfItems: Int = 0
|
updates: Boolean,
|
||||||
|
searchQuery: String,
|
||||||
|
section: Section,
|
||||||
|
order: Order,
|
||||||
|
numberOfItems: Int = 0,
|
||||||
|
updateCategory: UpdateCategory = UpdateCategory.ALL
|
||||||
): SupportSQLiteQuery {
|
): SupportSQLiteQuery {
|
||||||
val builder = QueryBuilder()
|
val builder = QueryBuilder()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user