2026-07-16 20:53:56 +00:00
|
|
|
using Heimdall.Domain.Entities;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
|
|
|
|
|
|
namespace Heimdall.Infrastructure.Data.Configurations;
|
|
|
|
|
|
|
|
|
|
public class CameraCredentialsConfiguration : IEntityTypeConfiguration<CameraCredentials>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<CameraCredentials> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("camera_credentials");
|
|
|
|
|
|
|
|
|
|
builder.HasKey(c => c.CameraId);
|
|
|
|
|
|
|
|
|
|
builder.Property(c => c.OnvifUsername)
|
|
|
|
|
.HasMaxLength(100)
|
2026-07-17 19:31:11 +00:00
|
|
|
.HasDefaultValue("admin")
|
|
|
|
|
.IsUnicode(false);
|
2026-07-16 20:53:56 +00:00
|
|
|
|
|
|
|
|
builder.Property(c => c.OnvifPassword)
|
|
|
|
|
.HasMaxLength(500)
|
2026-07-17 19:31:11 +00:00
|
|
|
.IsRequired()
|
|
|
|
|
.IsUnicode(false);
|
2026-07-16 20:53:56 +00:00
|
|
|
|
|
|
|
|
builder.Property(c => c.RtspUsername)
|
2026-07-17 19:31:11 +00:00
|
|
|
.HasMaxLength(100)
|
|
|
|
|
.IsUnicode(false);
|
2026-07-16 20:53:56 +00:00
|
|
|
|
|
|
|
|
builder.Property(c => c.RtspPassword)
|
2026-07-17 19:31:11 +00:00
|
|
|
.HasMaxLength(500)
|
|
|
|
|
.IsUnicode(false);
|
2026-07-16 20:53:56 +00:00
|
|
|
|
|
|
|
|
builder.Property(c => c.CreatedAt)
|
|
|
|
|
.HasDefaultValueSql("NOW()");
|
|
|
|
|
|
|
|
|
|
builder.Property(c => c.UpdatedAt)
|
|
|
|
|
.HasDefaultValueSql("NOW()");
|
|
|
|
|
}
|
|
|
|
|
}
|