Skip to content

Onboarding: enforce single project per user on onboard#805

Merged
Ayush8923 merged 2 commits intomainfrom
enhancement/onboarding-admin-assignments
Apr 30, 2026
Merged

Onboarding: enforce single project per user on onboard#805
Ayush8923 merged 2 commits intomainfrom
enhancement/onboarding-admin-assignments

Conversation

@Ayush8923
Copy link
Copy Markdown
Collaborator

@Ayush8923 Ayush8923 commented Apr 30, 2026

Issue: ProjectTech4DevAI/kaapi-frontend#133

Summary

  • After the user is created/looked up, insert the corresponding user_project mapping in the same transaction.
  • If the user already has a mapping to a different project, the endpoint now responds with 409 Conflict: User '<email>' is already associated with another project.

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@Ayush8923 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 5 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dfa465d9-38d9-41d2-bc7d-200b0cdec66d

📥 Commits

Reviewing files that changed from the base of the PR and between ce5346a and 53ff588.

📒 Files selected for processing (2)
  • backend/app/crud/onboarding.py
  • backend/app/tests/crud/test_onboarding.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch enhancement/onboarding-admin-assignments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 15 minutes and 5 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Ayush8923 Ayush8923 changed the title fix(*): onboarding admin assignments Onboarding: enforce single project per user on onboard Apr 30, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Ayush8923 Ayush8923 self-assigned this Apr 30, 2026
session.add(user)
session.flush()

_, mapping_status = add_user_to_project(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why user can't map to other project ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because then we would have to build the entire flow where a user can switch between multiple projects using a single login. For example, if a user belongs to multiple projects, we would need to show a dropdown in the UI to let them switch projects, and the data would then load based on the selected project. This would require a lot of changes, so for now we are avoiding this.

@Ayush8923 Ayush8923 merged commit 7bdf83b into main Apr 30, 2026
3 checks passed
@Ayush8923 Ayush8923 deleted the enhancement/onboarding-admin-assignments branch April 30, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants