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: Implement rename organization #2634

Merged
merged 5 commits into from
Feb 8, 2023

Conversation

Abobos
Copy link
Contributor

@Abobos Abobos commented Jan 28, 2023

What change does this PR introduce?

This PR introduce an endpoint to update the name of an organization

Why was this change needed?

It is the API endpoint needed to implement Rename Organization

Other information (Screenshots)

@ghost
Copy link

ghost commented Jan 28, 2023

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@Abobos Abobos force-pushed the feature/update-organisation branch 2 times, most recently from b58bace to 22f4c49 Compare January 28, 2023 18:46
@Abobos Abobos marked this pull request as ready for review January 28, 2023 18:56
@Abobos Abobos changed the title Implement update organization feat: Implement update organization Jan 28, 2023
@Abobos Abobos force-pushed the feature/update-organisation branch from 22f4c49 to d485e76 Compare January 28, 2023 19:08
Copy link
Contributor

@scopsy scopsy left a comment

Choose a reason for hiding this comment

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

Looks great! Added a few small comments here let me know what you think

@IsDefined()
public readonly id: string;

name: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

@Abobos due you think we should add here some maxLen for the organization name? Would use something permissive here, but maybe providing some limit will be a good idea to not break UI and etc...

Copy link
Contributor Author

@Abobos Abobos Jan 29, 2023

Choose a reason for hiding this comment

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

Could you throw more perspective?.. How would this break the UI if we don't limit it?

Copy link
Contributor

Choose a reason for hiding this comment

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

For example everywhere we show the organization name it can overflow (the settings dropdown, organization select) and maybe other places. This is quite and edge case to be honest. Really not a must.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@scopsy yes. this makes sense. done

@@ -154,4 +157,15 @@ export class OrganizationController {
})
);
}

@Put('/')
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the member role enum here:

  @Roles(MemberRoleEnum.ADMIN)

Copy link
Contributor Author

@Abobos Abobos Jan 29, 2023

Choose a reason for hiding this comment

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

Yes. we want to restrict the update to only members of an organisation with role admin?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes exactly 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@scopsy done

- Add update organization usecase, command
- Create a PUT endpoint to /organizations
- Add e2e test for updating the organization name
@Abobos Abobos force-pushed the feature/update-organisation branch from d485e76 to a5ada4e Compare January 31, 2023 07:07
- Restrict organization update to admin only
- Add a max length to the name field
@Abobos Abobos force-pushed the feature/update-organisation branch from a5ada4e to b9370b6 Compare January 31, 2023 07:09
- Change method name
- Change HTTP verb from PUT to PATCH
@Abobos Abobos changed the title feat: Implement update organization feat: Implement rename organization Feb 3, 2023
@Abobos Abobos force-pushed the feature/update-organisation branch from 9355ebe to 60eb79a Compare February 4, 2023 18:25
Copy link
Contributor

@scopsy scopsy left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@p-fernandez p-fernandez left a comment

Choose a reason for hiding this comment

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

🌟

@IsDefined()
public readonly id: string;

@MaxLength(50)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noticed this. I think it is better to not limit the max length because in the creation of organization we don't limit the length and it would be a misalignment. It is a good thing to have done that, but for now we can skip it until we commit to a decision to limit org name and implement it everywhere, also at database level. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

I tend to aggree that it should be better implemented across the board, was initially thinking we can only implement it here. Let me revert that rule

@scopsy scopsy merged commit edd8cb6 into novuhq:next Feb 8, 2023
@Abobos Abobos deleted the feature/update-organisation branch February 8, 2023 17:35
@Abobos Abobos restored the feature/update-organisation branch February 8, 2023 17:35
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.

None yet

3 participants