Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): support filtering items by item class #61

Merged
merged 1 commit into from
Dec 3, 2023

Conversation

fallenoak
Copy link
Member

@fallenoak fallenoak commented Dec 3, 2023

This PR introduces the ability to filter items by one or more item classes.

For example:

query ExampleQuery {
  items(searchQuery: "torment", itemClassIds: [2, 3]) {
    results {
      id, name, itemClass { id, name }
    }
  }
}

returns:

{
  "data": {
    "items": {
      "results": [
        {
          "id": 25806,
          "name": "Nethekurse's Rod of Torment",
          "itemClass": {
            "id": 2,
            "name": "Weapon"
          }
        },
        {
          "id": 39291,
          "name": "Torment of the Banished",
          "itemClass": {
            "id": 2,
            "name": "Weapon"
          }
        }
      ]
    }
  }
}

The PR introduces the notion of filters separate from search: search permits entering an entity name for a partial string match (as it already does today), while filters support type-and-field-specific equality checks. The collection level entities in the root of the schema would support both searchQuery and filters (assuming the entity type is worth filtering).

Copy link
Member

@timkurvers timkurvers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, left some small comments.

@fallenoak fallenoak merged commit d456e2a into master Dec 3, 2023
2 checks passed
@fallenoak fallenoak deleted the feat-api-permit-filtering-items-by-class branch December 3, 2023 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants