Hello, please is anyone working on graphql for mic...
# random
r
Hello, please is anyone working on graphql for microservice using prisma for the database?
j
Me
I'm using graphql schema stiching with multiple databases(one db per service)
This is my public repo that I means
r
Thank you Jurapong
I need an understanding of something can I please have 10 mins of your time
j
Please list your questions here I will give an advice from my experience.
r
I want to query a table, but the table comes with a id which is from a different service. How do I use the I to fetch the corresponding data. Thank you
j
Is it possible to communicate between services with http?
r
Example: Service A has Department in a database 2 Department: id department_name user_id Service B has User in a database 1 - User: id name email am using apollo federation resolver: listDepartment how do I perform that query
Yes they communicate
j
I'm using genql to communicate with internal services
👍 1
Copy code
const deparmentUser = deparmentGraphqlClient().chain.query.getUserById({userId: <your userId>}).get({_scalar:true})

const userInfo = userGraphqlClient().chain.query.getUserById({userId: <your userId>}).get({_scalar:true})
Is it what you need?
r
I don't know if is going to work, if I run the query for allDepartment and allUsers it work. The Client should be able to request allDepartment and the response should include the user_id which will be used to fetch with getUser query
j
Could you give me an example of your query?
I think in this case you can use apollo federation with field resolver to get user info
I think I can give you and sample code that might be help you get more understandable https://github.com/tadchud/key-master/blob/main/apps/user-backend/src/schemas/user.schema.ts#L24
I think this is almost the same relation that you need
r
Ok thanks am trying it out thank you very much
j
You can fork my github repo to check on it
You're welcome
s
we're using federation & subgraphs across logical services
well, currently in the process of building.