mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-10 00:15:28 +02:00
feat: add restore volume backups component and integrate into show volume backups
- Introduced a new RestoreVolumeBackups component to facilitate the restoration of volume backups from selected files and destinations. - Integrated the RestoreVolumeBackups component into the ShowVolumeBackups component, enhancing user experience by providing direct access to restoration functionality. - Updated the restore-backup schema to include validation for destination and backup file selection, ensuring robust user input handling.
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
removeVolumeBackup,
|
||||
createVolumeBackup,
|
||||
runVolumeBackup,
|
||||
findDestinationById,
|
||||
} from "@dokploy/server";
|
||||
import {
|
||||
createVolumeBackupSchema,
|
||||
@@ -15,6 +16,8 @@ import { z } from "zod";
|
||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { restorePostgresBackup } from "@dokploy/server/utils/restore";
|
||||
import { observable } from "@trpc/server/observable";
|
||||
|
||||
export const volumeBackupsRouter = createTRPCRouter({
|
||||
list: protectedProcedure
|
||||
@@ -88,4 +91,29 @@ export const volumeBackupsRouter = createTRPCRouter({
|
||||
return false;
|
||||
}
|
||||
}),
|
||||
restoreVolumeBackupWithLogs: protectedProcedure
|
||||
.meta({
|
||||
openapi: {
|
||||
enabled: false,
|
||||
path: "/restore-volume-backup-with-logs",
|
||||
method: "POST",
|
||||
override: true,
|
||||
},
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
volumeBackupId: z.string().min(1),
|
||||
destinationId: z.string().min(1),
|
||||
volumeName: z.string().min(1),
|
||||
}),
|
||||
)
|
||||
.subscription(async ({ input }) => {
|
||||
const destination = await findDestinationById(input.destinationId);
|
||||
|
||||
return observable<string>((emit) => {
|
||||
// restorePostgresBackup(postgres, destination, input, (log) => {
|
||||
// emit.next(log);
|
||||
// });
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user