36 lines
995 B
C#
36 lines
995 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using RecNet.Domain.Entities.Profiles;
|
|
|
|
namespace RecNet.Infrastructure.Persistence.Configurations;
|
|
|
|
public class ProfileConfiguration : IEntityTypeConfiguration<Profile>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Profile> builder)
|
|
{
|
|
builder.HasKey(x => x.ProfileId);
|
|
|
|
builder.Property(x => x.Name)
|
|
.HasMaxLength(Profile.MaxNameLength)
|
|
.IsRequired();
|
|
|
|
builder.Property(x => x.Platform)
|
|
.HasConversion<string>()
|
|
.HasMaxLength(50)
|
|
.IsRequired();
|
|
|
|
builder.Property(x => x.PlatformId)
|
|
.HasMaxLength(50)
|
|
.IsRequired();
|
|
|
|
builder.Property(x => x.DeviceIds)
|
|
.HasColumnType("jsonb");
|
|
|
|
builder.Property(x => x.CreatedAt)
|
|
.IsRequired();
|
|
|
|
builder.HasIndex(x => new { x.Platform, x.PlatformId })
|
|
.IsUnique();
|
|
}
|
|
}
|