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
62 lines
2.1 KiB
C#
62 lines
2.1 KiB
C#
using Mediator;
|
|
using Musify.Application.Likes;
|
|
using Musify.Application.Shared;
|
|
using Musify.Application.Tracks.Responses;
|
|
using Musify.Api.Authentication;
|
|
using Musify.Api.DataTransferObjects.Likes;
|
|
using Musify.Api.Extensions;
|
|
using Musify.Api.Filters;
|
|
|
|
namespace Musify.Api.Endpoints;
|
|
|
|
public static class LikeEndpoints
|
|
{
|
|
public static IEndpointRouteBuilder MapLikeEndpoints(this IEndpointRouteBuilder app)
|
|
{
|
|
var group = app.MapGroup("/likes")
|
|
.WithTags("Likes")
|
|
.RequireAuthorization();
|
|
|
|
group.MapGet("/", GetLikedTracks)
|
|
.WithName("GetLikedTracks")
|
|
.WithSummary("Get The Current User'S Liked Tracks.")
|
|
.Produces<PaginatedResponse<TrackApplicationResponse>>()
|
|
.Produces(StatusCodes.Status401Unauthorized);
|
|
|
|
group.MapPost("/toggle", ToggleTrackLike)
|
|
.WithName("ToggleTrackLike")
|
|
.WithSummary("Like Or Unlike A Track, By Id Or By External Source, Provisioning It In The Background If Needed.")
|
|
.AddEndpointFilter<ValidationFilter<ToggleLikeRequest>>()
|
|
.Produces<bool>()
|
|
.ProducesValidationProblem()
|
|
.Produces(StatusCodes.Status401Unauthorized)
|
|
.Produces(StatusCodes.Status404NotFound);
|
|
|
|
return app;
|
|
}
|
|
|
|
private static async Task<IResult> GetLikedTracks(
|
|
IMediator mediator,
|
|
CurrentUser currentUser,
|
|
CancellationToken cancellationToken,
|
|
int pageNumber = 1,
|
|
int pageSize = 10)
|
|
{
|
|
var result = await mediator.Send(new GetLikedTracksQuery(currentUser.RequiredId, pageNumber, pageSize), cancellationToken);
|
|
return result.ToHttpResult();
|
|
}
|
|
|
|
private static async Task<IResult> ToggleTrackLike(
|
|
IMediator mediator,
|
|
CurrentUser currentUser,
|
|
ToggleLikeRequest request,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
var result = await mediator.Send(
|
|
new ToggleTrackLikeCommand(currentUser.RequiredId, request.TrackId, request.Source, request.ExternalId),
|
|
cancellationToken);
|
|
|
|
return result.ToHttpResult();
|
|
}
|
|
}
|