Merge pull request #78 from Discours/feature/shouts_without_article_layout
excludeLayout filter for loadShouts
This commit is contained in:
commit
6d307f575c
|
@ -60,6 +60,8 @@ def apply_filters(q, filters, user_id=None):
|
||||||
|
|
||||||
if filters.get("layout"):
|
if filters.get("layout"):
|
||||||
q = q.filter(Shout.layout == 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"):
|
if filters.get("author"):
|
||||||
q = q.filter(Shout.authors.any(slug=filters.get("author")))
|
q = q.filter(Shout.authors.any(slug=filters.get("author")))
|
||||||
if filters.get("topic"):
|
if filters.get("topic"):
|
||||||
|
@ -123,6 +125,7 @@ async def load_shouts_by(_, info, options):
|
||||||
:param options: {
|
:param options: {
|
||||||
filters: {
|
filters: {
|
||||||
layout: 'audio',
|
layout: 'audio',
|
||||||
|
excludeLayout: 'article',
|
||||||
visibility: "public",
|
visibility: "public",
|
||||||
author: 'discours',
|
author: 'discours',
|
||||||
topic: 'culture',
|
topic: 'culture',
|
||||||
|
@ -143,7 +146,10 @@ async def load_shouts_by(_, info, options):
|
||||||
joinedload(Shout.authors),
|
joinedload(Shout.authors),
|
||||||
joinedload(Shout.topics),
|
joinedload(Shout.topics),
|
||||||
).where(
|
).where(
|
||||||
Shout.deletedAt.is_(None)
|
and_(
|
||||||
|
Shout.deletedAt.is_(None),
|
||||||
|
Shout.layout.is_not(None)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
q = add_stat_columns(q)
|
q = add_stat_columns(q)
|
||||||
|
|
|
@ -217,26 +217,13 @@ input AuthorsBy {
|
||||||
stat: String
|
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 {
|
input LoadShoutsFilters {
|
||||||
title: String
|
title: String
|
||||||
body: String
|
body: String
|
||||||
topic: String
|
topic: String
|
||||||
author: String
|
author: String
|
||||||
layout: String
|
layout: String
|
||||||
|
excludeLayout: String
|
||||||
visibility: String
|
visibility: String
|
||||||
days: Int
|
days: Int
|
||||||
reacted: Boolean
|
reacted: Boolean
|
||||||
|
|
Loading…
Reference in New Issue
Block a user