diff --git a/resolvers/zine/load.py b/resolvers/zine/load.py index 7b36c5b6..3f91b92d 100644 --- a/resolvers/zine/load.py +++ b/resolvers/zine/load.py @@ -60,6 +60,8 @@ def apply_filters(q, filters, user_id=None): if filters.get("layout"): q = q.filter(Shout.layout == filters.get("layout")) + if filters.get('excludeLayout'): + q = q.filter(Shout.layout != filters.get("excludeLayout")) if filters.get("author"): q = q.filter(Shout.authors.any(slug=filters.get("author"))) if filters.get("topic"): @@ -123,6 +125,7 @@ async def load_shouts_by(_, info, options): :param options: { filters: { layout: 'audio', + excludeLayout: 'article', visibility: "public", author: 'discours', topic: 'culture', @@ -143,7 +146,10 @@ async def load_shouts_by(_, info, options): joinedload(Shout.authors), joinedload(Shout.topics), ).where( - Shout.deletedAt.is_(None) + and_( + Shout.deletedAt.is_(None), + Shout.layout.is_not(None) + ) ) q = add_stat_columns(q) diff --git a/schema.graphql b/schema.graphql index 70dfa8e7..7aff3eaf 100644 --- a/schema.graphql +++ b/schema.graphql @@ -217,26 +217,13 @@ input AuthorsBy { stat: String } -input ShoutsFilterBy { - slug: String - title: String - body: String - topic: String - topics: [String] - author: String - authors: [String] - layout: String - visibility: String - days: Int - stat: String -} - input LoadShoutsFilters { title: String body: String topic: String author: String layout: String + excludeLayout: String visibility: String days: Int reacted: Boolean