-
Notifications
You must be signed in to change notification settings - Fork 10
Add/Delete User in Org/Project #737
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
Merged
Ayush8923
merged 14 commits into
feat/google-integration-auth-flow
from
feat/add-user-project
Apr 9, 2026
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7e46f7d
feat(*): API for create user corresponding to projects
Ayush8923 a6b6281
fix(*): few updates on user projects
Ayush8923 8b3e5e9
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 b1082a5
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 9e833d8
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 a57f829
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 b211652
Merge branch 'feat/google-integration-auth-flow' into feat/add-user-p…
Ayush8923 fd377e8
fix(*): some of the edge cases implementation
Ayush8923 781fccc
Merge branch 'feat/add-user-project' of https://github.com/ProjectTec…
Ayush8923 7133fa1
fix(*): remove the unused vairbales
Ayush8923 833bda2
Merge branch 'feat/google-integration-auth-flow' into feat/add-user-p…
Ayush8923 ccb11cc
Merge branch 'feat/google-integration-auth-flow' into feat/add-user-p…
Ayush8923 a81d18e
Merge branch 'feat/google-integration-auth-flow' into feat/add-user-p…
Ayush8923 280b254
sugg(*): made the changes as per the suggestion
Ayush8923 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| """Add userproject table | ||
|
|
||
| Revision ID: 050 | ||
| Revises: 049 | ||
| Create Date: 2026-04-01 12:17:42.165482 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "050" | ||
| down_revision = "049" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| op.create_table( | ||
| "user_project", | ||
| sa.Column( | ||
| "user_id", sa.Integer(), nullable=False, comment="Reference to the user" | ||
| ), | ||
| sa.Column( | ||
| "organization_id", | ||
| sa.Integer(), | ||
| nullable=False, | ||
| comment="Reference to the organization", | ||
| ), | ||
| sa.Column( | ||
| "project_id", | ||
| sa.Integer(), | ||
| nullable=False, | ||
| comment="Reference to the project", | ||
| ), | ||
| sa.Column( | ||
| "id", | ||
| sa.Integer(), | ||
| nullable=False, | ||
| comment="Unique identifier for the user-project mapping", | ||
| ), | ||
| sa.Column( | ||
| "inserted_at", | ||
| sa.DateTime(), | ||
| nullable=False, | ||
| comment="Timestamp when the mapping was created", | ||
| ), | ||
| sa.ForeignKeyConstraint( | ||
| ["organization_id"], ["organization.id"], ondelete="CASCADE" | ||
| ), | ||
| sa.ForeignKeyConstraint(["project_id"], ["project.id"], ondelete="CASCADE"), | ||
| sa.ForeignKeyConstraint(["user_id"], ["user.id"], ondelete="CASCADE"), | ||
| sa.PrimaryKeyConstraint("id"), | ||
| sa.UniqueConstraint("user_id", "project_id", name="uq_user_project"), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade(): | ||
| op.drop_table("user_project") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| Add one or more users to a project by email. **Requires superuser access.** | ||
|
|
||
| **Request Body:** | ||
| - `organization_id` (required): The ID of the organization the project belongs to. | ||
| - `project_id` (required): The ID of the project to add users to. | ||
| - `users` (required): Array of user objects. | ||
| - `email` (required): User's email address. | ||
| - `full_name` (optional): User's full name. | ||
|
|
||
| **Examples:** | ||
| - **Single user**: `{"organization_id": 1, "project_id": 1, "users": [{"email": "user@gmail.com", "full_name": "User Name"}]}` | ||
| - **Multiple users**: `{"organization_id": 1, "project_id": 1, "users": [{"email": "a@gmail.com"}, {"email": "b@gmail.com"}]}` | ||
|
|
||
| **Behavior per email:** | ||
| - If the user does not exist, a new account is created with `is_active: false`. The user will be activated on their first Google login. | ||
| - If the user already exists and is already in this project, they are skipped. | ||
| - If the user exists but is not in this project, they are added. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| Remove a user from a project. **Requires superuser access.** | ||
|
|
||
| **Path Parameters:** | ||
| - `user_id` (required): The ID of the user to remove. | ||
|
|
||
| **Query Parameters:** | ||
| - `project_id` (required): The ID of the project to remove the user from. | ||
|
|
||
| This only removes the user-project mapping — the user account itself is not deleted. You cannot remove yourself from a project. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| List all users that belong to a project. | ||
|
|
||
| **Query Parameters:** | ||
| - `project_id` (required): The ID of the project to list users for. | ||
|
|
||
| Returns user details including their active status — users added via invitation will have `is_active: false` until they complete their first Google login. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have commont auth.py route instead of google_auth.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, updated.