Adds media library cover image

This commit is contained in:
BinaryAlley committed 2025-01-03 16:01:20 +02:00
1 parent 89debaeaad
commit 666a739b1d
43 files changed
+1170 -94

No files matched your search

@@ -30,6 +30,11 @@ public class LibraryEntity : IStorageEntity, IAuditableEntity
/// </summary>
public required string Title { get; set; }
/// <summary>
/// Gets or sets the path of the image file used as the cover for the library.
/// </summary>
public string? CoverImage { get; set; }
/// <summary>
/// Gets or sets the type of the media library.
/// </summary>
@@ -17,15 +17,14 @@ public static class AddMediaLibraryRequestMapping
/// Converts <paramref name="request"/> to <see cref="AddLibraryCommand"/>.
/// </summary>
/// <param name="request">The request to be converted.</param>
/// <param name="userId">The Id of the user owning the media library.</param>
/// <returns>The converted command.</returns>
public static AddLibraryCommand ToCommand(this AddLibraryRequest request, Guid userId)
public static AddLibraryCommand ToCommand(this AddLibraryRequest request)
{
return new AddLibraryCommand(
userId,
request.Title,
request.LibraryType,
request.ContentLocations
request.ContentLocations,
request.CoverImage
);
}
}
@@ -24,6 +24,7 @@ public static class LibraryEntityMapping
repositoryEntity.Title,
repositoryEntity.LibraryType,
repositoryEntity.ContentLocations.Select(location => location.Path).ToList(),
repositoryEntity.CoverImage,
repositoryEntity.CreatedOnUtc,
repositoryEntity.UpdatedOnUtc
);
@@ -26,6 +26,7 @@ public static class LibraryMapping
LibraryType = domainEntity.LibraryType,
UserId = domainEntity.UserId.Value,
ContentLocations = domainEntity.ContentLocations.Select(path => new LibraryContentLocationEntity() { Path = path.Path }).ToList(),
CoverImage = domainEntity.CoverImage,
CreatedOnUtc = domainEntity.CreatedOnUtc,
CreatedBy = Guid.Empty,
UpdatedOnUtc = domainEntity.UpdatedOnUtc.HasValue ? domainEntity.UpdatedOnUtc : null,
@@ -15,17 +15,16 @@ public static class UpdateLibraryRequestMapping
/// Converts <paramref name="request"/> to <see cref="UpdateLibraryCommand"/>.
/// </summary>
/// <param name="request">The request to be converted.</param>
/// <param name="userId">The Id of the user making the request to update the media library.</param>
/// <returns>The converted command.</returns>
public static UpdateLibraryCommand ToCommand(this UpdateLibraryRequest request, Guid userId)
public static UpdateLibraryCommand ToCommand(this UpdateLibraryRequest request)
{
return new UpdateLibraryCommand(
request.Id,
request.UserId,
userId,
request.Title,
request.LibraryType,
request.ContentLocations
request.ContentLocations,
request.CoverImage
);
}
}