fix(environment): prevent renaming of the default environment

- Updated the logic to disallow renaming the default environment while still allowing updates to its description and other properties.
- Adjusted error message for clarity when attempting to rename the default environment.
This commit is contained in:
Mauricio Siu
2025-12-12 10:14:03 -06:00
parent b499cefebc
commit b230687c8a

View File

@@ -256,10 +256,11 @@ export const environmentRouter = createTRPCRouter({
}
const currentEnvironment = await findEnvironmentById(environmentId);
if (currentEnvironment.isDefault) {
// Prevent renaming the default environment, but allow updating env and description
if (currentEnvironment.isDefault && updateData.name !== undefined) {
throw new TRPCError({
code: "BAD_REQUEST",
message: "You cannot update the default environment",
message: "You cannot rename the default environment",
});
}
if (