7b0b9c7365
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Entities.InboundApi;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Configurations;
|
|
|
|
public class ApiKeyConfiguration : IEntityTypeConfiguration<ApiKey>
|
|
{
|
|
/// <summary>Configures the EF Core mapping for the <see cref="ApiKey"/> entity.</summary>
|
|
/// <param name="builder">Entity type builder used to apply the configuration.</param>
|
|
public void Configure(EntityTypeBuilder<ApiKey> builder)
|
|
{
|
|
builder.HasKey(k => k.Id);
|
|
|
|
builder.Property(k => k.Name)
|
|
.IsRequired()
|
|
.HasMaxLength(200);
|
|
|
|
// ConfigurationDatabase-012: the bearer credential is persisted only as a
|
|
// deterministic HMAC-SHA256 hash, never as plaintext. Base64 of a 32-byte
|
|
// HMAC-SHA256 digest is 44 characters; 256 leaves generous headroom.
|
|
builder.Property(k => k.KeyHash)
|
|
.IsRequired()
|
|
.HasMaxLength(256);
|
|
|
|
builder.HasIndex(k => k.Name).IsUnique();
|
|
builder.HasIndex(k => k.KeyHash).IsUnique();
|
|
}
|
|
}
|
|
|
|
public class ApiMethodConfiguration : IEntityTypeConfiguration<ApiMethod>
|
|
{
|
|
/// <summary>Configures the EF Core mapping for the <see cref="ApiMethod"/> entity.</summary>
|
|
/// <param name="builder">Entity type builder used to apply the configuration.</param>
|
|
public void Configure(EntityTypeBuilder<ApiMethod> builder)
|
|
{
|
|
builder.HasKey(m => m.Id);
|
|
|
|
builder.Property(m => m.Name)
|
|
.IsRequired()
|
|
.HasMaxLength(200);
|
|
|
|
builder.Property(m => m.Script)
|
|
.IsRequired();
|
|
|
|
builder.Property(m => m.ApprovedApiKeyIds)
|
|
.HasMaxLength(4000);
|
|
|
|
builder.Property(m => m.ParameterDefinitions)
|
|
.HasMaxLength(4000);
|
|
|
|
builder.Property(m => m.ReturnDefinition)
|
|
.HasMaxLength(4000);
|
|
|
|
builder.HasIndex(m => m.Name).IsUnique();
|
|
}
|
|
}
|