Skip to content

Commit

Permalink
can't use an input type for relay compat
Browse files Browse the repository at this point in the history
  • Loading branch information
barneyb committed Sep 15, 2024
1 parent f613af4 commit 42c46d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.brennaswitzer.cookbook.domain.Recipe;
import com.brennaswitzer.cookbook.graphql.model.OffsetConnection;
import com.brennaswitzer.cookbook.graphql.model.OffsetConnectionCursor;
import com.brennaswitzer.cookbook.graphql.model.SuggestionRequest;
import com.brennaswitzer.cookbook.payload.RecognizedItem;
import com.brennaswitzer.cookbook.repositories.SearchResponse;
import com.brennaswitzer.cookbook.repositories.impl.LibrarySearchScope;
Expand Down Expand Up @@ -49,10 +48,10 @@ public RecognizedItem recognizeItem(String raw, Integer cursor) {
false);
}

public Connection<Recipe> suggestRecipesToCook(SuggestionRequest req) {
if (req == null) req = new SuggestionRequest();
SearchResponse<Recipe> rs = recipeService.suggestRecipes(getOffset(req.getAfter()),
req.getFirst());
public Connection<Recipe> suggestRecipesToCook(
int first,
OffsetConnectionCursor after) {
SearchResponse<Recipe> rs = recipeService.suggestRecipes(getOffset(after), first);
return new OffsetConnection<>(rs);
}

Expand Down

This file was deleted.

10 changes: 4 additions & 6 deletions src/main/resources/graphqls/library.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ type LibraryQuery {
after: Cursor = null
): RecipeConnection!

suggestRecipesToCook(req: SuggestionRequest): RecipeConnection!
suggestRecipesToCook(
first: NonNegativeInt! = 5
after: Cursor = null
): RecipeConnection!

getRecipeById(id: ID!): Recipe

Expand All @@ -50,11 +53,6 @@ type LibraryQuery {
): RecognizedItem
}

input SuggestionRequest {
first: NonNegativeInt! = 5
after: Cursor = null
}

"""The result of recognizing a raw ingredient ref item.
"""
type RecognizedItem {
Expand Down

0 comments on commit 42c46d9

Please sign in to comment.