1eb6e972b0
Bulk CommentChecker pass: fills in <param>/<inheritdoc> tags on public APIs across all 23 src/ projects so the doc-coverage gate is green. Also adds a Sister Projects section to CLAUDE.md pointing at the MxAccess Gateway and OtOpcUa sibling repos, and gitignores local credential captures (*login*.txt) and the wonder-app-vd03 deploy/ artifacts.
58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using ScadaLink.Commons.Entities.InboundApi;
|
|
|
|
namespace ScadaLink.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();
|
|
}
|
|
}
|