fix: use valid STARTER tier in onboarding tenant creation
All checks were successful
CI / build (push) Successful in 2m17s
CI / docker (push) Successful in 1m16s

OnboardingService passed "LOW" as the tier, but the Tier enum only has
STARTER/TEAM/BUSINESS/ENTERPRISE. Tier.valueOf("LOW") threw
IllegalArgumentException, which the controller caught as a blanket 409
Conflict — masking the real cause. Also catch IllegalStateException
(user already has a tenant) to return 409 instead of 500.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-26 21:17:23 +02:00
parent 088bc34e67
commit d7ef2c488b
2 changed files with 4 additions and 2 deletions

View File

@@ -58,7 +58,9 @@ public class OnboardingController {
TenantEntity tenant = onboardingService.createTrialTenant(request.name(), request.slug(), userId);
return ResponseEntity.status(HttpStatus.CREATED).body(TenantResponse.from(tenant));
} catch (IllegalArgumentException e) {
return ResponseEntity.status(HttpStatus.CONFLICT).build();
return ResponseEntity.status(HttpStatus.CONFLICT).body(null);
} catch (IllegalStateException e) {
return ResponseEntity.status(HttpStatus.CONFLICT).body(null);
}
}
}

View File

@@ -41,7 +41,7 @@ public class OnboardingService {
// Create tenant via the existing vendor flow (no admin user — we'll add the caller)
UUID actorId = resolveActorId(logtoUserId);
var request = new CreateTenantRequest(name, slug, "LOW", null, null);
var request = new CreateTenantRequest(name, slug, "STARTER", null, null);
TenantEntity tenant = vendorTenantService.createAndProvision(request, actorId);
// Add the calling user to the Logto org as owner