Add complete camera discovery and stream testing specification, Domain entities, enums, DTOs, Application interfaces, and EF Core configurations for automated ONVIF/mDNS/HTTP/ARP camera detection. - 4 new enums: CameraDiscoveryMethod, DetectedCameraType, StreamProtocol, CameraCapability (flags) - Camera entity extended with 15+ discovery/test fields - New entities: CameraDiscoveryResult, DiscoveredStreamUrl - DTOs: ProbeRequest/Response, StreamTestRequest/Session, etc. - Interface: ICameraDiscoveryService (8 methods) - EF Core configurations for all new tables + columns - Full spec doc: docs/specifications/detection-camera.md (16 sections) - 145 tests pass, 0 warnings Inspiré de Strix (github.com/eduard256/Strix) — moteur de découverte de flux IP supportant 3600+ marques, 100K+ patterns.
107 lines
3.8 KiB
C#
107 lines
3.8 KiB
C#
using Heimdall.Domain.Entities;
|
|
using Heimdall.Domain.Enums;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Heimdall.Infrastructure.Data.Configurations;
|
|
|
|
public class CameraDiscoveryResultConfiguration : IEntityTypeConfiguration<CameraDiscoveryResult>
|
|
{
|
|
public void Configure(EntityTypeBuilder<CameraDiscoveryResult> builder)
|
|
{
|
|
builder.ToTable("camera_discovery_results");
|
|
|
|
builder.HasKey(r => r.Id);
|
|
|
|
// ── Identification ──────────────────────────────────────────
|
|
builder.Property(r => r.IpAddress)
|
|
.HasMaxLength(45)
|
|
.IsRequired()
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.MacAddress)
|
|
.HasMaxLength(17)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.Vendor)
|
|
.HasMaxLength(100)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.Hostname)
|
|
.HasMaxLength(255)
|
|
.IsUnicode(false);
|
|
|
|
// ── Classification ──────────────────────────────────────────
|
|
builder.Property(r => r.DetectedType)
|
|
.HasConversion<string>()
|
|
.HasMaxLength(20)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.DiscoveryMethod)
|
|
.HasConversion<string>()
|
|
.HasMaxLength(20)
|
|
.IsUnicode(false);
|
|
|
|
// ── Ports ───────────────────────────────────────────────────
|
|
builder.Property(r => r.OpenPorts)
|
|
.HasColumnType("integer[]")
|
|
.IsUnicode(false);
|
|
|
|
// ONVIF
|
|
builder.Property(r => r.OnvifDeviceServiceUrl)
|
|
.HasMaxLength(500)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.OnvifName)
|
|
.HasMaxLength(200)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.OnvifHardware)
|
|
.HasMaxLength(200)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.OnvifPort);
|
|
|
|
// HTTP
|
|
builder.Property(r => r.HttpServerHeader)
|
|
.HasMaxLength(200)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.HttpStatusCode);
|
|
builder.Property(r => r.HttpPort);
|
|
|
|
// HomeKit
|
|
builder.Property(r => r.HomeKitName)
|
|
.HasMaxLength(200)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.HomeKitDeviceId)
|
|
.HasMaxLength(50)
|
|
.IsUnicode(false);
|
|
|
|
builder.Property(r => r.HomeKitModel)
|
|
.HasMaxLength(200)
|
|
.IsUnicode(false);
|
|
|
|
// ── Status ──────────────────────────────────────────────────
|
|
builder.Property(r => r.ProbedAt)
|
|
.HasDefaultValueSql("NOW()");
|
|
|
|
// ── Indexes ─────────────────────────────────────────────────
|
|
builder.HasIndex(r => r.SiteId);
|
|
builder.HasIndex(r => r.IpAddress);
|
|
builder.HasIndex(r => r.IsProcessed);
|
|
|
|
// ── Relationships ───────────────────────────────────────────
|
|
builder.HasOne(r => r.Site)
|
|
.WithMany()
|
|
.HasForeignKey(r => r.SiteId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.HasMany(r => r.DiscoveredStreams)
|
|
.WithOne(ds => ds.DiscoveryResult)
|
|
.HasForeignKey(ds => ds.DiscoveryResultId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
}
|
|
}
|