mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Adds the media-neutral library statistics page and separates tags from genres
This commit is contained in:
1 parent
a61fbf407c
commit
00d7eff777
118 files changed
+6132
-1154
No files matched your search
@@ -0,0 +1,39 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DTO.MediaConsumption;
|
||||
using Lumina.Application.Common.Utilities;
|
||||
using Lumina.Contracts.Responses.MediaConsumption;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GenreConsumptionDto"/>.
|
||||
/// </summary>
|
||||
public static class GenreConsumptionDtoMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="data"/> to <see cref="GenreConsumptionResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="data">The data transfer object to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static GenreConsumptionResponse ToResponse(this GenreConsumptionDto data)
|
||||
{
|
||||
return new GenreConsumptionResponse(
|
||||
data.Name,
|
||||
data.ConsumedItemCount,
|
||||
data.ConsumedDurationMilliseconds.ToClampedTimeSpan().TotalSeconds
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="data"/> to a collection of <see cref="GenreConsumptionResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="data">The data transfer objects to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IReadOnlyList<GenreConsumptionResponse> ToResponses(this IReadOnlyList<GenreConsumptionDto> data)
|
||||
{
|
||||
return [.. data.Select(item => item.ToResponse())];
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaConsumption.Queries.GetGenreConsumption;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetGenreConsumptionRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetGenreConsumptionRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetGenreConsumptionQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <param name="targetUserId">The Id of the user whose statistics are retrieved, taken from the route, or <see langword="null"/> for the current user.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetGenreConsumptionQuery ToQuery(this GetGenreConsumptionRequest request, string? targetUserId)
|
||||
{
|
||||
return new GetGenreConsumptionQuery(
|
||||
targetUserId,
|
||||
request.LibraryId,
|
||||
request.MediaKind,
|
||||
request.FromUtc,
|
||||
request.ToUtc
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -27,6 +27,6 @@ public static class GetMostConsumedRequestMapping
|
||||
PerPage = request.PerPage ?? 50
|
||||
};
|
||||
|
||||
return new GetMostConsumedQuery(targetUserId, request.LibraryId, request.MediaKind, paginationData);
|
||||
return new GetMostConsumedQuery(targetUserId, request.LibraryId, request.MediaKind, request.FromUtc, request.ToUtc, paginationData);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -27,6 +27,6 @@ public static class GetRecentlyConsumedRequestMapping
|
||||
PerPage = request.PerPage ?? 50
|
||||
};
|
||||
|
||||
return new GetRecentlyConsumedQuery(targetUserId, request.LibraryId, request.MediaKind, paginationData);
|
||||
return new GetRecentlyConsumedQuery(targetUserId, request.LibraryId, request.MediaKind, request.FromUtc, request.ToUtc, paginationData);
|
||||
}
|
||||
}
|
||||
-1
@@ -22,7 +22,6 @@ public static class GetTagConsumptionRequestMapping
|
||||
targetUserId,
|
||||
request.LibraryId,
|
||||
request.MediaKind,
|
||||
request.TagKind,
|
||||
request.FromUtc,
|
||||
request.ToUtc
|
||||
);
|
||||
|
||||
@@ -22,7 +22,6 @@ public static class TagConsumptionDtoMapping
|
||||
{
|
||||
return new TagConsumptionResponse(
|
||||
data.Name,
|
||||
data.TagKind,
|
||||
data.ConsumedItemCount,
|
||||
data.ConsumedDurationMilliseconds.ToClampedTimeSpan().TotalSeconds
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user