Nested filter GraphQl solution in NestJs with @ResolveField

Viewed 17

I need to have filter on ResolveField items with this structure. This is my Schema First simple example:

type Product {
  price: Int
  categoryId: Int
  metadata: ProductMetadata
}

type ProductMetadata {
  field: String
  language: LangEnum
  productId: Int
  value: String;
}
input ProductFilters {
  price: Int
}

type Query {
  getProducts(
    filters: ProductFilters
  )
}

I want to query the structure like this in nestJs:

  getProducts(filters: {parentId: 0}, page: 1) {
    price
    categoryId
    metadata(filters: {title: "something"})
}

Any clue?

0 Answers
Related