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

Tenancies #418

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open

Tenancies #418

wants to merge 26 commits into from

Conversation

N2D4
Copy link
Contributor

@N2D4 N2D4 commented Feb 6, 2025

Adds Tenancies to the database schema. This is the name of the concept that's Project x Branch x Environment x Organization.

For now, this adds a tenancy property to SmartRequestAuth. Later, in the "Make all endpoints support organizations" step, we want to get rid of this, as only projectId and branchId are known by SmartRequest (each endpoint may use a different strategy to pick the organization — usually based on the user ID, but can be anything). However, for now, it makes the transition much easier.


Important

Introduces 'Tenancies' to support multi-tenancy, affecting database schema, authentication, and API handling.

  • Database Schema:
    • Introduces Tenancy table in migration.sql to represent Project x Branch x Environment x Organization.
    • Updates foreign keys and indices in migration.sql to use tenancyId instead of projectId.
    • Removes ProjectConfigOverride table.
  • Authentication:
    • Adds tenancy property to SmartRequestAuth in smart-request.tsx.
    • Modifies createAuthTokens() and generateAccessToken() in tokens.tsx to use tenancy.
    • Updates OAuthModel in model.tsx to handle tenancy for token operations.
  • API Changes:
    • Refactors CRUD handlers in crud-handler.tsx to support tenancy.
    • Updates verification code handling in verification-code-handler.tsx to use tenancy.
    • Modifies parseAuth() in smart-request.tsx to include tenancy in authentication context.
  • Miscellaneous:
    • Adjusts error handling in errors.tsx to accommodate new tenancy logic.
    • Updates e2e tests in backend-helpers.ts to validate tenancy-related changes.
    • Fixes minor UI issues in page-client.tsx and utils.tsx for webhooks.

This description was created by Ellipsis for 60f6231. It will automatically update as commits are pushed.

Copy link

vercel bot commented Feb 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stack-backend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 10:20am
stack-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 10:20am
stack-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 10:20am

@N2D4 N2D4 marked this pull request as draft February 6, 2025 05:53
apps/backend/src/route-handlers/smart-request.tsx Outdated Show resolved Hide resolved
apps/backend/src/lib/tenancies.tsx Outdated Show resolved Hide resolved
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.

1 participant