Add scene/image/gallery popover count buttons for performer/studio/tag cards (#1293)

* Add counts to graphql schema
* Add count resolvers and query refactor
* Add count popover buttons
This commit is contained in:
WithoutPants
2021-04-15 10:46:31 +10:00
committed by GitHub
parent e6aaa196f3
commit ea54a67798
27 changed files with 536 additions and 73 deletions

View File

@@ -234,7 +234,7 @@ func (r *repository) querySimple(query string, args []interface{}, out interface
return nil
}
func (r *repository) executeFindQuery(body string, args []interface{}, sortAndPagination string, whereClauses []string, havingClauses []string) ([]int, int, error) {
func (r *repository) buildQueryBody(body string, whereClauses []string, havingClauses []string) string {
if len(whereClauses) > 0 {
body = body + " WHERE " + strings.Join(whereClauses, " AND ") // TODO handle AND or OR
}
@@ -243,6 +243,12 @@ func (r *repository) executeFindQuery(body string, args []interface{}, sortAndPa
body = body + " HAVING " + strings.Join(havingClauses, " AND ") // TODO handle AND or OR
}
return body
}
func (r *repository) executeFindQuery(body string, args []interface{}, sortAndPagination string, whereClauses []string, havingClauses []string) ([]int, int, error) {
body = r.buildQueryBody(body, whereClauses, havingClauses)
countQuery := r.buildCountQuery(body)
idsQuery := body + sortAndPagination