fix filter service handler

features/feature-catalog-redis
Ernest Litvinenko 2024-03-21 20:57:39 +03:00
parent 115fb5d527
commit d638e1bb6f
1 changed files with 2 additions and 1 deletions

View File

@ -71,7 +71,7 @@ func FilterCatalogItems(filters map[string][]string, limit int, offset int) []mo
// Generate stmt
propertiesSubStmt := "properties->>'$.%s' = '%s'"
stmt := "select * from api_catalog"
stmt := "select * from api_catalog where %s"
sample := "(%s)"
@ -103,5 +103,6 @@ func FilterCatalogItems(filters map[string][]string, limit int, offset int) []mo
}
stmt = fmt.Sprintf(stmt, strings.Join(samples, " and "))
print("\n" + stmt + "\n")
return retrieveCatalogItems(stmt + fmt.Sprintf("and is_active = 1 and available_quantity > 0 limit %d offset %d", limit, offset))
}