mirror of
https://github.com/andwati/dokploy.git
synced 2026-12-06 01:28:46 +00:00
Enhance backup functionality by introducing support for compose backups. Update backup schema to include serviceName and backupType fields. Modify related components to handle new backup types and integrate service selection for compose backups. Update API routes and database schema accordingly.
This commit is contained in:
@@ -82,6 +82,11 @@ export const backupRouter = createTRPCRouter({
|
||||
serverId = backup.mongo.serverId;
|
||||
} else if (databaseType === "mariadb" && backup.mariadb?.serverId) {
|
||||
serverId = backup.mariadb.serverId;
|
||||
} else if (
|
||||
backup.backupType === "compose" &&
|
||||
backup.compose?.serverId
|
||||
) {
|
||||
serverId = backup.compose.serverId;
|
||||
}
|
||||
const server = await findServerById(serverId);
|
||||
|
||||
@@ -232,6 +237,13 @@ export const backupRouter = createTRPCRouter({
|
||||
});
|
||||
}
|
||||
}),
|
||||
manualBackupCompose: protectedProcedure
|
||||
.input(apiFindOneBackup)
|
||||
.mutation(async ({ input }) => {
|
||||
// const backup = await findBackupById(input.backupId);
|
||||
// await runComposeBackup(backup);
|
||||
return true;
|
||||
}),
|
||||
manualBackupMongo: protectedProcedure
|
||||
.input(apiFindOneBackup)
|
||||
.mutation(async ({ input }) => {
|
||||
|
||||
@@ -723,4 +723,18 @@ export const composeRouter = createTRPCRouter({
|
||||
});
|
||||
}
|
||||
}),
|
||||
manualBackup: protectedProcedure
|
||||
.input(z.object({ composeId: z.string() }))
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
const compose = await findComposeById(input.composeId);
|
||||
if (compose.project.organizationId !== ctx.session.activeOrganizationId) {
|
||||
throw new TRPCError({
|
||||
code: "UNAUTHORIZED",
|
||||
message: "You are not authorized to backup this compose",
|
||||
});
|
||||
}
|
||||
await createBackup({
|
||||
composeId: compose.composeId,
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user