How to create typeorm relationships with next-auth user model #729
Unanswered
kenperkins
asked this question in
Help
Replies: 3 comments
-
I'm in the same situation, would love to know the answer to this. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm also having issues extending my user model following this documentation (https://next-auth.js.org/tutorials/typeorm-custom-models) with MongoDB. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Not a solution to our issue here, but I tried prisma instead of typeorm and it's really easy to do it just so you know. To do this simply extend the base model as you want: https://next-auth.js.org/schemas/adapters. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Your question
I'm trying to create an extended schema of models outside of next-auth, but I want to be able to create associations to the user model. In the simplest case, I want to be able to use typeorm to query for models related to the next-auth user.
I could certainly do this without associations by just adding a field to my models of the same type as the user id, however, I'd love to know if I can do this more correctly in the sense of a proper typeorm model.
I read through the extending or using my own models, and maybe that's the right way to do this, but it's opaque how to actually create my own model based on the limited documentation here:
https://next-auth.js.org/tutorials/typeorm-custom-models#using-custom-models
Beta Was this translation helpful? Give feedback.
All reactions