First migration : create roles and users#1
Conversation
guilbill
left a comment
There was a problem hiding this comment.
Good usage of documentation and of already made component.
A little bit affraid that you miss some things with all this code. But it's efficient.
Note: in general I prefer arrow function for components:
const MyComponent = () => {
return (<div>MyComponent</div>);
}It's more concise and you will see this form more often.
Also, it's in Draft for now, but when you make this PR reviewable, make sure to include a description in it. You can follow this template :
## Description
## How to test
## Demo
Here we can have a screenshot, or a video
There was a problem hiding this comment.
polish: rename and move this close to supabase.ts in the lib folder.
It's not a component test, it's more a test of the trigger you developped. To me it should be closer to the supabase.ts file.
Maybe rename this supabase.test.ts ? (also, you can have a ts file, not necessarly a tsx file, you do not have html in it.
Description
Creation of table app_user
Automatically assign a new user with role Admin if no admin are in database, agent otherwise.
Redirect automatically to /Dashboard when signed up
How to test
Go to /auth/signup, create a new user.
Verify that you are redirected to /Dashboard if no errors.
Check in database if a new row in app_user is created linked to auth.user and role is Admin if there was no other admins before.
Register a new user and verify that the other is Agent.
Demo