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

add tenant example #428

Merged
merged 1 commit into from
Sep 8, 2023
Merged

Conversation

vinstah
Copy link
Contributor

@vinstah vinstah commented Sep 7, 2023

Test Plan

Checklist

  • Docs updated

Screenshots

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

This is great! Just one thing.

@@ -56,6 +56,9 @@ This page links to examples of how to implement some things with the Epic Stack.
- [Epic Stack + Fathom Analytics](https://github.com/xstevenyung/epic-stack-with-fathom-analytics)
by [@xstevenyung](https://github.com/xstevenyung): An example of the Epic Stack
with Fanthom Analytics via CDN
- [Epic Stack + Tenant Users](https://github.com/offseat/epic-stack-tenant)
Copy link
Member

Choose a reason for hiding this comment

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

I think this may be private:

image

Could you make it public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doh, public now!

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

Unfortunately, it's hard to tell what changes are required for this example. The instructions say you should make a commit as soon as you initialize the project and then after you make your changes so people can see the difference between a standard epic stack project and one with the changes you make.

Could you do that please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, yeah I'll update that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Kent,

I've updated it now

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

I'm concerned the implementation is overly complicated. What do you think about doing this instead:

  1. create a tenant model with an id and name
  2. give all models a tenantId and relate them to the tenant (one-to-many relationship)
  3. adjust queries to scope them to a specific tenantId (may require updating the routes to include the tenantId in the params)

I think that would be simpler than having a User, TenantUser, WorkspaceUser and Member all of which kinda feel like the same abstract concept to me. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah they do seem to be sort of the same at the moment, though I chose to add extraction so when I want to query a WorkspaceUser I can simply do prisma.workspaceuser, a TenantUser is usually the admin of the tenant and manages subscription/payment, Members are the Individuals that belong to the Tenant.

It's a complex system that does need thorough documentation

Copy link
Member

Choose a reason for hiding this comment

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

Ok, sounds good. Thanks!

@kentcdodds kentcdodds merged commit 55106f8 into epicweb-dev:main Sep 8, 2023
5 checks passed
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.

2 participants