This commit is contained in:
2024-07-03 22:18:32 +02:00
Unverified
parent 4b333878b8
commit 008dcdf4ec
88 changed files with 3389 additions and 644 deletions

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using WatchIt.Database.Model.Media;
namespace WatchIt.Database.Model.Configuration.Media;
public class MediaPhotoImageBackgroundConfiguration : IEntityTypeConfiguration<MediaPhotoImageBackground>
{
public void Configure(EntityTypeBuilder<MediaPhotoImageBackground> builder)
{
builder.HasKey(x => x.Id);
builder.HasIndex(x => x.Id)
.IsUnique();
builder.Property(x => x.Id)
.IsRequired();
builder.Property(x => x.IsUniversalBackground)
.IsRequired()
.HasDefaultValue(false);
builder.Property(x => x.FirstGradientColor)
.IsRequired()
.HasMaxLength(3);
builder.Property(x => x.SecondGradientColor)
.IsRequired()
.HasMaxLength(3);
}
}

View File

@@ -33,12 +33,8 @@ public class MediaPhotoImageConfiguration : IEntityTypeConfiguration<MediaPhotoI
.IsRequired()
.HasDefaultValueSql("now()");
builder.Property(x => x.IsMediaBackground)
.IsRequired()
.HasDefaultValue(false);
builder.Property(x => x.IsUniversalBackground)
.IsRequired()
.HasDefaultValue(false);
builder.HasOne(x => x.MediaPhotoImageBackground)
.WithOne(x => x.MediaPhotoImage)
.HasForeignKey<MediaPhotoImageBackground>();
}
}