Files
Backend-Api/CompanyManagment.EFCore/Mapping/CameraBugReportMapping.cs

38 lines
1.9 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Company.Domain.CameraBugReportAgg;
namespace CompanyManagment.EFCore.Mapping;
public class CameraBugReportMapping : IEntityTypeConfiguration<CameraBugReport>
{
public void Configure(EntityTypeBuilder<CameraBugReport> builder)
{
builder.HasMany(x => x.Screenshots).WithOne(x => x.CameraBugReport).HasForeignKey(x => x.CameraBugReportId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasMany(x => x.Logs).WithOne(x => x.CameraBugReport).HasForeignKey(x => x.CameraBugReportId)
.OnDelete(DeleteBehavior.Cascade);
builder.Property(x => x.Status).HasConversion<int>();
builder.Property(x => x.Priority).HasConversion<int>();
builder.Property(x => x.Type).HasConversion<int>();
builder.Property(x => x.StackTrace).HasColumnType("ntext");
builder.Property(x => x.Flavor).HasMaxLength(50);
builder.Property(x => x.PackageName).HasMaxLength(150);
builder.Property(x => x.BuildNumber).HasMaxLength(50);
builder.Property(x => x.AppVersion).HasMaxLength(50);
builder.Property(x => x.NetworkType).HasMaxLength(50);
builder.Property(x => x.ScreenResolution).HasMaxLength(50);
builder.Property(x => x.DeviceId).HasMaxLength(200);
builder.Property(x => x.Manufacturer).HasMaxLength(100);
builder.Property(x => x.Platform).HasMaxLength(50);
builder.Property(x => x.OsVersion).HasMaxLength(50);
builder.Property(x => x.DeviceModel).HasMaxLength(100);
builder.Property(x => x.UserEmail).HasMaxLength(150).IsRequired();
builder.Property(x => x.Description).HasColumnType("ntext").IsRequired();
builder.Property(x => x.Title).HasMaxLength(200).IsRequired();
builder.ToTable("CameraBugReports");
builder.HasKey(x => x.id);
}
}