mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-21 05:45:23 +02:00
refactor: restructure application and rollback context to encapsulate project within environment, improving data organization and clarity across services
This commit is contained in:
@@ -20,7 +20,11 @@ export default async function handler(
|
|||||||
const application = await db.query.applications.findFirst({
|
const application = await db.query.applications.findFirst({
|
||||||
where: eq(applications.refreshToken, refreshToken as string),
|
where: eq(applications.refreshToken, refreshToken as string),
|
||||||
with: {
|
with: {
|
||||||
project: true,
|
environment: {
|
||||||
|
with: {
|
||||||
|
project: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
bitbucket: true,
|
bitbucket: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ export const rollbacks = pgTable("rollback", {
|
|||||||
.$defaultFn(() => new Date().toISOString()),
|
.$defaultFn(() => new Date().toISOString()),
|
||||||
fullContext: jsonb("fullContext").$type<
|
fullContext: jsonb("fullContext").$type<
|
||||||
Application & {
|
Application & {
|
||||||
project: Project;
|
environment: {
|
||||||
|
project: Project;
|
||||||
|
};
|
||||||
mounts: Mount[];
|
mounts: Mount[];
|
||||||
ports: Port[];
|
ports: Port[];
|
||||||
registry?: Registry | null;
|
registry?: Registry | null;
|
||||||
|
|||||||
@@ -179,7 +179,9 @@ const rollbackApplication = async (
|
|||||||
image: string,
|
image: string,
|
||||||
serverId?: string | null,
|
serverId?: string | null,
|
||||||
fullContext?: Application & {
|
fullContext?: Application & {
|
||||||
project: Project;
|
environment: {
|
||||||
|
project: Project;
|
||||||
|
};
|
||||||
mounts: Mount[];
|
mounts: Mount[];
|
||||||
ports: Port[];
|
ports: Port[];
|
||||||
},
|
},
|
||||||
@@ -225,7 +227,7 @@ const rollbackApplication = async (
|
|||||||
const bindsMount = generateBindMounts(mounts);
|
const bindsMount = generateBindMounts(mounts);
|
||||||
const envVariables = prepareEnvironmentVariables(
|
const envVariables = prepareEnvironmentVariables(
|
||||||
env,
|
env,
|
||||||
fullContext.project.env,
|
fullContext.environment.project.env,
|
||||||
);
|
);
|
||||||
|
|
||||||
// For rollback, we use the provided image instead of calculating it
|
// For rollback, we use the provided image instead of calculating it
|
||||||
|
|||||||
Reference in New Issue
Block a user