Add likes, follows and playlist visibility; redesign web-player UI
Backend: - New Likes feature (toggle/get liked tracks) and endpoints - User follow/unfollow, listening stats, public user profile - Playlist visibility (public/private) support - Various auth and DTO/response adjustments to support the above Frontend (web-player): - New design system pass: theme tokens/mode (light/dark), glass menu, tabs bar, player dock/extras/queue components, mix tiles, artist link - New routes: Liked, public user profile (/u/[id]), likes API proxy - Search refactor: shared SearchBox component used by TopBar and MobileHeader (search now reachable on mobile), live results as you type instead of requiring Enter, dropped the "Buscando…" quick-result preview - Removed now-unused components (MobileNav, CoverBadge, MixBentoTile, PlayPauseOverlay, SuggestionsTable, userDirectory) - Design handoff reference docs added under web-player/design_handoff_musify_player and web-player/docs/design-system-refactor-plan.md
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 68 KiB |
@@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using MassTransit;
|
||||
using Musify.Domain.Entities;
|
||||
using Musify.Domain.ValueObjects;
|
||||
using Musify.Infrastructure.Configuration;
|
||||
using Musify.Infrastructure.MassTransit.Sagas;
|
||||
using AppIDatabase = Musify.Application.Contracts.IDatabase;
|
||||
@@ -88,6 +89,10 @@ namespace Musify.Infrastructure.Persistence
|
||||
.HasIndex(artist => artist.ExternalId)
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<PlayList>()
|
||||
.Property(playList => playList.Visibility)
|
||||
.HasDefaultValue(PlaylistVisibility.Private);
|
||||
|
||||
modelBuilder.Entity<PlayList>()
|
||||
.OwnsOne(playList => playList.Pictures, pictures =>
|
||||
{
|
||||
@@ -159,6 +164,26 @@ namespace Musify.Infrastructure.Persistence
|
||||
modelBuilder.Entity<MixItem>()
|
||||
.HasIndex(item => new { item.MixId, item.Position });
|
||||
|
||||
modelBuilder.Entity<TrackLike>()
|
||||
.HasIndex(like => new { like.UserId, like.TrackId })
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<UserFollow>()
|
||||
.HasOne(follow => follow.Follower)
|
||||
.WithMany()
|
||||
.HasForeignKey(follow => follow.FollowerId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<UserFollow>()
|
||||
.HasOne(follow => follow.Followed)
|
||||
.WithMany()
|
||||
.HasForeignKey(follow => follow.FollowedId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<UserFollow>()
|
||||
.HasIndex(follow => new { follow.FollowerId, follow.FollowedId })
|
||||
.IsUnique();
|
||||
|
||||
var playListProcessing = modelBuilder.Entity<PlayListProcessingState>();
|
||||
playListProcessing.HasKey(state => state.CorrelationId);
|
||||
playListProcessing.Property(state => state.CorrelationId).ValueGeneratedNever();
|
||||
@@ -206,6 +231,10 @@ namespace Musify.Infrastructure.Persistence
|
||||
|
||||
public DbSet<ListeningHistory> ListeningHistories => Set<ListeningHistory>();
|
||||
|
||||
public DbSet<TrackLike> TrackLikes => Set<TrackLike>();
|
||||
|
||||
public DbSet<UserFollow> UserFollows => Set<UserFollow>();
|
||||
|
||||
public async Task<IDatabaseTransaction> BeginTransactionAsync(System.Data.IsolationLevel isolationLevel, CancellationToken cancellationToken)
|
||||
{
|
||||
var transaction = await Database.BeginTransactionAsync(isolationLevel, cancellationToken);
|
||||
|
||||
+1245
File diff suppressed because it is too large
Load Diff
+29
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Musify.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPlayListVisibility : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Visibility",
|
||||
table: "PlayLists",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Visibility",
|
||||
table: "PlayLists");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1289
File diff suppressed because it is too large
Load Diff
+59
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Musify.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddTrackLikes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TrackLikes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UserId = table.Column<long>(type: "bigint", nullable: false),
|
||||
TrackId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TrackLikes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_TrackLikes_Tracks_TrackId",
|
||||
column: x => x.TrackId,
|
||||
principalTable: "Tracks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TrackLikes_User_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TrackLikes_TrackId",
|
||||
table: "TrackLikes",
|
||||
column: "TrackId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TrackLikes_UserId_TrackId",
|
||||
table: "TrackLikes",
|
||||
columns: new[] { "UserId", "TrackId" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "TrackLikes");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1333
File diff suppressed because it is too large
Load Diff
+59
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Musify.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUserFollows : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserFollows",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FollowerId = table.Column<long>(type: "bigint", nullable: false),
|
||||
FollowedId = table.Column<long>(type: "bigint", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserFollows", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserFollows_User_FollowedId",
|
||||
column: x => x.FollowedId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserFollows_User_FollowerId",
|
||||
column: x => x.FollowerId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserFollows_FollowedId",
|
||||
table: "UserFollows",
|
||||
column: "FollowedId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserFollows_FollowerId_FollowedId",
|
||||
table: "UserFollows",
|
||||
columns: new[] { "FollowerId", "FollowedId" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserFollows");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,6 +431,11 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
b.Property<long>("UserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("Visibility")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
@@ -518,6 +523,31 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("TrackArtist");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.TrackLike", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("TrackId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("UserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TrackId");
|
||||
|
||||
b.HasIndex("UserId", "TrackId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TrackLikes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.Upload", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -636,6 +666,31 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.UserFollow", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("FollowedId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("FollowerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FollowedId");
|
||||
|
||||
b.HasIndex("FollowerId", "FollowedId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("UserFollows");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -1105,6 +1160,25 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("Track");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.TrackLike", b =>
|
||||
{
|
||||
b.HasOne("Musify.Domain.Entities.Track", "Track")
|
||||
.WithMany()
|
||||
.HasForeignKey("TrackId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Musify.Domain.Entities.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Track");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.UploadIntent", b =>
|
||||
{
|
||||
b.HasOne("Musify.Domain.Entities.User", "User")
|
||||
@@ -1116,6 +1190,25 @@ namespace Musify.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.UserFollow", b =>
|
||||
{
|
||||
b.HasOne("Musify.Domain.Entities.User", "Followed")
|
||||
.WithMany()
|
||||
.HasForeignKey("FollowedId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Musify.Domain.Entities.User", "Follower")
|
||||
.WithMany()
|
||||
.HasForeignKey("FollowerId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Followed");
|
||||
|
||||
b.Navigation("Follower");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Musify.Domain.Entities.UserHasTrack", b =>
|
||||
{
|
||||
b.HasOne("Musify.Domain.Entities.Track", "Track")
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Musify.Infrastructure.Services
|
||||
{
|
||||
public class YouTubeMusicService(YouTubeConfiguration configuration, IMemoryCache cache, ILogger<YouTubeMusicService> logger) : IYouTubeMusicService
|
||||
{
|
||||
private readonly YouTubeMusicClient client = new(geographicalLocation: configuration.GeographicalLocation);
|
||||
private readonly SingleFlightCache singleFlight = new(cache);
|
||||
private readonly YouTubeMusicClient client = new YouTubeMusicClient(geographicalLocation: configuration.GeographicalLocation);
|
||||
private readonly SingleFlightCache singleFlight = new SingleFlightCache(cache);
|
||||
|
||||
private sealed record CachedStreamInfo(string Url, DateTime ExpiresAtUtc);
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Musify.Infrastructure.Services
|
||||
song.IsExplicit,
|
||||
song.Artists
|
||||
.Select(artist => new YouTubeArtistRef(
|
||||
string.IsNullOrEmpty(artist.Id) ? null : artist.Id,
|
||||
string.IsNullOrEmpty(artist.Id)? null: artist.Id,
|
||||
artist.Name))
|
||||
.ToList()))
|
||||
.ToList();
|
||||
@@ -147,7 +147,7 @@ namespace Musify.Infrastructure.Services
|
||||
info.IsEp,
|
||||
info.Artists
|
||||
.Select(artist => new YouTubeArtistRef(
|
||||
string.IsNullOrEmpty(artist.Id) ? null : artist.Id,
|
||||
string.IsNullOrEmpty(artist.Id)? null: artist.Id,
|
||||
artist.Name))
|
||||
.ToList());
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace Musify.Infrastructure.Services
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
if (cache.TryGetValue(StreamCacheKey(videoId), out CachedStreamInfo? cached)
|
||||
&& cached is not null
|
||||
&& cached != null
|
||||
&& cached.ExpiresAtUtc > now)
|
||||
{
|
||||
return new YouTubeStreamInfo(cached.Url, (int)(cached.ExpiresAtUtc - now).TotalSeconds);
|
||||
@@ -267,7 +267,7 @@ namespace Musify.Infrastructure.Services
|
||||
info.IsExplicit,
|
||||
info.Artists
|
||||
.Select(artist => new YouTubeArtistRef(
|
||||
string.IsNullOrEmpty(artist.Id) ? null : artist.Id,
|
||||
string.IsNullOrEmpty(artist.Id)? null: artist.Id,
|
||||
artist.Name))
|
||||
.ToList());
|
||||
}
|
||||
@@ -291,8 +291,7 @@ namespace Musify.Infrastructure.Services
|
||||
var chosen = candidates.FirstOrDefault(thumbnail => thumbnail.Width >= configuration.ThumbnailSize)
|
||||
?? candidates.LastOrDefault();
|
||||
|
||||
return chosen is null
|
||||
? string.Empty
|
||||
return chosen ==null? string.Empty
|
||||
: YouTubeThumbNailHelper.WithSize(chosen.Url, configuration.ThumbnailSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user