Frontend gaps fill work. Testing fixes work. Auditing in progress.

This commit is contained in:
StellaOps Bot
2025-12-30 01:22:58 +02:00
parent 1dc4bcbf10
commit 7a5210e2aa
928 changed files with 183942 additions and 3941 deletions

View File

@@ -0,0 +1,83 @@
using Microsoft.EntityFrameworkCore;
using StellaOps.Integrations.Core;
namespace StellaOps.Integrations.Persistence;
/// <summary>
/// EF Core DbContext for Integration persistence.
/// </summary>
public sealed class IntegrationDbContext : DbContext
{
public IntegrationDbContext(DbContextOptions<IntegrationDbContext> options)
: base(options)
{
}
public DbSet<IntegrationEntity> Integrations => Set<IntegrationEntity>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<IntegrationEntity>(entity =>
{
entity.ToTable("integrations");
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Name).HasColumnName("name").HasMaxLength(256).IsRequired();
entity.Property(e => e.Description).HasColumnName("description").HasMaxLength(1024);
entity.Property(e => e.Type).HasColumnName("type").IsRequired();
entity.Property(e => e.Provider).HasColumnName("provider").IsRequired();
entity.Property(e => e.Status).HasColumnName("status").IsRequired();
entity.Property(e => e.Endpoint).HasColumnName("endpoint").HasMaxLength(2048).IsRequired();
entity.Property(e => e.AuthRefUri).HasColumnName("auth_ref_uri").HasMaxLength(1024);
entity.Property(e => e.OrganizationId).HasColumnName("organization_id").HasMaxLength(256);
entity.Property(e => e.ConfigJson).HasColumnName("config_json").HasColumnType("jsonb");
entity.Property(e => e.LastHealthStatus).HasColumnName("last_health_status");
entity.Property(e => e.LastHealthCheckAt).HasColumnName("last_health_check_at");
entity.Property(e => e.CreatedAt).HasColumnName("created_at").IsRequired();
entity.Property(e => e.UpdatedAt).HasColumnName("updated_at").IsRequired();
entity.Property(e => e.CreatedBy).HasColumnName("created_by").HasMaxLength(256);
entity.Property(e => e.UpdatedBy).HasColumnName("updated_by").HasMaxLength(256);
entity.Property(e => e.TenantId).HasColumnName("tenant_id").HasMaxLength(128);
entity.Property(e => e.TagsJson).HasColumnName("tags").HasColumnType("jsonb");
entity.Property(e => e.IsDeleted).HasColumnName("is_deleted").IsRequired();
entity.HasIndex(e => e.Type);
entity.HasIndex(e => e.Provider);
entity.HasIndex(e => e.Status);
entity.HasIndex(e => e.TenantId);
entity.HasIndex(e => new { e.TenantId, e.Name }).IsUnique().HasFilter("is_deleted = false");
});
}
}
/// <summary>
/// EF Core entity for Integration.
/// </summary>
public sealed class IntegrationEntity
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public IntegrationType Type { get; set; }
public IntegrationProvider Provider { get; set; }
public IntegrationStatus Status { get; set; }
public string Endpoint { get; set; } = string.Empty;
public string? AuthRefUri { get; set; }
public string? OrganizationId { get; set; }
public string? ConfigJson { get; set; }
public HealthStatus LastHealthStatus { get; set; }
public DateTimeOffset? LastHealthCheckAt { get; set; }
public DateTimeOffset CreatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }
public string? CreatedBy { get; set; }
public string? UpdatedBy { get; set; }
public string? TenantId { get; set; }
public string? TagsJson { get; set; }
public bool IsDeleted { get; set; }
}