Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize register-user endpoint, to make creation of user and settings simultaneous #1776

Open
tcompa opened this issue Sep 18, 2024 · 1 comment

Comments

@tcompa
Copy link
Collaborator

tcompa commented Sep 18, 2024

We are starting by simply using the on_after_register hook, but this requires that first we create a valid user and then we associate it to a settings entry -> therefore we cannot make the FK required.

If we customize SQLModelUserDatabaseAsync.create, we could create the two DB objects at the same time.

Ref:


We have at least two options:

  1. Add attribute SQLModelUserDatabaseAsync.user_settings_model, and customize SQLModelUserDatabaseAsync.create so that it creates both the user and their settings.
  2. Rewrite the POST /auth/register/ endpoint without using fastapi-users or SQLModelUserDatabaseAsync logics - or maybe by only using some of them.
@tcompa
Copy link
Collaborator Author

tcompa commented Sep 24, 2024

A good attempt at this was #1789.

For the moment, we will keep the UserOAuth.user_settings_id foreign key optional, even though it will always be present in practice. In a later update, we'll try to fully integrate the user-register and oauth-related endpoints from fastapi-users into fractal-server.

We decided to postpone this task mostly due to several other ongoing updates - but this is ready for further work.

cc @ychiucco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant