Shows - Parent Type
Person - Child Type
ONE show can have MANY persons. I want to pass each 'personId' from shows type as an argument to its child type Person as shown below:
{
shows
{
showId
personId
person(personId: <I_NEED_TO_PASS_THE_personId_ABOVE_HERE>)
{
name
}
}
}
May I know how to access the value of PersonId Field (sibling) in the Person field please?
public class ShowType : ObjectGraphType<Core.Show>
{
public ShowType(
IPersonRepository PersonRepository,
IHttpContextAccessor accessor)
{
Field(a => a.ShowId);
Field(a => a.PersonId); // PERSONID_VALUE
Field<PersonType>(
"Person",
arguments: new QueryArguments(
new QueryArgument<IdGraphType> { Name = "PersonId" }
),
resolve: context =>
{
var PersonId = context.GetArgument<string>("PersonId");
return PersonRepository.GetPerson(accessor.HttpContext, <I_NEED_PERSONID_VALUE_DIRECTLY_HERE_OR_THROUGH_ARGUMENTS>);
}
);
}
}
Please advise how to achieve this.