Fix query and API bugs: 403 for non-owners, page bounds, lifecycle filters, cover fallback, race-safe inserts, async album delete
This commit is contained in:
+1174
File diff suppressed because it is too large
Load Diff
+46
@@ -0,0 +1,46 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Musify.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class PlayListTrackUnique : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// Remove duplicate rows (keeping the lowest position) before enforcing uniqueness.
|
||||
migrationBuilder.Sql("""
|
||||
DELETE FROM "PlayListHasTrack" a
|
||||
USING "PlayListHasTrack" b
|
||||
WHERE a."PlayListId" = b."PlayListId"
|
||||
AND a."TrackId" = b."TrackId"
|
||||
AND (a."Position", a."Id") > (b."Position", b."Id");
|
||||
""");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlayListHasTrack_PlayListId",
|
||||
table: "PlayListHasTrack");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlayListHasTrack_PlayListId_TrackId",
|
||||
table: "PlayListHasTrack",
|
||||
columns: new[] { "PlayListId", "TrackId" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlayListHasTrack_PlayListId_TrackId",
|
||||
table: "PlayListHasTrack");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlayListHasTrack_PlayListId",
|
||||
table: "PlayListHasTrack",
|
||||
column: "PlayListId");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,10 +417,11 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlayListId");
|
||||
|
||||
b.HasIndex("TrackId");
|
||||
|
||||
b.HasIndex("PlayListId", "TrackId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("PlayListHasTrack");
|
||||
});
|
||||
|
||||
@@ -790,13 +791,11 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("LargeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("LargePictureName");
|
||||
|
||||
b1.Property<string>("MediumName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("MediumPictureName");
|
||||
@@ -808,7 +807,6 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
.HasColumnName("OriginalPictureName");
|
||||
|
||||
b1.Property<string>("SmallName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("SmallPictureName");
|
||||
|
||||
Reference in New Issue
Block a user