mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-22 10:52:10 +00:00
Add: Option to filter author products
This commit is contained in:
parent
d3a9e33f82
commit
213aa4cb91
@ -106,7 +106,8 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
section: Section, filteredOutRepos: Set<String> = emptySet(),
|
section: Section, filteredOutRepos: Set<String> = emptySet(),
|
||||||
filteredOutCategories: Set<String> = emptySet(), order: Order,
|
filteredOutCategories: Set<String> = emptySet(), order: Order,
|
||||||
ascending: Boolean, numberOfItems: Int = 0,
|
ascending: Boolean, numberOfItems: Int = 0,
|
||||||
updateCategory: UpdateCategory = UpdateCategory.ALL
|
updateCategory: UpdateCategory = UpdateCategory.ALL,
|
||||||
|
author: String = "",
|
||||||
): List<Product> = queryObject(
|
): List<Product> = queryObject(
|
||||||
buildProductQuery(
|
buildProductQuery(
|
||||||
installed = installed,
|
installed = installed,
|
||||||
@ -118,7 +119,8 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
order = order,
|
order = order,
|
||||||
ascending = ascending,
|
ascending = ascending,
|
||||||
numberOfItems = numberOfItems,
|
numberOfItems = numberOfItems,
|
||||||
updateCategory = updateCategory
|
updateCategory = updateCategory,
|
||||||
|
author = author,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -136,7 +138,7 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
order = request.order,
|
order = request.order,
|
||||||
ascending = request.ascending,
|
ascending = request.ascending,
|
||||||
numberOfItems = request.numberOfItems,
|
numberOfItems = request.numberOfItems,
|
||||||
updateCategory = request.updateCategory
|
updateCategory = request.updateCategory,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -150,7 +152,8 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
order: Order,
|
order: Order,
|
||||||
ascending: Boolean = false,
|
ascending: Boolean = false,
|
||||||
numberOfItems: Int = 0,
|
numberOfItems: Int = 0,
|
||||||
updateCategory: UpdateCategory = UpdateCategory.ALL
|
updateCategory: UpdateCategory = UpdateCategory.ALL,
|
||||||
|
author: String = "",
|
||||||
): SupportSQLiteQuery {
|
): SupportSQLiteQuery {
|
||||||
val builder = QueryBuilder()
|
val builder = QueryBuilder()
|
||||||
|
|
||||||
@ -213,6 +216,12 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
// Filter only active repositories
|
// Filter only active repositories
|
||||||
builder += """WHERE $TABLE_REPOSITORY.$ROW_ENABLED != 0"""
|
builder += """WHERE $TABLE_REPOSITORY.$ROW_ENABLED != 0"""
|
||||||
|
|
||||||
|
// Filter based on the developer
|
||||||
|
if (author.isNotEmpty()) {
|
||||||
|
builder += "AND $TABLE_PRODUCT.$ROW_AUTHOR = ?"
|
||||||
|
builder %= author
|
||||||
|
}
|
||||||
|
|
||||||
// Filter out repositories
|
// Filter out repositories
|
||||||
if (filteredOutRepos.isNotEmpty()) {
|
if (filteredOutRepos.isNotEmpty()) {
|
||||||
builder += "AND $TABLE_PRODUCT.$ROW_REPOSITORY_ID NOT IN(${filteredOutRepos.joinToString { "'$it'" }})"
|
builder += "AND $TABLE_PRODUCT.$ROW_REPOSITORY_ID NOT IN(${filteredOutRepos.joinToString { "'$it'" }})"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user