Sort query in apollo graphql

0

I have the following problem: I want to Order a data set that I build with the following query:

SubCategoriaPRODUCTESQuery = gql'
    query (
        $apiUrl: String,
        $pageId: String,
        $categoryId: String,
        $subcategoryId: String,
        $sizeId: String,
        $brandId: String,
        $colorId: String
    ) {
        subcategoriaPRODUCTES(
            apiUrl: $apiUrl,
            pageId: $pageId,
            categoryId: $categoryId,
            subcategoryId: $subcategoryId,
            colorId: $colorId,
            brandId: $brandId,
            sizeId: $sizeId,
            orderBy: {field: referencia, direction:DESC}
        )   
        {
            id
            referencia
            descripcion
            categoria
            marca
            precioBase
            proveedor
            descripcion_long_es
            nom_marca
            logo_marca
            nom_categoria
            imagen_principal
            gallery {
              id
              producto
              imagen
              imagen_min
              type
              ppal
            }
            galleryColors {
              id
              fotoId
              colorId
              num_color
              label_color
              imagen_min
            }
            sizes {
                id
                tallaId
                existencia_talla
                nom_talla
                label_talla
                orden_talla
                publicar_talla
            }
            othersColors {
                color
                existencia_color
                num_color
                nom_color
            } 
         } 
}',

By reference, but I can not put the orderBy: {field: referencia, direction:DESC}

since in each case I get the error

  

"" message ":" Unknown argument \ "orderBy \" on field   \ "subcategoryPRODUCTS \" of type \ "Query \". ",

The schema for that field is:

subcategoriaPRODUCTES: {
        type: new GraphQLList(ProductType),
        args: {
            apiUrl: { type: GraphQLString },
            pageId: { type: GraphQLString },
            categoryId: { type: GraphQLString },
            subcategoryId: { type: GraphQLString },
            sizeId: { type: GraphQLString },
            brandId: { type: GraphQLString },
            colorId: { type: GraphQLString }
        },
        resolve:
            (root, args) =>
                SUBCATEGORIA('products/?pageId=${args.pageId}&categoryId=${args.categoryId}&subcategoryId=${args.subcategoryId}')
    },
    
asked by Mauricio Ardila 06.07.2018 в 17:38
source

0 answers