It's really not more complicated than that for generating the actual ID. You could then abstract that further and do a small function that can generate a resolver for you, that you can re-use throughout your schema.
I'd say, in the simplest possible form, it'd look like this (warning for more pseudo-code):
Thank you! Yes, this is something similar to what I was implementing. Since I am using sequelize, I was trying to avoid code duplication and maybe thought if it was possible to have a hook or something in the graphql schema so I dont have to manually translate each ID on each resolver.
The code has perfect sense and I'll check the best way to implement it.
Thanks again!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Sebastian, and thank you!
It's really not more complicated than that for generating the actual ID. You could then abstract that further and do a small function that can generate a resolver for you, that you can re-use throughout your schema.
So, it's just a matter of decoding the id and extracting the information you're after, and then use that to resolve the relevant object you need.
Does that make sense?
Thank you! Yes, this is something similar to what I was implementing. Since I am using sequelize, I was trying to avoid code duplication and maybe thought if it was possible to have a hook or something in the graphql schema so I dont have to manually translate each ID on each resolver.
The code has perfect sense and I'll check the best way to implement it.
Thanks again!