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

[SERVICES-2370] Pairs query pagination, sorting and filtering #1347

Conversation

mad2sm0key
Copy link
Contributor

@mad2sm0key mad2sm0key commented May 16, 2024

Reasoning

  • provide a Relay-compliant query for fetching pairs data

Proposed Changes

  • create new filterablePairs query that follows the GraphQL "Connections" specification
  • extract pair filtering logic in a separate service

How to test

query {
  filterablePairs(
    filters:{
      minTradesCount:50
      minVolume:200
    }
    pagination:{
      first:10
    }
    sorting: {
      sortField:TRADES_COUNT
      sortOrder:DESC
    }
  ) {
    edges {
      cursor
      node {
        address
        firstToken {
          identifier
        }
        secondToken {
          identifier
        }
        tradesCount
        volumeUSD24h
      }
    }
    pageInfo {
      startCursor
      endCursor
      hasNextPage
      hasPreviousPage
    }
    pageData {
      count
      limit
      offset
    }
  }
}

@cfaur09
Copy link

cfaur09 commented May 16, 2024

Tests 🟢
Observation:

  • minTradesCount field need to be integer

@bogdan-rosianu bogdan-rosianu self-requested a review May 16, 2024 08:45
@mad2sm0key mad2sm0key changed the base branch from SERVICES-2331-pairs-query-extra-fields to development May 22, 2024 14:10
src/modules/pair/services/pair.metadata.builder.ts Outdated Show resolved Hide resolved
src/modules/pair/services/pair.metadata.builder.ts Outdated Show resolved Hide resolved
src/modules/router/router.resolver.ts Outdated Show resolved Hide resolved
@claudiulataretu claudiulataretu self-requested a review May 22, 2024 14:53
src/utils/page.data.ts Outdated Show resolved Hide resolved
- renamed 'filterablePairs' query to 'filteredPairs'
- remove unused imports
- made all methods in Pairs filtering service return a promise for unified usage
- moved PageData to common module
- update wording on deprecation reason and pagination exception message
@mad2sm0key mad2sm0key merged commit 86e044c into development May 27, 2024
0 of 2 checks 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.

None yet

4 participants