Use itemSearchV2 in wardrobe too

That's the last itemSearch call site! I'll probably keep it up for other clients for a while though, esp since it doesn't depend on any additional loaders or anything, it's pretty small overall

Updated the comments to reflect this, and also remembered to make them real docstrings lol!
This commit is contained in:
Emi Matchu 2021-06-21 10:37:54 -07:00
parent fd13b1aa46
commit 3537ef9a6f
2 changed files with 30 additions and 20 deletions

View file

@ -295,20 +295,18 @@ function useSearchResults(query, outfitState) {
$colorId: ID! $colorId: ID!
$offset: Int! $offset: Int!
) { ) {
itemSearch( itemSearch: itemSearchV2(
query: $query query: $query
fitsPet: $fitsPet fitsPet: $fitsPet
itemKind: $itemKind itemKind: $itemKind
currentUserOwnsOrWants: $currentUserOwnsOrWants currentUserOwnsOrWants: $currentUserOwnsOrWants
zoneIds: $zoneIds zoneIds: $zoneIds
offset: $offset
limit: 50
) { ) {
query query
zones { zones {
id id
} }
items { items(offset: $offset, limit: 50) {
# TODO: De-dupe this from useOutfitState? # TODO: De-dupe this from useOutfitState?
id id
name name

View file

@ -194,16 +194,20 @@ const typeDefs = gql`
item(id: ID!): Item item(id: ID!): Item
items(ids: [ID!]!): [Item!]! items(ids: [ID!]!): [Item!]!
# Find items by name. Exact match, except for some tweaks, like """
# case-insensitivity and trimming extra whitespace. Null if not found. Find items by name. Exact match, except for some tweaks, like
# case-insensitivity and trimming extra whitespace. Null if not found.
# NOTE: These aren't used in DTI at time of writing; they're a courtesy API
# for the /r/Neopets Discord bot's outfit preview command! NOTE: These aren't used in DTI at time of writing; they're a courtesy API
for the /r/Neopets Discord bot's outfit preview command!
"""
itemByName(name: String!): Item itemByName(name: String!): Item
itemsByName(names: [String!]!): [Item]! itemsByName(names: [String!]!): [Item]!
# Search for items with fuzzy matching. """
# Deprecated: Prefer itemSearchV2 instead! (A lot is not yet ported tho!) Search for items with fuzzy matching.
Deprecated: Prefer itemSearchV2 instead!
"""
itemSearch( itemSearch(
query: String! query: String!
fitsPet: FitsPetSearchFilter fitsPet: FitsPetSearchFilter
@ -214,7 +218,9 @@ const typeDefs = gql`
limit: Int limit: Int
): ItemSearchResult! ): ItemSearchResult!
# Search for items with fuzzy matching. """
Search for items with fuzzy matching.
"""
itemSearchV2( itemSearchV2(
query: String! query: String!
fitsPet: FitsPetSearchFilter fitsPet: FitsPetSearchFilter
@ -223,8 +229,10 @@ const typeDefs = gql`
zoneIds: [ID!] zoneIds: [ID!]
): ItemSearchResultV2! ): ItemSearchResultV2!
# Deprecated: an alias for itemSearch, but with speciesId and colorId """
# required, serving the same purpose as fitsPet in itemSearch. Deprecated: an alias for itemSearch, but with speciesId and colorId
required, serving the same purpose as fitsPet in itemSearch.
"""
itemSearchToFit( itemSearchToFit(
query: String! query: String!
itemKind: ItemKindSearchFilter itemKind: ItemKindSearchFilter
@ -236,14 +244,18 @@ const typeDefs = gql`
limit: Int limit: Int
): ItemSearchResult! ): ItemSearchResult!
# Get the 20 items most recently added to our database. """
Get the 20 items most recently added to our database.
"""
newestItems: [Item!]! @cacheControl(maxAge: ${oneHour}, staleWhileRevalidate: ${oneDay}) newestItems: [Item!]! @cacheControl(maxAge: ${oneHour}, staleWhileRevalidate: ${oneDay})
# Get items that need models for the given color. """
# Get items that need models for the given color.
# NOTE: Most color IDs won't be accepted here. Either pass the ID of a
# major special color like Baby (#6), or leave it blank for standard NOTE: Most color IDs won't be accepted here. Either pass the ID of a
# bodies like Blue, Green, Red, etc. major special color like Baby (#6), or leave it blank for standard
bodies like Blue, Green, Red, etc.
"""
itemsThatNeedModels(colorId: ID): [Item!]! @cacheControl(maxAge: 1, staleWhileRevalidate: ${oneHour}) itemsThatNeedModels(colorId: ID): [Item!]! @cacheControl(maxAge: 1, staleWhileRevalidate: ${oneHour})
} }