Skip to content

First migration : create roles and users#1

Merged
pysnooLab merged 19 commits intomainfrom
feat/US-1.1_FirstAdminSignup
Mar 4, 2026
Merged

First migration : create roles and users#1
pysnooLab merged 19 commits intomainfrom
feat/US-1.1_FirstAdminSignup

Conversation

@pysnooLab
Copy link
Copy Markdown
Collaborator

@pysnooLab pysnooLab commented Mar 3, 2026

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

image

Copy link
Copy Markdown
Collaborator

@guilbill guilbill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread supabase/migrations/20260303131527_add_trigger_first_admin.sql Outdated
Comment thread src/lib/supabase.ts Outdated
Comment thread src/components/forgot-password-form.tsx Outdated
Comment thread src/App.tsx
@pysnooLab pysnooLab marked this pull request as ready for review March 4, 2026 14:47
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pysnooLab pysnooLab merged commit 0b4ac83 into main Mar 4, 2026
2 checks passed
@jonathanarnault jonathanarnault deleted the feat/US-1.1_FirstAdminSignup branch March 20, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants