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

feat: multi-workspace followup #4197

Merged
merged 23 commits into from
Mar 4, 2024

Conversation

AdityaPimpalkar
Copy link
Contributor

follow up PR for changes made in #4036

It implements -

  1. Seed UserWorkspace for our demo and dev users (the one created by the workspace:seed:demo and workspace:seed:dev commands)
  2. Expose UserWorkspace as a field of currentUser
  3. Build an endpoint to get a jwt token for another workspace

Copy link
Contributor

@martmull martmull left a 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!

@charlesBochet
Copy link
Member

@AdityaPimpalkar Also, your tests are failing!

@AdityaPimpalkar AdityaPimpalkar changed the base branch from main to 0.2.2 March 1, 2024 15:17
@AdityaPimpalkar AdityaPimpalkar changed the base branch from 0.2.2 to main March 1, 2024 15:17
onDelete: 'CASCADE',
})
workspaceUsers: UserWorkspace[];

Copy link
Contributor

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 })
Copy link
Contributor

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

@charlesBochet charlesBochet merged commit 63d4034 into twentyhq:main Mar 4, 2024
12 checks passed
@charlesBochet
Copy link
Member

Thank you @AdityaPimpalkar!

arnavsaxena17 pushed a commit to arnavsaxena17/twenty that referenced this pull request Oct 6, 2024
* 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>
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.

3 participants