import jingrow
from jingrow.query_builder.functions import Count
from jingrow.query_builder.terms import QueryBuilder


def check(base_query: QueryBuilder) -> bool:
	PressRole = jingrow.qb.PageType("Jcloude Role")
	return (
		base_query.where(PressRole.allow_webhook_configuration == 1)
		.select(Count(PressRole.name).as_("document_count"))
		.run(as_dict=True)
		.pop()
		.get("document_count")
		> 0
	)
