def has_auth_webhooks(user_id):
"""??????????Webhooks"""
# create webhooks
created_webhooks = WebHook.query.filter_by(
user_id=user_id, deleted=False).all()
# collaborator webhooks
collaborated_webhooks = \
WebHook.query.join(Collaborator,
Collaborator.webhook_id == WebHook.id) \
.filter(Collaborator.user_id == user_id) \
.filter(WebHook.deleted == false()).all()
webhooks = created_webhooks + collaborated_webhooks
# ?????
webhooks = list(sorted(set(webhooks), key=lambda x: x.id, reverse=True))
return webhooks
评论列表
文章目录