Clean up domain entities: shared picture value object, lifecycle and ownership interfaces, explicit tables
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@ internal class UpdateAlbumPictureActivity(
|
||||
return compensateContext.Compensated();
|
||||
}
|
||||
|
||||
album.Pictures = new AlbumPictures
|
||||
album.Pictures = new EntityPictures
|
||||
{
|
||||
OriginalName = compensateContext.Log.PreviousOriginalPictureKey,
|
||||
SmallName = compensateContext.Log.PreviousSmallPictureKey,
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ internal class UpdatePlayListPictureActivity(
|
||||
return compensateContext.Compensated();
|
||||
}
|
||||
|
||||
playList.Pictures = new PlayListPictures
|
||||
playList.Pictures = new EntityPictures
|
||||
{
|
||||
OriginalName = compensateContext.Log.PreviousOriginalPictureKey,
|
||||
SmallName = compensateContext.Log.PreviousSmallPictureKey,
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Database(DatabaseConfiguration configuration)
|
||||
|
||||
modelBuilder.Entity<PlayList>()
|
||||
.Property(playList => playList.Visibility)
|
||||
.HasDefaultValue(PlaylistVisibility.Private);
|
||||
.HasDefaultValue(PlayListVisibility.Private);
|
||||
|
||||
modelBuilder.Entity<PlayList>()
|
||||
.OwnsOne(playList => playList.Pictures, pictures =>
|
||||
|
||||
+11
-10
@@ -379,12 +379,13 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<long>("OwnerUserId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("UserId");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("UserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("Visibility")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
@@ -392,7 +393,7 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
b.HasIndex("OwnerUserId");
|
||||
|
||||
b.ToTable("PlayLists");
|
||||
});
|
||||
@@ -756,7 +757,7 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsOne("Musify.Domain.ValueObjects.AlbumPictures", "Pictures", b1 =>
|
||||
b.OwnsOne("Musify.Domain.ValueObjects.EntityPictures", "Pictures", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("AlbumId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -865,13 +866,13 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.PlayList", b =>
|
||||
{
|
||||
b.HasOne("Musify.Domain.Entities.User", "User")
|
||||
b.HasOne("Musify.Domain.Entities.User", "Owner")
|
||||
.WithMany("PlayLists")
|
||||
.HasForeignKey("UserId")
|
||||
.HasForeignKey("OwnerUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsOne("Musify.Domain.ValueObjects.PlayListPictures", "Pictures", b1 =>
|
||||
b.OwnsOne("Musify.Domain.ValueObjects.EntityPictures", "Pictures", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("PlayListId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -904,9 +905,9 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
.HasForeignKey("PlayListId");
|
||||
});
|
||||
|
||||
b.Navigation("Pictures");
|
||||
b.Navigation("Owner");
|
||||
|
||||
b.Navigation("User");
|
||||
b.Navigation("Pictures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.PlayListHasTrack", b =>
|
||||
|
||||
Reference in New Issue
Block a user