fix(uns): reject tag create on non-existent equipment + narrow JSON catch (review)

This commit is contained in:
Joseph Doherty
2026-06-08 13:06:45 -04:00
parent 5a392c5db0
commit 77024f87da
2 changed files with 21 additions and 1 deletions
@@ -523,6 +523,9 @@ public sealed class UnsTreeService(IDbContextFactory<OtOpcUaConfigDbContext> dbF
return new UnsMutationResult(false, "TagConfig is not valid JSON.");
}
if (!await db.Equipment.AnyAsync(e => e.EquipmentId == equipmentId, ct))
return new UnsMutationResult(false, $"Equipment '{equipmentId}' not found.");
var equipmentCluster = await ResolveEquipmentClusterAsync(db, equipmentId, ct);
var guard = await CheckTagDriverGuardAsync(db, input.DriverInstanceId, equipmentCluster, ct);
if (guard is not null)
@@ -648,7 +651,7 @@ public sealed class UnsTreeService(IDbContextFactory<OtOpcUaConfigDbContext> dbF
using var _ = System.Text.Json.JsonDocument.Parse(json);
return true;
}
catch
catch (System.Text.Json.JsonException)
{
return false;
}