35 lines
1002 B
C#
35 lines
1002 B
C#
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)
|
||
|
|
.HasDefaultValue("admin");
|
||
|
|
|
||
|
|
builder.Property(c => c.OnvifPassword)
|
||
|
|
.HasMaxLength(500)
|
||
|
|
.IsRequired();
|
||
|
|
|
||
|
|
builder.Property(c => c.RtspUsername)
|
||
|
|
.HasMaxLength(100);
|
||
|
|
|
||
|
|
builder.Property(c => c.RtspPassword)
|
||
|
|
.HasMaxLength(500);
|
||
|
|
|
||
|
|
builder.Property(c => c.CreatedAt)
|
||
|
|
.HasDefaultValueSql("NOW()");
|
||
|
|
|
||
|
|
builder.Property(c => c.UpdatedAt)
|
||
|
|
.HasDefaultValueSql("NOW()");
|
||
|
|
}
|
||
|
|
}
|