mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-06 14:35:26 +02:00
feat: implement volume backup and restore functionalities
- Added backupVolume and restoreVolume functions to handle the backup and restoration of volume data. - Introduced a new index file to streamline exports for volume backup utilities. - Updated volume backup logic to include scheduling and improved user feedback during operations. - Refactored existing volume backup utilities for better organization and clarity.
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
import { db } from "../db";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import type { z } from "zod";
|
||||
import { scheduleBackup } from "../utils/backups/utils";
|
||||
|
||||
export const findVolumeBackupById = async (volumeBackupId: string) => {
|
||||
const volumeBackup = await db.query.volumeBackups.findFirst({
|
||||
@@ -39,7 +40,16 @@ export const createVolumeBackup = async (
|
||||
const newVolumeBackup = await db
|
||||
.insert(volumeBackups)
|
||||
.values(volumeBackup)
|
||||
.returning();
|
||||
.returning()
|
||||
.then((e) => e[0]);
|
||||
|
||||
await schedule({
|
||||
cronSchedule: backup.schedule,
|
||||
backupId: backup.backupId,
|
||||
type: "backup",
|
||||
});
|
||||
|
||||
scheduleBackup(backup);
|
||||
|
||||
return newVolumeBackup;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user