Skip to content

Commit

Permalink
Merge pull request #1322 from safewlabs/add-social-to-api-fields
Browse files Browse the repository at this point in the history
Add a query for free comics
  • Loading branch information
saurabhbhatia authored Aug 22, 2024
2 parents 3094bfe + 6bd227d commit 76ba823
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/graphql/types/query_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ class QueryType < Types::BaseObject
field :purchases, [Types::PurchaseType], description: "List of Purchases for a user" do
argument :user_id, ID, required: true
end
field :free_comics, [Types::ProductType], description: "List of Free comics available to read at this time"

def purchases(user_id:)
Purchase.where(user_id:)
end

def free_comics
genre = Genre.find_by(slug: "free-comics")
genre.products.published
end

def
def(test_field)
"Hello World!"
Expand Down

0 comments on commit 76ba823

Please sign in to comment.