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

Tidy up role controller endpoints. #172

Merged
merged 4 commits into from
Feb 7, 2025
Merged

Tidy up role controller endpoints. #172

merged 4 commits into from
Feb 7, 2025

Conversation

plietar
Copy link
Member

@plietar plietar commented Jan 31, 2025

This renames the role endpoint from /role to /roles, bringing it inline with the existing /packets and /packetGroups.

This also removes the GET /roles/names endpoint, which was not being used anywhere, and which overlapped with the existing GET /roles/<name> which is used to get details about a particular role. Having both routes could cause issue is a role was named names.

This renames the role endpoint from `/role` to `/roles`, bringing it
inline with the existing `/packets` and `/packetGroups`.

This also removes the `GET /roles/names` endpoint, which was not being
used anywhere, and which overlapped with the existing
`GET /roles/<name>` which is used to get details about a particular
role. Having both routes could cause issue is a role was named `names`.
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.20%. Comparing base (c486e35) to head (69d7741).
Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
+ Coverage   97.18%   97.20%   +0.02%     
==========================================
  Files         149      149              
  Lines        1422     1433      +11     
  Branches      406      416      +10     
==========================================
+ Hits         1382     1393      +11     
  Misses         39       39              
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@EmmaLRussell EmmaLRussell left a comment

Choose a reason for hiding this comment

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

Great stuff, just one query.

@@ -26,8 +26,9 @@ interface DeleteUserOrRoleProps {
export const DeleteUserOrRole = ({ mutate, data: { name, type } }: DeleteUserOrRoleProps) => {
const onDelete = async (roleName: string) => {
try {
const endpoint = type === "role" ? "roles" : type;
Copy link
Contributor

Choose a reason for hiding this comment

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

This suggests we should maybe pluralise the user endpoints next!

Co-authored-by: Emma Russell <44669576+EmmaLRussell@users.noreply.github.com>
@plietar plietar merged commit a578848 into main Feb 7, 2025
6 checks passed
@plietar plietar deleted the roles-controller branch February 7, 2025 16:59
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