Add type hints for paginators

This commit is contained in:
Karina Kwiatek 2023-01-28 21:17:25 +01:00
parent 32ba17ac72
commit ab1b034cfb
2 changed files with 3 additions and 0 deletions

View File

@ -5,6 +5,7 @@ module User::QuestionMethods
define_cursor_paginator :cursored_questions, :ordered_questions
# @return [ActiveRecord::Relation<Question>] List of questions sent by the user
def ordered_questions(author_is_anonymous: nil, direct: nil)
questions
.where({ author_is_anonymous:, direct: }.compact)

View File

@ -6,10 +6,12 @@ module User::RelationshipMethods
define_cursor_paginator :cursored_following_relationships, :ordered_following_relationships
define_cursor_paginator :cursored_follower_relationships, :ordered_follower_relationships
# @return [ActiveRecord::Relation<Relationships::Follow>] List of the user's following relationships
def ordered_following_relationships
active_follow_relationships.reverse_order.includes(target: [:profile])
end
# @return [ActiveRecord::Relation<Relationships::Follow>] List of the user's follower relationships
def ordered_follower_relationships
passive_follow_relationships.reverse_order.includes(source: [:profile])
end