def favorite_post_count(self) -> int: from szurubooru.db import session return (session.query(sa.sql.expression.func.sum(1)).filter( PostFavorite.user_id == self.user_id).one()[0] or 0)
def disliked_post_count(self) -> int: from szurubooru.db import session return (session.query(sa.sql.expression.func.sum(1)).filter( PostScore.user_id == self.user_id).filter( PostScore.score == -1).one()[0] or 0)
def comment_count(self) -> int: from szurubooru.db import session return (session.query(sa.sql.expression.func.sum(1)).filter( Comment.user_id == self.user_id).one()[0] or 0)