refactor: enhance project and environment handling across components and services by replacing projectId with environmentId, improving context clarity and authorization checks

This commit is contained in:
Mauricio Siu
2025-09-01 23:10:37 -06:00
parent 3e7eff11cd
commit be9e19e708
25 changed files with 94 additions and 69 deletions

View File

@@ -4,6 +4,7 @@ import {
updateDeploymentStatus,
} from "@dokploy/server/services/deployment";
import type { Postgres } from "@dokploy/server/services/postgres";
import { findEnvironmentById } from "@dokploy/server/services/environment";
import { findProjectById } from "@dokploy/server/services/project";
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
import { execAsync, execAsyncRemote } from "../process/execAsync";
@@ -13,8 +14,9 @@ export const runPostgresBackup = async (
postgres: Postgres,
backup: BackupSchedule,
) => {
const { name, projectId } = postgres;
const project = await findProjectById(projectId);
const { name, environmentId } = postgres;
const environment = await findEnvironmentById(environmentId);
const project = await findProjectById(environment.projectId);
const deployment = await createDeploymentBackup({
backupId: backup.backupId,