Is it a possible to use enum as type for fields in additionalFields ?
I want to use the
role
field directly with my user session, I have a enum with "ADMIN" and "USER"13 Replies
hmm? does this mean you want to have a role field in your user table?
Yes exactly, i'm using Prisma as database adapter and I have a
role: Role?
fielddefine addtional fields in your user config. If you need to define it as enum for type inference you can pass an array as a type.
None of these implementations works for me, I got TS errors (even this snippet ⬆️)
oh wait sorry
No problem, but the TS error is still appearing
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
thanks, this implementation kind of work, but the Prisma adapter creates a String[] instead of a reference to an enum.
you should this instead. It should be defined under addittional fields
and the cli doesn't currently support generating enum values
It's working like that thanks ! (Don't know why
undefined
is a possible value but that's enough I think)
undefined is there cause session it self could be undefined
oh yes I see
Thanks a lot for your help @bekacru @Phantom ! ✅✅✅
With Prisma generated client
how do you navigate from login page ? how do you obtain the role (user or admin) using sign-in method and redirect to the appropriate page according to role?
for example when i click on login page the data returned doesnt contain and role object