Skip to content

belongsTo relation returns null #19

@SilvaLA59

Description

@SilvaLA59

Hello, I'm trying do make a query with relation. I can get the correct result from hasMany relation but when I try with a belongsTo relation the return is null, see Solicitante and TipoDespesa. Does anyone can see what I'm doing wrong? When I call the find method on loopback explorer with these relation I can get all the informations.
Query

{
  Solicitacao{
    SolicitacaoFind(
      filter: {
        where: { Codigo: 4},
        include: ["Solicitante", "SolicitacaoItens"]
      }
      options: {}) {
      edges {
        node {
	  Codigo,
          Solicitante {
            username,
            email
          }
          SolicitacaoItens {
            edges {
              node {
                CodigoTipoSolicitacaoItem,
                QuantidadeComprovantes,
                TipoDespesa {
                  Codigo,
                  Descricao,
                  CodigoSAP
                }
              }
            }
          }
        }
      }
    }
  }
}

Result

{
  "data": {
    "Solicitacao": {
      "SolicitacaoFind": {
        "edges": [
          {
            "node": {
              "Codigo": 4,
              "Solicitante": null,
              "SolicitacaoItens": {
                "edges": [
                  {
                    "node": {
                      "CodigoTipoSolicitacaoItem": 9,
                      "QuantidadeComprovantes": 150,
                      "TipoDespesa": null
                    }
                  },
                  {
                    "node": {
                      "CodigoTipoSolicitacaoItem": 4,
                      "QuantidadeComprovantes": 105,
                      "TipoDespesa": null
                    }
                  },
                  {
                    "node": {
                      "CodigoTipoSolicitacaoItem": 9,
                      "QuantidadeComprovantes": 300,
                      "TipoDespesa": null
                    }
                  }
                ]
              }
            }
          }
        ]
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions