mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-19 21:18:25 +02:00
3 files changed
+384
-338
No files matched your search
@@ -1,21 +1,21 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogDescription
|
DialogDescription
|
||||||
} from "@/components/ui/dialog";
|
} from "@/components/ui/dialog";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import {
|
import {
|
||||||
AlertTriangle,
|
AlertTriangle,
|
||||||
XCircle,
|
XCircle,
|
||||||
Clock,
|
Clock,
|
||||||
PackageX,
|
PackageX,
|
||||||
Eye,
|
Eye,
|
||||||
ArrowRight
|
ArrowRight
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useToast } from "@/hooks/use-toast";
|
import { useToast } from "@/hooks/use-toast";
|
||||||
import { apiRequest } from "@/lib/queryClient";
|
import { apiRequest } from "@/lib/queryClient";
|
||||||
@@ -73,7 +73,7 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
|
|
||||||
// Mutation to mark product as stock depleted
|
// Mutation to mark product as stock depleted
|
||||||
const markStockEpuiseMutation = useMutation({
|
const markStockEpuiseMutation = useMutation({
|
||||||
mutationFn: (productId: number) =>
|
mutationFn: (productId: number) =>
|
||||||
apiRequest(`/api/dlc-products/${productId}/stock-epuise`, "PUT"),
|
apiRequest(`/api/dlc-products/${productId}/stock-epuise`, "PUT"),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast({
|
toast({
|
||||||
@@ -82,6 +82,7 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
});
|
});
|
||||||
// Refresh DLC stats and products
|
// Refresh DLC stats and products
|
||||||
queryClient.invalidateQueries({ queryKey: ["/api/dlc-products"] });
|
queryClient.invalidateQueries({ queryKey: ["/api/dlc-products"] });
|
||||||
|
queryClient.invalidateQueries({ queryKey: ["/api/dlc-products/stats"] });
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
toast({
|
toast({
|
||||||
@@ -164,11 +165,11 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
Produits Expirés ({dlcStats.expired})
|
Produits Expirés ({dlcStats.expired})
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2 max-h-40 overflow-y-auto">
|
<div className="space-y-2 max-h-40 overflow-y-auto">
|
||||||
{expiredProducts.slice(0, 8).map((product) => (
|
{expiredProducts.slice(0, 8).map((product) => (
|
||||||
<div
|
<div
|
||||||
key={product.id}
|
key={product.id}
|
||||||
className="flex items-center justify-between p-3 bg-red-50 border border-red-200 rounded-lg"
|
className="flex items-center justify-between p-3 bg-red-50 border border-red-200 rounded-lg"
|
||||||
>
|
>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
@@ -177,7 +178,7 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
{product.supplier.name} • Expiré depuis {Math.abs(getDaysUntilExpiry(product.expiryDate))} jour(s)
|
{product.supplier.name} • Expiré depuis {Math.abs(getDaysUntilExpiry(product.expiryDate))} jour(s)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!product.stockEpuise && (
|
{!product.stockEpuise && (
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -191,7 +192,7 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
Stock épuisé
|
Stock épuisé
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{product.stockEpuise && (
|
{product.stockEpuise && (
|
||||||
<Badge variant="secondary" className="bg-yellow-100 text-yellow-800">
|
<Badge variant="secondary" className="bg-yellow-100 text-yellow-800">
|
||||||
Stock épuisé
|
Stock épuisé
|
||||||
@@ -199,7 +200,7 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{expiredProducts.length > 8 && (
|
{expiredProducts.length > 8 && (
|
||||||
<div className="text-sm text-gray-600 text-center py-2">
|
<div className="text-sm text-gray-600 text-center py-2">
|
||||||
et {expiredProducts.length - 8} autre(s) produit(s) expiré(s)...
|
et {expiredProducts.length - 8} autre(s) produit(s) expiré(s)...
|
||||||
@@ -218,13 +219,13 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
Expirent Bientôt ({dlcStats.expiringSoon})
|
Expirent Bientôt ({dlcStats.expiringSoon})
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2 max-h-40 overflow-y-auto">
|
<div className="space-y-2 max-h-40 overflow-y-auto">
|
||||||
{expiringSoonProducts.slice(0, 8).map((product) => {
|
{expiringSoonProducts.slice(0, 8).map((product) => {
|
||||||
const daysLeft = getDaysUntilExpiry(product.expiryDate);
|
const daysLeft = getDaysUntilExpiry(product.expiryDate);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={product.id}
|
key={product.id}
|
||||||
className="flex items-center justify-between p-3 bg-orange-50 border border-orange-200 rounded-lg"
|
className="flex items-center justify-between p-3 bg-orange-50 border border-orange-200 rounded-lg"
|
||||||
>
|
>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
@@ -233,9 +234,9 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
{product.supplier.name} • Expire dans {daysLeft} jour(s)
|
{product.supplier.name} • Expire dans {daysLeft} jour(s)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Badge
|
<Badge
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className={`
|
className={`
|
||||||
${daysLeft <= 3 ? 'border-red-300 text-red-700 bg-red-50' : 'border-orange-300 text-orange-700 bg-orange-50'}
|
${daysLeft <= 3 ? 'border-red-300 text-red-700 bg-red-50' : 'border-orange-300 text-orange-700 bg-orange-50'}
|
||||||
`}
|
`}
|
||||||
@@ -245,7 +246,7 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
{expiringSoonProducts.length > 8 && (
|
{expiringSoonProducts.length > 8 && (
|
||||||
<div className="text-sm text-gray-600 text-center py-2">
|
<div className="text-sm text-gray-600 text-center py-2">
|
||||||
et {expiringSoonProducts.length - 8} autre(s) produit(s) expirant bientôt...
|
et {expiringSoonProducts.length - 8} autre(s) produit(s) expirant bientôt...
|
||||||
@@ -258,7 +259,7 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
|
|
||||||
{/* Action Buttons */}
|
{/* Action Buttons */}
|
||||||
<div className="flex flex-col sm:flex-row gap-3 pt-4 border-t">
|
<div className="flex flex-col sm:flex-row gap-3 pt-4 border-t">
|
||||||
<Button
|
<Button
|
||||||
onClick={handleViewDlcModule}
|
onClick={handleViewDlcModule}
|
||||||
className="flex-1 bg-blue-600 hover:bg-blue-700"
|
className="flex-1 bg-blue-600 hover:bg-blue-700"
|
||||||
data-testid="button-view-dlc-module"
|
data-testid="button-view-dlc-module"
|
||||||
@@ -267,9 +268,9 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
Voir tous les produits DLC
|
Voir tous les produits DLC
|
||||||
<ArrowRight className="h-4 w-4 ml-2" />
|
<ArrowRight className="h-4 w-4 ml-2" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={handleSnooze}
|
onClick={handleSnooze}
|
||||||
className="flex-1"
|
className="flex-1"
|
||||||
data-testid="button-snooze-alert"
|
data-testid="button-snooze-alert"
|
||||||
@@ -281,7 +282,7 @@ export function DlcAlertModal({ isOpen, onClose, dlcStats, selectedStoreId }: Dl
|
|||||||
|
|
||||||
{/* Help Text */}
|
{/* Help Text */}
|
||||||
<div className="text-xs text-gray-500 bg-gray-50 p-3 rounded">
|
<div className="text-xs text-gray-500 bg-gray-50 p-3 rounded">
|
||||||
💡 <strong>Conseil :</strong> Ce modal réapparaîtra tant que les produits ne sont pas traités.
|
💡 <strong>Conseil :</strong> Ce modal réapparaîtra tant que les produits ne sont pas traités.
|
||||||
Marquez les produits comme "stock épuisé" ou traitez-les dans le module DLC pour faire disparaître l'alerte.
|
Marquez les produits comme "stock épuisé" ou traitez-les dans le module DLC pour faire disparaître l'alerte.
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
+64
-23
@@ -5,7 +5,7 @@ import path from 'path';
|
|||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import { eq, desc } from "drizzle-orm";
|
import { eq, desc } from "drizzle-orm";
|
||||||
import { db } from "./db";
|
import { db } from "./db";
|
||||||
import { databaseBackups, utilities } from "@shared/schema";
|
import { databaseBackups, utilities, users } from "@shared/schema";
|
||||||
import type { DatabaseBackup, InsertDatabaseBackup } from "@shared/schema";
|
import type { DatabaseBackup, InsertDatabaseBackup } from "@shared/schema";
|
||||||
|
|
||||||
const execAsync = promisify(exec);
|
const execAsync = promisify(exec);
|
||||||
@@ -18,10 +18,10 @@ export class BackupService {
|
|||||||
constructor() {
|
constructor() {
|
||||||
// Use /app/backups in production (with proper permissions), or use env variable
|
// Use /app/backups in production (with proper permissions), or use env variable
|
||||||
const isProduction = process.env.NODE_ENV === 'production';
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
this.backupDir = isProduction
|
this.backupDir = isProduction
|
||||||
? process.env.BACKUP_DIR || '/app/backups'
|
? process.env.BACKUP_DIR || '/app/backups'
|
||||||
: path.join(process.cwd(), 'backups');
|
: path.join(process.cwd(), 'backups');
|
||||||
|
|
||||||
this.ensureBackupDirectory();
|
this.ensureBackupDirectory();
|
||||||
this.scheduleAutomaticBackup();
|
this.scheduleAutomaticBackup();
|
||||||
}
|
}
|
||||||
@@ -70,6 +70,31 @@ export class BackupService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve a valid user ID for system-initiated backups.
|
||||||
|
* Returns the first admin user ID, or the first user if no admin exists.
|
||||||
|
* This avoids FK violations on database_backups.created_by -> users.id.
|
||||||
|
*/
|
||||||
|
private async resolveSystemUserId(): Promise<string | null> {
|
||||||
|
try {
|
||||||
|
// Try to find an admin user first
|
||||||
|
const [adminUser] = await db.select({ id: users.id })
|
||||||
|
.from(users)
|
||||||
|
.where(eq(users.role, 'admin'))
|
||||||
|
.limit(1);
|
||||||
|
if (adminUser) return adminUser.id;
|
||||||
|
|
||||||
|
// Fallback: any existing user
|
||||||
|
const [anyUser] = await db.select({ id: users.id })
|
||||||
|
.from(users)
|
||||||
|
.limit(1);
|
||||||
|
return anyUser?.id ?? null;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ Failed to resolve system user ID for backup:', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createBackup(type: 'manual' | 'automatic' = 'manual', createdBy: string = 'system'): Promise<DatabaseBackup> {
|
async createBackup(type: 'manual' | 'automatic' = 'manual', createdBy: string = 'system'): Promise<DatabaseBackup> {
|
||||||
try {
|
try {
|
||||||
const id = nanoid();
|
const id = nanoid();
|
||||||
@@ -90,7 +115,7 @@ export class BackupService {
|
|||||||
}).returning();
|
}).returning();
|
||||||
|
|
||||||
const dbConfig = this.getDatabaseConfig();
|
const dbConfig = this.getDatabaseConfig();
|
||||||
|
|
||||||
// Set environment variable for password to avoid prompt
|
// Set environment variable for password to avoid prompt
|
||||||
const env = {
|
const env = {
|
||||||
...process.env,
|
...process.env,
|
||||||
@@ -101,14 +126,14 @@ export class BackupService {
|
|||||||
const command = `pg_dump -h ${dbConfig.host} -p ${dbConfig.port} -U ${dbConfig.username} -d ${dbConfig.database} --no-password --verbose --clean --if-exists --create > "${filepath}"`;
|
const command = `pg_dump -h ${dbConfig.host} -p ${dbConfig.port} -U ${dbConfig.username} -d ${dbConfig.database} --no-password --verbose --clean --if-exists --create > "${filepath}"`;
|
||||||
|
|
||||||
console.log(`🔄 Starting ${type} backup...`);
|
console.log(`🔄 Starting ${type} backup...`);
|
||||||
|
|
||||||
await execAsync(command, { env });
|
await execAsync(command, { env });
|
||||||
|
|
||||||
// Get file stats and count tables
|
// Get file stats and count tables
|
||||||
const stats = fs.statSync(filepath);
|
const stats = fs.statSync(filepath);
|
||||||
const sqlContent = fs.readFileSync(filepath, 'utf8');
|
const sqlContent = fs.readFileSync(filepath, 'utf8');
|
||||||
const tablesCount = (sqlContent.match(/CREATE TABLE/g) || []).length;
|
const tablesCount = (sqlContent.match(/CREATE TABLE/g) || []).length;
|
||||||
|
|
||||||
// Update database record with completion details
|
// Update database record with completion details
|
||||||
const [updatedBackup] = await db.update(databaseBackups)
|
const [updatedBackup] = await db.update(databaseBackups)
|
||||||
.set({
|
.set({
|
||||||
@@ -176,7 +201,7 @@ export class BackupService {
|
|||||||
|
|
||||||
async downloadBackup(filename: string): Promise<string> {
|
async downloadBackup(filename: string): Promise<string> {
|
||||||
const filepath = path.join(this.backupDir, filename);
|
const filepath = path.join(this.backupDir, filename);
|
||||||
|
|
||||||
if (!fs.existsSync(filepath)) {
|
if (!fs.existsSync(filepath)) {
|
||||||
throw new Error('Backup file not found');
|
throw new Error('Backup file not found');
|
||||||
}
|
}
|
||||||
@@ -189,14 +214,14 @@ export class BackupService {
|
|||||||
const allBackups = await db.select()
|
const allBackups = await db.select()
|
||||||
.from(databaseBackups)
|
.from(databaseBackups)
|
||||||
.orderBy(desc(databaseBackups.createdAt));
|
.orderBy(desc(databaseBackups.createdAt));
|
||||||
|
|
||||||
if (allBackups.length > this.maxBackups) {
|
if (allBackups.length > this.maxBackups) {
|
||||||
const toDelete = allBackups.slice(this.maxBackups);
|
const toDelete = allBackups.slice(this.maxBackups);
|
||||||
|
|
||||||
for (const backup of toDelete) {
|
for (const backup of toDelete) {
|
||||||
await this.deleteBackup(backup.filename);
|
await this.deleteBackup(backup.filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`🧹 Cleaned ${toDelete.length} old backup(s)`);
|
console.log(`🧹 Cleaned ${toDelete.length} old backup(s)`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -218,7 +243,7 @@ export class BackupService {
|
|||||||
const [config] = await db.select()
|
const [config] = await db.select()
|
||||||
.from(utilities)
|
.from(utilities)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
|
||||||
// Si les backups automatiques sont désactivés, ne rien faire
|
// Si les backups automatiques sont désactivés, ne rien faire
|
||||||
if (config && config.automaticBackupsEnabled === false) {
|
if (config && config.automaticBackupsEnabled === false) {
|
||||||
console.log('ℹ️ Sauvegardes automatiques désactivées - Aucune action effectuée');
|
console.log('ℹ️ Sauvegardes automatiques désactivées - Aucune action effectuée');
|
||||||
@@ -227,9 +252,9 @@ export class BackupService {
|
|||||||
message: 'Sauvegardes automatiques désactivées'
|
message: 'Sauvegardes automatiques désactivées'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const today = new Date().toISOString().split('T')[0]; // Format YYYY-MM-DD
|
const today = new Date().toISOString().split('T')[0]; // Format YYYY-MM-DD
|
||||||
|
|
||||||
// Vérifier s'il y a déjà une sauvegarde automatique aujourd'hui
|
// Vérifier s'il y a déjà une sauvegarde automatique aujourd'hui
|
||||||
const existingBackupToday = await db.select()
|
const existingBackupToday = await db.select()
|
||||||
.from(databaseBackups)
|
.from(databaseBackups)
|
||||||
@@ -239,11 +264,21 @@ export class BackupService {
|
|||||||
|
|
||||||
const lastBackup = existingBackupToday[0];
|
const lastBackup = existingBackupToday[0];
|
||||||
const lastBackupDate = lastBackup ? lastBackup.createdAt.toISOString().split('T')[0] : null;
|
const lastBackupDate = lastBackup ? lastBackup.createdAt.toISOString().split('T')[0] : null;
|
||||||
|
|
||||||
// Si aucune sauvegarde automatique aujourd'hui, en créer une
|
// Only perform backup if no automatic backup exists for today
|
||||||
if (lastBackupDate !== today) {
|
if (lastBackupDate !== today) {
|
||||||
|
// Resolve a real user ID if called with default 'system'
|
||||||
|
let resolvedUserId = userId;
|
||||||
|
if (userId === 'system') {
|
||||||
|
const systemId = await this.resolveSystemUserId();
|
||||||
|
if (!systemId) {
|
||||||
|
console.warn('⚠️ No user found in database — skipping daily backup');
|
||||||
|
return { backupPerformed: false, message: 'Aucun utilisateur trouvé pour la sauvegarde' };
|
||||||
|
}
|
||||||
|
resolvedUserId = systemId;
|
||||||
|
}
|
||||||
console.log('🔄 Première connexion du jour - Création de la sauvegarde automatique...');
|
console.log('🔄 Première connexion du jour - Création de la sauvegarde automatique...');
|
||||||
await this.createBackup('automatic', userId);
|
await this.createBackup('automatic', resolvedUserId);
|
||||||
console.log('✅ Sauvegarde quotidienne effectuée avec succès');
|
console.log('✅ Sauvegarde quotidienne effectuée avec succès');
|
||||||
return {
|
return {
|
||||||
backupPerformed: true,
|
backupPerformed: true,
|
||||||
@@ -273,15 +308,15 @@ export class BackupService {
|
|||||||
const [config] = await db.select()
|
const [config] = await db.select()
|
||||||
.from(utilities)
|
.from(utilities)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
|
||||||
// Si les backups automatiques sont désactivés, ne rien faire
|
// Si les backups automatiques sont désactivés, ne rien faire
|
||||||
if (config && config.automaticBackupsEnabled === false) {
|
if (config && config.automaticBackupsEnabled === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const today = now.toISOString().split('T')[0]; // YYYY-MM-DD format
|
const today = now.toISOString().split('T')[0]; // YYYY-MM-DD format
|
||||||
|
|
||||||
// Only run automatic backup if:
|
// Only run automatic backup if:
|
||||||
// 1. It's after 2:00 AM
|
// 1. It's after 2:00 AM
|
||||||
// 2. We haven't done an automatic backup today yet
|
// 2. We haven't done an automatic backup today yet
|
||||||
@@ -295,11 +330,17 @@ export class BackupService {
|
|||||||
|
|
||||||
const lastBackup = existingBackupToday[0];
|
const lastBackup = existingBackupToday[0];
|
||||||
const lastBackupDate = lastBackup ? lastBackup.createdAt.toISOString().split('T')[0] : null;
|
const lastBackupDate = lastBackup ? lastBackup.createdAt.toISOString().split('T')[0] : null;
|
||||||
|
|
||||||
// Only proceed if no automatic backup exists for today
|
// Only proceed if no automatic backup exists for today
|
||||||
if (lastBackupDate !== today) {
|
if (lastBackupDate !== today) {
|
||||||
|
// Resolve a real user ID to satisfy FK constraint
|
||||||
|
const systemUserId = await this.resolveSystemUserId();
|
||||||
|
if (!systemUserId) {
|
||||||
|
console.warn('⚠️ No user found in database — skipping automatic backup');
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log('🔄 Starting automatic backup...');
|
console.log('🔄 Starting automatic backup...');
|
||||||
await this.createBackup('automatic', 'system');
|
await this.createBackup('automatic', systemUserId);
|
||||||
this.lastAutomaticBackupDate = today;
|
this.lastAutomaticBackupDate = today;
|
||||||
console.log('✅ Automatic backup completed');
|
console.log('✅ Automatic backup completed');
|
||||||
}
|
}
|
||||||
@@ -311,10 +352,10 @@ export class BackupService {
|
|||||||
|
|
||||||
// Initial check
|
// Initial check
|
||||||
checkBackupNeeded();
|
checkBackupNeeded();
|
||||||
|
|
||||||
// Check every hour (3600000 ms)
|
// Check every hour (3600000 ms)
|
||||||
setInterval(checkBackupNeeded, 3600000);
|
setInterval(checkBackupNeeded, 3600000);
|
||||||
|
|
||||||
console.log('⏰ Automatic backup scheduled for daily 2:00 AM+ (native timer)');
|
console.log('⏰ Automatic backup scheduled for daily 2:00 AM+ (native timer)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+288
-284
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user