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

Create user tables for basic login.gov auth #2716

Closed
3 of 4 tasks
chouinar opened this issue Nov 4, 2024 · 2 comments
Closed
3 of 4 tasks

Create user tables for basic login.gov auth #2716

chouinar opened this issue Nov 4, 2024 · 2 comments
Assignees

Comments

@chouinar
Copy link
Collaborator

chouinar commented Nov 4, 2024

Summary

We want to create three tables in our database:

user

  • user_id : UUID
  • created_at/updated_at timestamps (like every other table, just use the mixin)

lk_external_user_type
This follows our usual pattern for lookup tables

The enum we create for this will only have a single value of login_gov at this time.

link_external_user

  • link_external_user_id : UUID
  • external_user_id: str
  • user_id: UUID / foreign key to user table / indexed
  • external_user_type_id: int / foreign key to the lk_external_user_type table
  • email: str
  • first_name: str
  • last_name: str

Note that we have been using integers for a lot of our tables primary keys up to this point. However we want these to be UUIDs so they aren't just incrementally counting upward. If you make the python type Mapped[uuid.UUID] it should make the DB type correctly, but we'll need to validate that (it should also automatically populate the ID if none provided, we'll likely need to configure that).

Acceptance criteria

  • Tables created
  • The two user related tables should be in a new models file
  • Migrations created
  • Updated factories to be able to generate user with login.gov info
@babebe
Copy link
Collaborator

babebe commented Nov 4, 2024

@chouinar Do I have this right >> The UUID for table user is what we generate ? which is the foreign key external_user_type_id in table link_external_user and the UUID in that table is the UUID from login.gov ?
or
The UUID for table user is UUID from login.gov ? which is the foreign key external_user_type_id in table link_external_user and the UUID in that table generated on insert

I guess is the user table only going to reference login.gov users, not test users for example.

@babebe babebe self-assigned this Nov 4, 2024
@chouinar
Copy link
Collaborator Author

chouinar commented Nov 4, 2024

@babebe

The user table has no knowledge of anything to do with login.gov - it's a very generic table we'll add to later.

The link_external_user table is where we put info that will connect a user to an oauth service, in this case, just login.gov

The lk_external_user_type is just to store enums for different types of external users (in this case, just login.gov) in our DB

@babebe babebe moved this from Todo to In Progress in Simpler.Grants.gov Product Backlog Nov 5, 2024
babebe added a commit that referenced this issue Nov 12, 2024
## Summary
Fixes #{[2716](#2716)}

### Time to review: __10 mins__

## Changes proposed
3 user tables
migration script
updated factories to create new users

## Context for reviewers
Users tables will be used for Oauth2 

## Additional information
> Screenshots, GIF demos, code examples or output to help show the
changes working as expected.

---------

Co-authored-by: nava-platform-bot <[email protected]>
Co-authored-by: Michael Chouinard <[email protected]>
Co-authored-by: kai [they] <[email protected]>
Co-authored-by: David Dudas <[email protected]>
@babebe babebe closed this as completed by moving to Done in Simpler.Grants.gov Product Backlog Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants