Changes and fixes

This commit is contained in:
2026-03-18 10:52:00 +01:00
parent 2549dc7a78
commit 9ba073ec64
13 changed files with 87 additions and 65 deletions
@@ -43,19 +43,24 @@ namespace Musify.Application.PlayLists.Commands.CreatePlayList
logger.LogInformation("PlayList with Id={PlayListId} created successfully for UserId={UserId}.", playList.Id, request.UserId);
await pictureService.ResizePictureAsync(
EntityType.PlayList,
playList.Id,
playList.Id.ToString(),
request.PictureContentType,
request.PictureStream,
[
new PictureResize(playListConfiguration.SmallPictureWidth, playListConfiguration.SmallPictureHeight),
new PictureResize(playListConfiguration.MediumPictureWidth, playListConfiguration.MediumPictureHeight),
new PictureResize(playListConfiguration.LargePictureWidth, playListConfiguration.LargePictureHeight)
new PictureResize(playListConfiguration.SmallPictureWidth,
playListConfiguration.SmallPictureHeight, playListConfiguration.Routes.SmallPictures),
new PictureResize(playListConfiguration.MediumPictureWidth,
playListConfiguration.MediumPictureHeight, playListConfiguration.Routes.MediumPictures),
new PictureResize(playListConfiguration.LargePictureWidth,
playListConfiguration.LargePictureHeight, playListConfiguration.Routes.LargePictures)
],
cancellationToken);
logger.LogInformation("Picture for PlayList with Id={PlayListId} ", playList.Id);
return Result.Created(PlayListResponse.Map(playList));
return Result.Created(PlayListResponse.FromEntity(playList));
}
}
}
@@ -12,7 +12,7 @@ namespace Musify.Application.PlayLists.Contracts
DateTime CreatedAt,
DateTime UpdatedAt)
{
public static PlayListResponse Map(PlayList playList)
public static PlayListResponse FromEntity(PlayList playList)
{
return new PlayListResponse(
playList.Id,
@@ -16,13 +16,7 @@ namespace Musify.Application.PlayLists.Queries.GetPlayListById
.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.Success(PlayListResponse.FromEntity(playList))
: Result.NotFound("Playlist not found.");
}
}
@@ -3,6 +3,7 @@ using DispatchR.Abstractions.Send;
using Microsoft.EntityFrameworkCore;
using Musify.Application.Contracts.Infrastructure;
using Musify.Application.PlayLists.Contracts;
using Musify.Domain.Entities;
using X.PagedList.EF;
namespace Musify.Application.PlayLists.Queries.GetPlayLists
@@ -20,13 +21,7 @@ namespace Musify.Application.PlayLists.Queries.GetPlayLists
var pagedPlayLists = await database.PlayLists
.AsNoTracking()
.OrderBy(p => p.Id)
.Select(p => new PlayListResponse(
p.Id,
p.Name,
p.Description,
p.ImageName,
p.CreatedDate,
p.UpdatedDate))
.Select(p => PlayListResponse.FromEntity(p))
.ToPagedListAsync(pageNumber, pageSize, totalCount, cancellationToken);
var response = new PaginatedPlayListResponse(
@@ -3,6 +3,7 @@ using DispatchR.Abstractions.Send;
using Microsoft.EntityFrameworkCore;
using Musify.Application.Contracts.Infrastructure;
using Musify.Application.PlayLists.Contracts;
using Musify.Domain.Entities;
using X.PagedList.EF;
namespace Musify.Application.PlayLists.Queries.GetPlayListsByUserId
@@ -27,13 +28,7 @@ namespace Musify.Application.PlayLists.Queries.GetPlayListsByUserId
var pagedPlayLists = await playListsQuery
.OrderBy(p => p.CreatedDate)
.Select(p => new PlayListResponse(
p.Id,
p.Name,
p.Description,
p.ImageName,
p.CreatedDate,
p.UpdatedDate))
.Select(p => PlayListResponse.FromEntity(p))
.ToPagedListAsync(pageNumber, pageSize, totalCount, cancellationToken);
var response = new PaginatedPlayListResponse(