feat: bring over the albums, explore and player work from the worktree
Moves the remaining uncommitted work: the home gets quick mixes and a "Tus álbumes" shelf, saving a YouTube album now goes through addYoutubeAlbumToPlaylistAction instead of the SaveYouTubeAlbum command, and UserAlbum drops its unused ExternalId. The mixes section keeps its current shape (no refresh action, no badge, hidden when empty) rather than the older version the worktree carried.
This commit is contained in:
@@ -111,10 +111,6 @@ namespace Musify.Infrastructure.Persistence
|
||||
modelBuilder.Entity<UserAlbum>()
|
||||
.ToTable("UserAlbums");
|
||||
|
||||
modelBuilder.Entity<UserAlbum>()
|
||||
.HasIndex(album => new { album.OwnerUserId, album.ExternalId })
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<UserAlbum>()
|
||||
.HasOne(album => album.Owner)
|
||||
.WithMany()
|
||||
|
||||
+1178
File diff suppressed because it is too large
Load Diff
+48
@@ -0,0 +1,48 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Musify.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RemoveUserAlbumExternalId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_UserAlbums_OwnerUserId_ExternalId",
|
||||
table: "UserAlbums");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ExternalId",
|
||||
table: "UserAlbums");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserAlbums_OwnerUserId",
|
||||
table: "UserAlbums",
|
||||
column: "OwnerUserId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_UserAlbums_OwnerUserId",
|
||||
table: "UserAlbums");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ExternalId",
|
||||
table: "UserAlbums",
|
||||
type: "character varying(64)",
|
||||
maxLength: 64,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserAlbums_OwnerUserId_ExternalId",
|
||||
table: "UserAlbums",
|
||||
columns: new[] { "OwnerUserId", "ExternalId" },
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -728,15 +728,10 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
b.HasBaseType("Musify.Domain.Entities.Album");
|
||||
|
||||
b.Property<string>("ExternalId")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<long>("OwnerUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasIndex("OwnerUserId", "ExternalId")
|
||||
.IsUnique();
|
||||
b.HasIndex("OwnerUserId");
|
||||
|
||||
b.ToTable("UserAlbums", (string)null);
|
||||
});
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Musify.Infrastructure.Services
|
||||
|
||||
return new YouTubeAlbumDetail(
|
||||
album,
|
||||
info.Description ?? string.Empty,
|
||||
StripWikipediaAttribution(info.Description),
|
||||
(int)info.Duration.TotalSeconds,
|
||||
tracks);
|
||||
}
|
||||
@@ -173,6 +173,16 @@ namespace Musify.Infrastructure.Services
|
||||
}
|
||||
}
|
||||
|
||||
private static string StripWikipediaAttribution(string? description)
|
||||
{
|
||||
if (string.IsNullOrEmpty(description))
|
||||
return string.Empty;
|
||||
|
||||
var markerIndex = description.IndexOf("From Wikipedia", StringComparison.OrdinalIgnoreCase);
|
||||
var cleaned = markerIndex >= 0 ? description[..markerIndex] : description;
|
||||
return cleaned.TrimEnd();
|
||||
}
|
||||
|
||||
private YouTubeAlbumResult ToAlbumResult(AlbumSearchResult album) =>
|
||||
new(
|
||||
album.Id,
|
||||
|
||||
Reference in New Issue
Block a user