Hello, having a situation i can’t wrap my head around with knowledge i have so thought would post question here.
Ask:
Create a gateway using apollo federation which will expose a data structure like below
User{
id: string;
tracking: string;
firstname: string;
email: string;
region: string;
applications:{ // this is an array , so multiple applications per user
status:string;
company: string;
}
}
What i already have created
I have created two subgraphs. One for the User entity and another for the Application entity.
User Subgraph
- Created a resolver that takes id and tracking as parameters to find a unique user. So i also denoted these two fields as Key
Application Subgraph
- Created a resolver that takes User as input and outputs list of all applications by that user. To find applications for the user, i will need users first name, email and region.
I looked at various existing example code and they are very simple like just having ID as keys between fields. But in my case i will need to pass whole User object which is output from querying User subgraph as input to get applications. I don’t even know if this is possible, Please shed some light
so when i looked at rest example of federation, there is a gateway and below code in posts resolver.
What does the code actually do ? does it forward request to gateway, such that using the typename the gateway will now route the request to Users subgraph to query user information using the passed ID parameter ?