fix: Correzione salvataggio campo MappedDestinationField in KeyAssociations

- Aggiunto campo MappedDestinationField al modello KeyAssociation per tracciare il campo destinazione mappato alla chiave sorgente
- Creata migration AddMappedDestinationFieldToKeyAssociation per aggiungere la colonna al database
- Implementata logica di popolamento in CreateAssociationAsync e StartDataTransferOriginal per salvare il campo destinazione mappato
- Aggiornato SaveAssociationParallelAsync per includere MappedDestinationField nelle query SQL UPDATE e INSERT
- Corretti indici parametri nella query UPDATE (da {7-9} a {8-10}) per includere il nuovo campo
- Aggiunta visualizzazione campo nell'interfaccia KeyAssociations (tabella, dettagli, export CSV)
- Implementato controllo validazione per impedire trasferimenti se il campo chiave non è mappato
- Aggiunto logging diagnostico dettagliato per debug del mapping dei campi
- Aggiornato ScheduledProfileExecutionService per popolare MappedDestinationField nelle esecuzioni schedulate
- Rimosso file BackgroundServices.cs obsoleto
- Documentazione completa creata (4 markdown files)

Fixes: Campo MappedDestinationField rimaneva NULL perché le query SQL raw non includevano il nuovo campo
This commit is contained in:
2025-10-20 00:42:07 +02:00
parent 22c0a15b8e
commit 5d9b9756cf
19 changed files with 2433 additions and 48 deletions
+20 -1
View File
@@ -239,6 +239,7 @@
<th>Valore Chiave</th>
<th>Campo Sorgente</th>
<th>Campo Destinazione</th>
<th>Campo Mappato</th>
<th>Entità Destinazione</th>
<th>ID Destinazione</th>
<th>Credenziale</th>
@@ -262,6 +263,18 @@
<td>
<span class="badge bg-secondary">@association.DestinationKeyField</span>
</td>
<td>
@if (!string.IsNullOrEmpty(association.MappedDestinationField))
{
<span class="badge bg-primary">@association.MappedDestinationField</span>
}
else
{
<span class="text-muted">
<i class="fas fa-minus"></i> N/A
</span>
}
</td>
<td>
<strong>@association.DestinationEntity</strong>
</td>
@@ -540,9 +553,13 @@
info += $"Valore Chiave: {association.KeyValue}\n";
info += $"Campo Sorgente: {association.SourceKeyField}\n";
info += $"Campo Destinazione: {association.DestinationKeyField}\n";
if (!string.IsNullOrEmpty(association.MappedDestinationField))
info += $"Campo Mappato: {association.MappedDestinationField}\n";
info += $"Entità: {association.DestinationEntity}\n";
info += $"ID Destinazione: {association.DestinationId}\n";
info += $"Credenziale: {association.RestCredentialName}\n";
if (!string.IsNullOrEmpty(association.Data_Hash))
info += $"Hash Dati: {association.Data_Hash}\n";
info += $"Creata: {association.CreatedAt:dd/MM/yyyy HH:mm}\n";
if (association.UpdatedAt.HasValue)
info += $"Aggiornata: {association.UpdatedAt:dd/MM/yyyy HH:mm}\n";
@@ -650,12 +667,14 @@
{
try
{
var csv = "Valore Chiave,Campo Sorgente,Campo Destinazione,Entità Destinazione,ID Destinazione,Credenziale,Stato,Creata,Aggiornata,Verificata\n";
var csv = "Valore Chiave,Campo Sorgente,Campo Destinazione,Campo Mappato,Entità Destinazione,ID Destinazione,Credenziale,Hash Dati,Stato,Creata,Aggiornata,Verificata\n";
foreach (var association in filteredAssociations)
{
csv += $"\"{association.KeyValue}\",\"{association.SourceKeyField}\",\"{association.DestinationKeyField}\",";
csv += $"\"{association.MappedDestinationField ?? ""}\",";
csv += $"\"{association.DestinationEntity}\",\"{association.DestinationId}\",\"{association.RestCredentialName}\",";
csv += $"\"{association.Data_Hash ?? ""}\",";
csv += $"\"{(association.IsActive ? "Attiva" : "Disattivata")}\",\"{association.CreatedAt:dd/MM/yyyy HH:mm}\",";
csv += $"\"{(association.UpdatedAt?.ToString("dd/MM/yyyy HH:mm") ?? "")}\",";
csv += $"\"{(association.LastVerifiedAt?.ToString("dd/MM/yyyy HH:mm") ?? "")}\"\n";