refactor: enhance environment selector with service presence checks and alert notifications; update navigation links to include environment context for improved user experience

This commit is contained in:
Mauricio Siu
2025-09-01 21:18:56 -06:00
parent 59cbc8ee0d
commit 1a9f131d39
12 changed files with 28 additions and 17 deletions

View File

@@ -62,13 +62,21 @@ export const findEnvironmentsByProjectId = async (projectId: string) => {
};
export const deleteEnvironment = async (environmentId: string) => {
const environment = await db
const currentEnvironment = await findEnvironmentById(environmentId);
if (currentEnvironment.name === "production") {
throw new TRPCError({
code: "BAD_REQUEST",
message: "You cannot delete the production environment",
});
}
const deletedEnvironment = await db
.delete(environments)
.where(eq(environments.environmentId, environmentId))
.returning()
.then((value) => value[0]);
return environment;
return deletedEnvironment;
};
export const updateEnvironmentById = async (