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: make graphql queries compatible with new Squid #380

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

juanmahidalgo
Copy link
Contributor

No description provided.

@@ -33,7 +33,11 @@ export function createNFTsHandler(
const isLand = params.getBoolean('isLand')
const isOnRent = params.getBoolean('isOnRent')
const isWearableHead = params.getBoolean('isWearableHead')
? params.getString('isWearableHead') === 'true'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is needed to know if it needs to be applied in the query as parameter or not
https://github.com/decentraland/nft-server/pull/380/files#diff-d1debe4191e7ee45f023c53cecc0a2d6c05c4dba8f24d44c3a2c69261102a0bcR310

$isWearableHead: Boolean
$isWearableAccessory: Boolean) {

const variablesBasedOnFilters = Object.entries(filters)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the variables in the GraphQL query must be used somewhere in the query, so this new logic is to put them in dynamically just if they are being used after.

Copy link
Contributor

@LautaroPetaccio LautaroPetaccio left a comment

Choose a reason for hiding this comment

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

Looks great! I've left a simple comment with a refactor.

Comment on lines +108 to +110
const variablesBasedOnFilters = Object.entries(filters)
.filter(([key, value]) => value !== undefined && key in PRICES_FILTERS_DICT)
.map(([key]) => (PRICES_FILTERS_DICT[key] ? PRICES_FILTERS_DICT[key] : ''))
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about abstracting this mechanism so we can use it in all of these queries?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, great idea, let me prepare that in a following up PR so we can review that exclusively.

@juanmahidalgo juanmahidalgo merged commit 470fe94 into master Aug 8, 2024
1 check passed
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