refactor: remove unused mount-related logic from postgres router

- Removed the findMountsByApplicationId and updateMount functions from the postgres router as they are no longer needed after the recent refactor of the getMountPath function.
- Cleaned up the code to streamline the update process for PostgreSQL instances.
This commit is contained in:
Mauricio Siu
2025-11-26 01:21:56 -05:00
parent 23b235303c
commit 736a7320d4

View File

@@ -6,7 +6,6 @@ import {
deployPostgres,
findBackupsByDbId,
findEnvironmentById,
findMountsByApplicationId,
findPostgresById,
findProjectById,
getMountPath,
@@ -18,7 +17,6 @@ import {
startServiceRemote,
stopService,
stopServiceRemote,
updateMount,
updatePostgresById,
} from "@dokploy/server";
import { TRPCError } from "@trpc/server";
@@ -370,24 +368,6 @@ export const postgresRouter = createTRPCRouter({
});
}
if (rest.dockerImage) {
const mountPath = getMountPath(rest.dockerImage);
const mounts = await findMountsByApplicationId(postgresId, "postgres");
if (!mounts || mounts.length === 0) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Mount not found for this Postgres",
});
}
for (const mount of mounts) {
if (mount.mountPath.startsWith("/var/lib/postgresql")) {
await updateMount(mount.mountId, {
mountPath: mountPath,
});
}
}
}
const service = await updatePostgresById(postgresId, {
...rest,
});