Prisma 1 Forum

Extending Sign up (createUser) mutation to cater for multiple user groups

Hello,
I am new to Graphcool and would like to use it in an application which has multiple user groups.


Upon some research I found that this was the best way to do so.

However, I am using the email authentication integration in Graphcool and would like to know if there is a way to overload the createUser(authProvider: { email: { email, password } }) mutation to cater for the different users.
Another issue I foresee is that I would not have the userid nor the usertypeid needed for the relationship between the User and the UserType at the time of sign up. I am thinking of using a request-pipeline function to handle this based on some reading, but would be open to any suggestions.

Could you please help with this?

The legacy email-password integration does not offer any flexibility at all.

Please look into this example that adds email-password authentication using the recently released resolver functions: https://github.com/graphcool/templates/tree/master/auth/email-password

1 Like

Thanks for your reply Nilan.

The problem I am facing is that when I graphcool pull my exist project, the only file downloaded is project.graphcool.
I have noticed that the files I should have are graphcool.yml, types.graphql and src/, but I do not seem to have them. Am I doing something wrong?

Another thing is that add-template is not an existing option under the graphcool command. I have tried updating it to no avail. Could you help with this?

It sounds like you are using graphcool@1.3.7. Templates are only supported in the Framework Preview.

So while you can still use the example I linked to as an orientation, you will need to make the changes partly in the project.graphcool file, and partly in the Console function editor.

Thanks for that I will check it out immediately.