Moves media library scanning to domain layer

This commit is contained in:
BinaryAlley committed 2025-02-16 21:45:26 +02:00
1 parent 8b51abe0b2
commit c4246d2e69
209 files changed
+3793 -641

No files matched your search

@@ -59,6 +59,12 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
.HasForeignKey(library => library.UserId)
.IsRequired();
// one library with many scans
builder.HasMany(library => library.LibraryScans)
.WithOne(libraryScan => libraryScan.Library)
.HasForeignKey(libraryScan => libraryScan.LibraryId)
.OnDelete(DeleteBehavior.Cascade); // deleting a library deletes library scans
// using OwnsMany because paths are domain Value Objects, thus they have no independent identity, and their lifecycle is bound to the Library
builder.OwnsMany(library => library.ContentLocations, contentLocationBuilder =>
{
@@ -75,5 +81,22 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
.HasMaxLength(260)
.IsRequired();
});
// audit
builder.Property(permission => permission.CreatedOnUtc)
.IsRequired()
.HasColumnOrder(8);
builder.Property(permission => permission.CreatedBy)
.IsRequired()
.HasColumnOrder(9);
builder.Property(permission => permission.UpdatedOnUtc)
.HasDefaultValue(null)
.HasColumnOrder(10);
builder.Property(permission => permission.UpdatedBy)
.HasDefaultValue(null)
.HasColumnOrder(11);
}
}