Skip to content

AAI-302 update registration code to create database records#49

Merged
marius-mather merged 24 commits into
mainfrom
user-db-registration
Aug 14, 2025
Merged

AAI-302 update registration code to create database records#49
marius-mather merged 24 commits into
mainfrom
user-db-registration

Conversation

@marius-mather

@marius-mather marius-mather commented Aug 12, 2025

Copy link
Copy Markdown
Collaborator

Description

AAI-302: registration endpoints should now create user records in the backend database alongside registering the user in Auth0.

Changes

  • Add user record creation in registration endpoints - BPA DP and Galaxy only, since these are the existing registration endpoints.
  • Test user record creation
  • Some improvements to our test setup to ensure we always run against the test database
  • Other improvements to test setup/fixtures

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit / integration tests that prove my fix is effective or that my feature works
  • I have run all tests locally and they pass
  • I have updated the documentation (if applicable)

How to Test Manually (if necessary)

Run uv run pytest

@marius-mather marius-mather requested review from amandazhuyilan, Copilot and minh-biocommons and removed request for amandazhuyilan August 13, 2025 05:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements database record creation during user registration for BPA Data Portal and Galaxy platforms, fulfilling requirement AAI-302. The changes extend the existing Auth0-only registration to also create user records in the backend database.

  • Add user record creation in registration endpoints for BPA DP and Galaxy
  • Enhance test infrastructure to ensure consistent test database usage
  • Update tests to verify database record creation alongside Auth0 registration

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
routers/galaxy_register.py Adds database user creation with Galaxy platform membership
routers/bpa_register.py Adds database user creation with BPA platform membership
db/models.py Adds helper methods for creating users from Auth0 data and platform memberships
auth0/client.py Adds create_user method to Auth0Client
db/setup.py Refactors database engine initialization to be lazy-loaded
tests/*.py Updates tests to use new mocked Auth0 client and verify database operations
tests/conftest.py Improves test infrastructure with better database isolation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread routers/bpa_register.py Outdated
Comment thread routers/galaxy_register.py
Comment thread db/models.py
Comment thread tests/conftest.py

@amandazhuyilan amandazhuyilan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One additional unit test requested.

Comment thread routers/bpa_register.py
@amandazhuyilan amandazhuyilan self-requested a review August 14, 2025 00:05
@marius-mather marius-mather merged commit 7a1c967 into main Aug 14, 2025
2 checks passed
@amandazhuyilan amandazhuyilan deleted the user-db-registration branch June 19, 2026 03:22
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.

3 participants