First Commit

This commit is contained in:
2026-03-18 01:14:49 +01:00
commit 306248b11c
39 changed files with 1361 additions and 0 deletions
@@ -0,0 +1,9 @@
using Ardalis.Result;
using DispatchR.Abstractions.Send;
using Musify.Application.PlayLists.Contracts;
namespace Musify.Application.PlayLists.Queries.GetPlayListById
{
public record GetPlayListByIdQuery(Guid Id)
: IRequest<GetPlayListByIdQuery, Result<PlayListResponse>>;
}
@@ -0,0 +1,29 @@
using Ardalis.Result;
using DispatchR.Abstractions.Send;
using Microsoft.EntityFrameworkCore;
using Musify.Application.Contracts.Infrastructure;
using Musify.Application.PlayLists.Contracts;
namespace Musify.Application.PlayLists.Queries.GetPlayListById
{
public class GetPlayListByIdQueryHandler(IDatabase database)
: IRequestHandler<GetPlayListByIdQuery, Task<Result<PlayListResponse>> >
{
public async Task<Result<PlayListResponse>> Handle(GetPlayListByIdQuery request, CancellationToken cancellationToken)
{
var playList = await database.PlayLists
.AsNoTracking()
.SingleOrDefaultAsync(p => p.Id == request.Id, cancellationToken);
return playList is not null
? Result.Success(new PlayListResponse(
playList.Id,
playList.Name,
playList.Description,
playList.ImageName,
playList.CreatedDate,
playList.UpdatedDate))
: Result.NotFound("Playlist not found.");
}
}
}