-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
feat: multi-workspace followup #4197
feat: multi-workspace followup #4197
Conversation
packages/twenty-front/src/modules/users/graphql/queries/getCurrentUser.ts
Outdated
Show resolved
Hide resolved
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.
Hey @AdityaPimpalkar, thank you for your PR. Great job! It was very interesting to review. I believe we are on the right path. However, I have added some comments. Please feel free to respond if you think I've missed anything. Cheers!
packages/twenty-server/src/core/user-workspace/user-workspace.entity.ts
Outdated
Show resolved
Hide resolved
...ges/twenty-server/src/database/typeorm/core/migrations/1708535112230-addBillingCoreTables.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/users/graphql/queries/getCurrentUser.ts
Outdated
Show resolved
Hide resolved
@AdityaPimpalkar Also, your tests are failing! |
packages/twenty-server/src/core/user-workspace/user-workspace.entity.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/core/user-workspace/user-workspace.entity.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/core/user-workspace/user-workspace.entity.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/core/user-workspace/user-workspace.entity.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/core/user-workspace/user-workspace.entity.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/core/user-workspace/user-workspace.service.ts
Outdated
Show resolved
Hide resolved
onDelete: 'CASCADE', | ||
}) | ||
workspaceUsers: UserWorkspace[]; | ||
|
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.
think the OneToMany with userWorkspace entities is missing, but we might not call that field users
as it is already taken for the OneToMany with user entities
Let's call it workspaceUsers
@@ -34,8 +34,8 @@ export class UserWorkspace { | |||
@Column() | |||
userId: string; | |||
|
|||
@Field(() => Workspace) | |||
@ManyToOne(() => Workspace, (workspace) => workspace.workspaceUsers, { | |||
@Field(() => Workspace, { nullable: true }) |
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.
think one migration is missing then
Thank you @AdityaPimpalkar! |
* Seed UserWorkspace for existing demo/dev users * add workspaces field to currentUser * new token generation endpoint for switching workspace * lint fix * include dependency * requested fixes * resolver test pass * changing defaultWorkspace and workspaceMember when switching workspaces * tests fix * requested changes * delete user/workspace edge case handled * after merge * requested changes * :wq! * workspace manytoone relation * lint fix / import fix * gql codegen * Fix migrations and generateJWT * migration fix * relations fix --------- Co-authored-by: martmull <martmull@hotmail.fr>
follow up PR for changes made in #4036
It implements -