feat: add production/enabled flags to environments, drop status enum
Environments now have: - production (bool): prod vs non-prod resource allocation - enabled (bool): disabled blocks new deployments Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,4 +3,11 @@ package com.cameleer3.server.core.runtime;
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
public record Environment(UUID id, String slug, String displayName, EnvironmentStatus status, Instant createdAt) {}
|
||||
public record Environment(
|
||||
UUID id,
|
||||
String slug,
|
||||
String displayName,
|
||||
boolean production,
|
||||
boolean enabled,
|
||||
Instant createdAt
|
||||
) {}
|
||||
|
||||
@@ -8,8 +8,7 @@ public interface EnvironmentRepository {
|
||||
List<Environment> findAll();
|
||||
Optional<Environment> findById(UUID id);
|
||||
Optional<Environment> findBySlug(String slug);
|
||||
UUID create(String slug, String displayName);
|
||||
void updateDisplayName(UUID id, String displayName);
|
||||
void updateStatus(UUID id, EnvironmentStatus status);
|
||||
UUID create(String slug, String displayName, boolean production);
|
||||
void update(UUID id, String displayName, boolean production, boolean enabled);
|
||||
void delete(UUID id);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,16 @@ public class EnvironmentService {
|
||||
return repo.findBySlug(slug).orElseThrow(() -> new IllegalArgumentException("Environment not found: " + slug));
|
||||
}
|
||||
|
||||
public UUID create(String slug, String displayName) {
|
||||
public UUID create(String slug, String displayName, boolean production) {
|
||||
if (repo.findBySlug(slug).isPresent()) {
|
||||
throw new IllegalArgumentException("Environment with slug '" + slug + "' already exists");
|
||||
}
|
||||
return repo.create(slug, displayName);
|
||||
return repo.create(slug, displayName, production);
|
||||
}
|
||||
|
||||
public void update(UUID id, String displayName, boolean production, boolean enabled) {
|
||||
getById(id); // verify exists
|
||||
repo.update(id, displayName, production, enabled);
|
||||
}
|
||||
|
||||
public void delete(UUID id) {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
package com.cameleer3.server.core.runtime;
|
||||
|
||||
public enum EnvironmentStatus { ACTIVE, SUSPENDED }
|
||||
Reference in New Issue
Block a user