Skip to content

Commit

Permalink
CV2-5373: update relay files
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Nov 19, 2024
1 parent 33bd366 commit cfc7370
Show file tree
Hide file tree
Showing 3 changed files with 516 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/graph/types/team_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def articles_count(**args)
count
end

field :relevent_articles, ::ArticleUnion.connection_type, null: true do
field :relevant_articles, ::ArticleUnion.connection_type, null: true do
argument :article_type, GraphQL::Types::String, required: true, camelize: false

# Sort and pagination
Expand All @@ -392,7 +392,7 @@ def articles_count(**args)
argument :trashed, GraphQL::Types::Boolean, required: false, camelize: false, default_value: false
end

def relevent_articles(**args)
def relevant_articles(**args)
sort = args[:sort].to_s
order = [:title, :language, :updated_at, :id].include?(sort.downcase.to_sym) ? sort.downcase.to_sym : :title
order_type = args[:sort_type].to_s.downcase.to_sym == :desc ? :desc : :asc
Expand All @@ -405,7 +405,7 @@ def relevent_articles(**args)
articles.offset(args[:offset].to_i).order(order => order_type)
end

field :relevent_articles_count, GraphQL::Types::Int, null: true do
field :relevant_articles_count, GraphQL::Types::Int, null: true do
argument :article_type, GraphQL::Types::String, required: false, camelize: false

# Filters
Expand All @@ -423,7 +423,7 @@ def relevent_articles(**args)
argument :trashed, GraphQL::Types::Boolean, required: false, camelize: false, default_value: false
end

def relevent_articles_count(**args)
def relevant_articles_count(**args)
count = nil
if args[:article_type] == 'explainer'
count = object.filtered_explainers(args).count
Expand Down
38 changes: 38 additions & 0 deletions lib/relay.idl
Original file line number Diff line number Diff line change
Expand Up @@ -13320,6 +13320,44 @@ type Team implements Node {
public_team: PublicTeam
public_team_id: String
pusher_channel: String
relevant_articles(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
article_type: String!

"""
Returns the elements in the list that come before the specified cursor.
"""
before: String

"""
Returns the first _n_ elements from the list.
"""
first: Int
imported: Boolean
language: [String]

"""
Returns the last _n_ elements from the list.
"""
last: Int
offset: Int = 0
publisher_ids: [Int]
rating: [String]
report_status: [String]
sort: String = "title"
sort_type: String = "ASC"
standalone: Boolean
tags: [String]
target_id: Int
text: String
trashed: Boolean = false
updated_at: String
user_ids: [Int]
): ArticleUnionConnection
relevant_articles_count(article_type: String, imported: Boolean, language: [String], publisher_ids: [Int], rating: [String], report_status: [String], standalone: Boolean, tags: [String], target_id: Int, text: String, trashed: Boolean = false, updated_at: String, user_ids: [Int]): Int
rules_json_schema: String
rules_search_fields_json_schema: JsonStringType
saved_searches(
Expand Down
Loading

0 comments on commit cfc7370

Please sign in to comment.