[Feature] Implementata schedulazione completa per file CSV/Excel
- Aggiunta validazione percorsi file prima del salvataggio profili - Implementati metodi di lettura file CSV e Excel per schedulazioni - Supporto doppia modalità: caricamento browser (preview) e percorso manuale (schedulazione) - Gestione completa deletion sync anche per file CSV/Excel - Rilevamento automatico separatori CSV (virgola, punto e virgola, tab, pipe) - Supporto formati Excel legacy (.xls) e moderni (.xlsx) - Abilitati profili file nella UI di schedulazione - Logging dettagliato per troubleshooting - Documentazione completa in CSV_SCHEDULING_IMPLEMENTATION.md - Aggiornati README.md e copilot-instructions.md con nuove feature - Rimosso testo 'TEST' dalla pagina di login
This commit was merged in pull request #5.
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Data_Coupler.Services;
|
||||
/// </summary>
|
||||
public interface IDataTransferService
|
||||
{
|
||||
Task<DataTransferResult> ExecuteProfileAsync(DataCouplerProfile profile, string? sourceDatabaseOverride = null, string? destinationDatabaseOverride = null);
|
||||
Task<DataTransferResult> ExecuteProfileAsync(DataCouplerProfile profile, string? sourceDatabaseOverride = null, string? destinationDatabaseOverride = null, bool enableDeletionSync = false);
|
||||
}
|
||||
|
||||
public class DataTransferResult
|
||||
@@ -37,7 +37,7 @@ public class DataTransferService : IDataTransferService
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public async Task<DataTransferResult> ExecuteProfileAsync(DataCouplerProfile profile, string? sourceDatabaseOverride = null, string? destinationDatabaseOverride = null)
|
||||
public async Task<DataTransferResult> ExecuteProfileAsync(DataCouplerProfile profile, string? sourceDatabaseOverride = null, string? destinationDatabaseOverride = null, bool enableDeletionSync = false)
|
||||
{
|
||||
var result = new DataTransferResult
|
||||
{
|
||||
@@ -59,21 +59,11 @@ public class DataTransferService : IDataTransferService
|
||||
return result;
|
||||
}
|
||||
|
||||
// Controlla se il profilo ha file come sorgente e blocca l'esecuzione
|
||||
if (profile.SourceType?.ToLower() == "file")
|
||||
{
|
||||
result.IsSuccess = false;
|
||||
result.ErrorMessage = "I profili con file come sorgente non sono supportati nelle schedulazioni per motivi di sicurezza.";
|
||||
result.EndTime = DateTime.Now; // Usa l'ora locale per coerenza
|
||||
_logger.LogWarning("Tentativo di esecuzione di profilo con file come sorgente bloccato: {ProfileName}", profile.Name);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Applica override del database se specificati
|
||||
var profileToExecute = await ApplyDatabaseOverrides(profile, sourceDatabaseOverride, destinationDatabaseOverride);
|
||||
|
||||
// Utilizza il servizio esistente per l'esecuzione
|
||||
var executionResult = await _scheduledExecutionService.ExecuteProfileAsync(profileToExecute.Id);
|
||||
var executionResult = await _scheduledExecutionService.ExecuteProfileAsync(profileToExecute.Id, enableDeletionSync);
|
||||
|
||||
result.IsSuccess = executionResult.Success;
|
||||
result.RecordsProcessed = executionResult.RecordsProcessed;
|
||||
@@ -175,7 +165,8 @@ public class DataTransferService : IDataTransferService
|
||||
if (string.IsNullOrEmpty(profile.DestinationType))
|
||||
return (false, "Tipo destinazione non specificato");
|
||||
|
||||
if (!profile.SourceCredentialId.HasValue)
|
||||
// Per le sorgenti file, la credenziale non è richiesta
|
||||
if (profile.SourceType != "file" && !profile.SourceCredentialId.HasValue)
|
||||
return (false, "Credenziale sorgente non specificata");
|
||||
|
||||
if (!profile.DestinationCredentialId.HasValue)
|
||||
|
||||
Reference in New Issue
Block a user