34 lines
862 B
C#
34 lines
862 B
C#
using Core.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Data.Configurations;
|
|
|
|
public class PrintPresetConfiguration : IEntityTypeConfiguration<PrintPreset>
|
|
{
|
|
public void Configure(EntityTypeBuilder<PrintPreset> builder)
|
|
{
|
|
builder.HasKey(p => p.Id);
|
|
|
|
builder.Property(p => p.Name)
|
|
.IsRequired()
|
|
.HasMaxLength(100);
|
|
|
|
builder.HasIndex(p => p.Name)
|
|
.IsUnique();
|
|
|
|
builder.Property(p => p.EntityType)
|
|
.HasConversion<string>()
|
|
.HasMaxLength(32)
|
|
.IsRequired();
|
|
|
|
builder.Property(p => p.FiltersJson)
|
|
.IsRequired()
|
|
.HasColumnType("TEXT");
|
|
|
|
builder.Property(p => p.TemplateMarkdown)
|
|
.IsRequired()
|
|
.HasColumnType("TEXT");
|
|
}
|
|
}
|