Say you need to define multiple roles - admin - mo...
# prisma-whats-new
d
Say you need to define multiple roles - admin - moderator - powerUser - etc… Would there ever be a use case for just creating a model for each? userAdmin, userModerator, etc.. Rather then just creating one User model - and separating them by a β€˜role’ property Would this be madness?
n
@doug_w if the information you need to store differs considerably between different user roles, having separate types would be preferred - however, the
User
type is currently the only way into the permission system itself, so your
Admin
,
Moderator
, etc types would need a one-to-one relation to the
User
type.
d
That makes sense.
n
On the other hand, would you require user roles to change from time to time?
d
As in would I add new roles to the DB model - or would a user actually change their role?
n
I spoke about the latter, but both are interesting πŸ˜„
d
( Also for that other issue, I tried going in cognito and emptying the Users DB, no luck)
πŸ‘ 1
Agreed - I am working on two different products - they bother require user roles and privledges. For the first one I am going to stick with the traditional one user Model and see how it goes. The next project is going to be much more complex - think of user roles in Salesforce
n
Gotcha! Just as a headsup, if you need to change the role of an existing user, you need some kind of migration logic. But if different user roles have differnt kind of information, there's no way around that, right?
Thanks, I'll have a look at the tutorial myself πŸ™‚
d
Cool thanks! Yeah there is still some
react-router
stuff in there. I am not sure if you left it on purpose for the
withRouter
or if it is leftover by mistake. It didn’t seem to affect much for me though
n
the problems were indeed caused by leftovers from RR2 that were missed in the migration to RR4
let me know if it works for you as well, @doug_w πŸ™‚
d
Oh nice - cool - I will look into it right now!
Alright smooth sailing! Thanks πŸ‘
n
Awesome! Sorry for all the trouble and thanks for helping me out πŸ™‚
d
πŸ™Œ
p
Thanks @doug_w for asking, I had the same problem and @nilan for the support. πŸ˜€
πŸ‘ 1
n
yea I remember Felipe! πŸ™‚ now it works again πŸŽ‰