diff --git a/api/graphql.go b/api/graphql.go index fa40ed7..a61d73a 100644 --- a/api/graphql.go +++ b/api/graphql.go @@ -642,6 +642,9 @@ func NewSchema(config Config) (graphql.Schema, error) { return nil, err } fmt.Println("Interest:", user_id, list) + if len(list) == 0 { + return map[string]interface{}{"list": []Image{}, "total": 0}, nil + } query = query.Where(goqu.Ex{"web_images.id": goqu.Op{"in": list}}).Select("web_images.id", goqu.L( fmt.Sprintf("ROW_NUMBER() OVER(ORDER BY FIELD(%s, %s))", "web_images.id", regexp.MustCompile(`[\[\]]`).ReplaceAllString(strings.Join(strings.Fields(fmt.Sprint(list)), ", "), "")), ).As("row_num"))