mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-27 14:08:46 +00:00
fix(environment): prevent deletion of the default environment
- Added logic to disallow deletion of the default environment, throwing a BAD_REQUEST error if an attempt is made to delete it.
This commit is contained in:
@@ -208,6 +208,14 @@ export const environmentRouter = createTRPCRouter({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent deletion of the default environment
|
||||||
|
if (environment.isDefault) {
|
||||||
|
throw new TRPCError({
|
||||||
|
code: "BAD_REQUEST",
|
||||||
|
message: "You cannot delete the default environment",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Check environment deletion permission
|
// Check environment deletion permission
|
||||||
await checkEnvironmentDeletionPermission(
|
await checkEnvironmentDeletionPermission(
|
||||||
ctx.user.id,
|
ctx.user.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user