def wrapper(query: SaQuery, criterion: Optional[criteria.BaseCriterion], negated: bool) -> SaQuery: assert criterion if not getattr(criterion, 'internal', False): raise errors.SearchError('투표는 공개적으로 확인할 수 없습니다. %r를 시도해보세요.' % 'special:liked') user_alias = sa.orm.aliased(model.User) score_alias = sa.orm.aliased(model.PostScore) expr = score_alias.score == score expr = expr & search_util.apply_str_criterion_to_column( user_alias.name, criterion) if negated: expr = ~expr ret = (query.join( score_alias, score_alias.post_id == model.Post.post_id).join( user_alias, user_alias.user_id == score_alias.user_id).filter(expr)) return ret
def wrapper( query: SaQuery, criterion: Optional[criteria.BaseCriterion], negated: bool, ) -> SaQuery: assert criterion if not getattr(criterion, "internal", False): raise errors.SearchError( "Votes cannot be seen publicly. Did you mean %r?" % "special:liked") user_alias = sa.orm.aliased(model.User) score_alias = sa.orm.aliased(model.PostScore) expr = score_alias.score == score expr = expr & search_util.apply_str_criterion_to_column( user_alias.name, criterion) if negated: expr = ~expr ret = (query.join( score_alias, score_alias.post_id == model.Post.post_id).join( user_alias, user_alias.user_id == score_alias.user_id).filter(expr)) return ret