Add system for managing and scheduling data backups

Introduce a new backup management feature with automated scheduling, manual backups, and a dedicated interface for viewing backup status and details. This includes integrating `node-cron` for scheduling, updating the database schema to store backup information, and creating new routes and components for the backup manager.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/9xfbVBU
This commit is contained in:
michaelschal committed 2025-08-13 20:55:27 +00:00
1 parent bfc90053f0
commit fbeb36c04a
9 files changed
+131 -58

No files matched your search

+26 -4
View File
@@ -24,9 +24,13 @@ import { fr } from "date-fns/locale";
interface BackupFile {
id: string;
filename: string;
description: string | null;
size: number;
createdAt: string;
type: 'manual' | 'automatic';
createdBy: string;
tablesCount: number;
status: string;
backupType: string;
}
export default function BackupManager() {
@@ -118,6 +122,19 @@ export default function BackupManager() {
: <Badge variant="outline">Manuelle</Badge>;
};
const getStatusBadge = (status: string) => {
switch (status) {
case 'completed':
return <Badge className="bg-green-100 text-green-800">Terminé</Badge>;
case 'creating':
return <Badge className="bg-blue-100 text-blue-800">En cours</Badge>;
case 'failed':
return <Badge variant="destructive">Échec</Badge>;
default:
return <Badge variant="outline">{status}</Badge>;
}
};
if (!canManageBackups) {
return (
<div className="flex-1 flex items-center justify-center">
@@ -254,7 +271,7 @@ export default function BackupManager() {
>
<div className="flex items-center space-x-4">
<div className="flex items-center space-x-2">
{getTypeIcon(backup.type)}
{getTypeIcon(backup.backupType)}
<FileText className="w-5 h-5 text-gray-400" />
</div>
@@ -262,12 +279,17 @@ export default function BackupManager() {
<div className="font-medium text-gray-900">
{backup.filename}
</div>
<div className="text-sm text-gray-500 flex items-center space-x-4">
<div className="text-sm text-gray-500">
{backup.description || 'Sauvegarde de base de données'}
</div>
<div className="text-sm text-gray-500 flex items-center space-x-4 mt-1">
<span>
{format(new Date(backup.createdAt), 'dd/MM/yyyy à HH:mm', { locale: fr })}
</span>
<span>{formatFileSize(backup.size)}</span>
{getTypeBadge(backup.type)}
<span>{backup.tablesCount} tables</span>
{getTypeBadge(backup.backupType)}
{getStatusBadge(backup.status)}
</div>
</div>
</div>