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

Allow Single User #96

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Allow Single User #96

merged 1 commit into from
Sep 13, 2024

Conversation

rgaudin
Copy link
Member

@rgaudin rgaudin commented Sep 12, 2024

Fixed #95

This feature serves two purposes:

  • sets a variable on both frontend and backend indicating that we are in single-user mode. this is the concept we'll use to switch between public SaaS and private single-user
  • sets a single User ID that is sent to all users

This makes sure that anyone connecting is on the same session, sees the same projects. Even though the cookie might expire, re-requesting one gets the same User ID.

On the backend, if SINGLE_USER_ID is set, it is checked for existence on start or created if not. In the frontend, homepage checks whether it is expecting a single user mode (ENV) and if yes, fetches the User and Projects from backend before redirecting to /collections

This feature serves two purposes:

- sets a variable on both frontend and backend indicating that we are in single-user mode. this is the concept we'll use to switch between public SaaS and private single-user
- sets a single User ID that is sent to all ~users~

This makes sure that anyone connecting is on the same session, sees the same projects. Even though the cookie might expire, re-requesting one gets the same User ID.

On the backend, if SINGLE_USER_ID is set, it is checked for existence on start or created if not.
In the frontend, homepage checks whether it is expecting a single user mode (ENV) and if yes, fetches the User and Projects from backend before redirecting to /collections
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 14 lines in your changes missing coverage. Please review.

Project coverage is 73.24%. Comparing base (2f6e54f) to head (e254f34).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
backend/api/database/utils.py 30.76% 9 Missing ⚠️
backend/api/main.py 33.33% 2 Missing ⚠️
backend/api/routes/users.py 71.42% 1 Missing and 1 partial ⚠️
backend/api/constants.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
- Coverage   74.11%   73.24%   -0.88%     
==========================================
  Files          18       18              
  Lines         962      983      +21     
  Branches      115      120       +5     
==========================================
+ Hits          713      720       +7     
- Misses        226      239      +13     
- Partials       23       24       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rgaudin rgaudin self-assigned this Sep 12, 2024
@rgaudin rgaudin merged commit 0e8c4db into main Sep 13, 2024
4 of 6 checks passed
@rgaudin rgaudin deleted the single-user branch September 13, 2024 11:54
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.

Allow single user
1 participant