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

User management #275

Merged
merged 5 commits into from
Feb 7, 2025
Merged

User management #275

merged 5 commits into from
Feb 7, 2025

Conversation

malcolmm20
Copy link
Contributor

Proposed Changes

Resolves #255

  • 2 new tables, with migrations
    • super_users: no endpoints can update this table, users must be added through supabase. Just a foreign key from the users' profile entry.
    • invites: can be created/deleted/read via new endpoints. Contains foreign key from users' profile, email of invited user, timestamp of invite creation, and a col indicating the timestam when the user joined, which is null if the user has not joined. PK is a composite of FK from profiles and invited email.
  • Created 3 new endpoints
    • GET /invites: returns list of all invites
    • DELETE /invites/{referrer_id}/{email}: a bit weird because of the composite key, but from online this seemed like a better option that supplying a request body to a delete endpoint.
    • CREATE /invites: call this endpoint with referrer_id: {profile UUID} and email: {referred email} in the request body
  • When a invited user signs up, the invites entry is updated with joined_at being set tot he current time.
  • If an uninvited user attempts to sign up it will fail.

Copy link
Collaborator

@armintalaie armintalaie left a comment

Choose a reason for hiding this comment

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

Looks good @malcolmm20. the db file is off. the migration does not seem to be applying the new tables we need. Check my other comment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The migration seems incorrect. It just drops a comment? Also please do not use alembic auto gen anymore: https://forumai.me/forum/courses/d79977ce-fa53-49a0-b541-eed0081fd10e/forum/24

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dont think I've been added to that course, it just takes me to an empty course page

@armanmoztar
Copy link
Member

I think other than Armin's comments, it looks good

@armanmoztar armanmoztar added database backend python Pull requests that update Python code labels Feb 6, 2025
@armintalaie armintalaie merged commit 765bbec into dev Feb 7, 2025
5 checks passed
@armintalaie armintalaie deleted the user-management branch February 7, 2025 05:43
jaypark25 pushed a commit that referenced this pull request Feb 7, 2025
* user management

* new files

* updated migrations

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
bcw117 pushed a commit that referenced this pull request Feb 8, 2025
* user management

* new files

* updated migrations

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
bcw117 pushed a commit that referenced this pull request Feb 8, 2025
* user management

* new files

* updated migrations

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
bcw117 added a commit that referenced this pull request Feb 8, 2025
Create blank issue template (#246)

Create blank issue tempalte

Cleanup Migration (#238)

* lots of cleanup on db side

* attempt: fixed dup fkey genereation

* ignoring pylance issues for old migration issues

* formatting

* vs code exclude ruff cache

* merge heads

129 create privacy policy and terms of service (#248)

* Add terms and privacy pages

* Remove unneeded exports

* fix lint

* Fix errors in text and change wording

* Create SECURITY.md (#243)

* Create blank issue template (#246)

Create blank issue tempalte

* Create bug reporting issue template (#244)

* Update issue templates

* Update bug-report.md

* Reimplement privacy and terms using MDX components

* moved mdx types to dev deps

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
Co-authored-by: Armin Talaie <[email protected]>

Remove duplicated blank issue template (#250)

remove duplicated blank issue template

desktop app setup with Tauri (#252)

Tags API and migrations (#237)

* migrations for roles and tags

* migration works just update head

* minor db model changes for semantics and due to errors

* roles init commit

* implemented several more apis

* updated migrations to remove roles, commented out roles db and created new migration for only tags

* init first get tag for roles

* imports

* comment out role code

* commit to fix migration head

* added post_tag and doc_tags tables

* place migrations on top of new head

* updated foreign key for post ID from INT to UUID (to match the changed type from merge)

* added back queryhistory model

* brought back get_all_tags from merge

* comment out more courserole stuff

* create tag endpoint

* added general crud for tags

* renamed tags specific to courses, course tags

* added post_tags

* fixed all errors with migration

* minor refactor for post tags

* added document tagging

* lots of cleanup on db side

* attempt: fixed dup fkey genereation

* ignoring pylance issues for old migration issues

* formatting

* vs code exclude ruff cache

* updated to grab authenticated user for created_by field

* removed commented out roles

* updated migrations, removed more role stuff

* clean up + include pydantic schema

* removed role imports

* remove optional for course_id

* updated migration head after pulling cleanup

* kept enum model and fixed small insert error with post tag + doc tag

* merge migrations from dev

* merge heads for db

* formatting

* fixed type issues

---------

Co-authored-by: harshamin <[email protected]>
Co-authored-by: Armin Talaie <[email protected]>
Co-authored-by: Arman Moztarzadeh <[email protected]>

Update issue templates (#247)

* Update issue templates

* Update feature_request.md

* Update feature_request.md

Setting Theme Refresh (#258)

* added revalidate route for cache, used when theme gets updated ya feel

* real time setting updating,  so real, fr fr

* yarn format and lint

Landing Page Initialization [V1] (#259)

* init landing page

* fix styling for mobile

* switch to light theme

Include type field for issue templates (#261)

* Add type field to issue templates

* Update feature issue tempalte

* small change

* Include related issues for feature

re-order items in header

fix

fix button styling

Updated Settings Page (#276)

* better routing

* formatting

* migrated settings mgmt state to zustand + enhanced settings page

* replaced coursecontext with coursestore

* theme tuning

User management (#275)

* user management

* new files

* updated migrations

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>

Execute jobs (#278)

* feat: implement job scheduler and execution system with runnable

* deleted test file

* cleaned up code from PR, added a sample job for dev guidelining
bcw117 pushed a commit that referenced this pull request Feb 8, 2025
* user management

* new files

* updated migrations

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
armanmoztar added a commit that referenced this pull request Feb 9, 2025
* Add basic websocket implementation

* revert migration file

* Fix merge conflicts

* Add temporary frontend files

* add basic websocket implementation

* Reset migrations and add template code for chat

* Fix overlap by adding spacing and changing font size (#245)

* Fix overlap by adding spacing and changing font size

* fix lint

* Create SECURITY.md (#243)

* Create blank issue template (#246)

Create blank issue tempalte

* Create bug reporting issue template (#244)

* Update issue templates

* Update bug-report.md

* Cleanup Migration (#238)

* lots of cleanup on db side

* attempt: fixed dup fkey genereation

* ignoring pylance issues for old migration issues

* formatting

* vs code exclude ruff cache

* merge heads

* 129 create privacy policy and terms of service (#248)

* Add terms and privacy pages

* Remove unneeded exports

* fix lint

* Fix errors in text and change wording

* Create SECURITY.md (#243)

* Create blank issue template (#246)

Create blank issue tempalte

* Create bug reporting issue template (#244)

* Update issue templates

* Update bug-report.md

* Reimplement privacy and terms using MDX components

* moved mdx types to dev deps

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
Co-authored-by: Armin Talaie <[email protected]>

* Remove duplicated blank issue template (#250)

remove duplicated blank issue template

* Create blank issue template (#246)

Create blank issue tempalte

* Cleanup Migration (#238)

* lots of cleanup on db side

* attempt: fixed dup fkey genereation

* ignoring pylance issues for old migration issues

* formatting

* vs code exclude ruff cache

* merge heads

* 129 create privacy policy and terms of service (#248)

* Add terms and privacy pages

* Remove unneeded exports

* fix lint

* Fix errors in text and change wording

* Create SECURITY.md (#243)

* Create blank issue template (#246)

Create blank issue tempalte

* Create bug reporting issue template (#244)

* Update issue templates

* Update bug-report.md

* Reimplement privacy and terms using MDX components

* moved mdx types to dev deps

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
Co-authored-by: Armin Talaie <[email protected]>

* Remove duplicated blank issue template (#250)

remove duplicated blank issue template

* Implement functional chat room

* Add token verification

* Remove supabase channel listening and use websockets to broadcast

* Rename files and change naming conventions

* Create blank issue template (#246)

Create blank issue tempalte

* Cleanup Migration (#238)

* lots of cleanup on db side

* attempt: fixed dup fkey genereation

* ignoring pylance issues for old migration issues

* formatting

* vs code exclude ruff cache

* merge heads

* 129 create privacy policy and terms of service (#248)

* Add terms and privacy pages

* Remove unneeded exports

* fix lint

* Fix errors in text and change wording

* Create SECURITY.md (#243)

* Create blank issue template (#246)

Create blank issue tempalte

* Create bug reporting issue template (#244)

* Update issue templates

* Update bug-report.md

* Reimplement privacy and terms using MDX components

* moved mdx types to dev deps

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
Co-authored-by: Armin Talaie <[email protected]>

* Remove duplicated blank issue template (#250)

remove duplicated blank issue template

* desktop app setup with Tauri (#252)

* Tags API and migrations (#237)

* migrations for roles and tags

* migration works just update head

* minor db model changes for semantics and due to errors

* roles init commit

* implemented several more apis

* updated migrations to remove roles, commented out roles db and created new migration for only tags

* init first get tag for roles

* imports

* comment out role code

* commit to fix migration head

* added post_tag and doc_tags tables

* place migrations on top of new head

* updated foreign key for post ID from INT to UUID (to match the changed type from merge)

* added back queryhistory model

* brought back get_all_tags from merge

* comment out more courserole stuff

* create tag endpoint

* added general crud for tags

* renamed tags specific to courses, course tags

* added post_tags

* fixed all errors with migration

* minor refactor for post tags

* added document tagging

* lots of cleanup on db side

* attempt: fixed dup fkey genereation

* ignoring pylance issues for old migration issues

* formatting

* vs code exclude ruff cache

* updated to grab authenticated user for created_by field

* removed commented out roles

* updated migrations, removed more role stuff

* clean up + include pydantic schema

* removed role imports

* remove optional for course_id

* updated migration head after pulling cleanup

* kept enum model and fixed small insert error with post tag + doc tag

* merge migrations from dev

* merge heads for db

* formatting

* fixed type issues

---------

Co-authored-by: harshamin <[email protected]>
Co-authored-by: Armin Talaie <[email protected]>
Co-authored-by: Arman Moztarzadeh <[email protected]>

* Update issue templates (#247)

* Update issue templates

* Update feature_request.md

* Update feature_request.md

* Setting Theme Refresh (#258)

* added revalidate route for cache, used when theme gets updated ya feel

* real time setting updating,  so real, fr fr

* yarn format and lint

* Landing Page Initialization [V1] (#259)

* init landing page

* fix styling for mobile

* switch to light theme

* Include type field for issue templates (#261)

* Add type field to issue templates

* Update feature issue tempalte

* small change

* Include related issues for feature

* re-order items in header

* fix

* fix button styling

* Updated Settings Page (#276)

* better routing

* formatting

* migrated settings mgmt state to zustand + enhanced settings page

* replaced coursecontext with coursestore

* theme tuning

* User management (#275)

* user management

* new files

* updated migrations

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>

* Execute jobs (#278)

* feat: implement job scheduler and execution system with runnable

* deleted test file

* cleaned up code from PR, added a sample job for dev guidelining

* Fix lint issues and use prettier

---------

Co-authored-by: Arman Moztarzadeh <[email protected]>
Co-authored-by: Armin Talaie <[email protected]>
Co-authored-by: Caeleb Koharjo <[email protected]>
Co-authored-by: harshamin <[email protected]>
Co-authored-by: Diego Ayoubzadeh <[email protected]>
Co-authored-by: Shreyas Goyal <[email protected]>
Co-authored-by: Shreyas Goyal <[email protected]>
Co-authored-by: malcolmm20 <[email protected]>
Co-authored-by: Kangbin (Jay) Park <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend database python Pull requests that update Python code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Backend implementation for user access
3 participants