replace trailing dashes for org slugs
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 46s

This commit is contained in:
Braydon 2024-09-19 01:05:37 -04:00
parent dca15516db
commit 25485db0a5

@ -70,9 +70,16 @@ public final class OrganizationService {
throw new BadRequestException(Error.ORG_NAME_TAKEN); throw new BadRequestException(Error.ORG_NAME_TAKEN);
} }
// Create the org and return it // Create the org and return it
slug = slug.trim().replaceAll("-+$", ""); // Trim slug trailing dashes
return orgRepository.save(new Organization(snowflakeService.generateSnowflake(), name, slug, null, owner.getSnowflake())); return orgRepository.save(new Organization(snowflakeService.generateSnowflake(), name, slug, null, owner.getSnowflake()));
} }
/**
* Get the organizations of the
* currently authenticated user.
*
* @return the organizations
*/
@NonNull @NonNull
public List<DetailedOrganization> getOrganizations() { public List<DetailedOrganization> getOrganizations() {
User user = authService.getAuthenticatedUser(); User user = authService.getAuthenticatedUser();