mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 11:11:10 +00:00
Adds the library statistics, history, resume, and deletion API endpoints
This commit is contained in:
1 parent
c27621818c
commit
dfd979ec1e
43 files changed
+3122
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaConsumption.Commands.ClearResumePoints;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="ClearResumePointsRequest"/>.
|
||||
/// </summary>
|
||||
public static class ClearResumePointsRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="ClearResumePointsCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <param name="targetUserId">The Id of the user whose resume points are deleted, taken from the route, or <see langword="null"/> for the current user.</param>
|
||||
/// <returns>The converted command.</returns>
|
||||
public static ClearResumePointsCommand ToCommand(this ClearResumePointsRequest request, string? targetUserId)
|
||||
{
|
||||
return new ClearResumePointsCommand(
|
||||
targetUserId,
|
||||
request.LibraryId
|
||||
);
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaConsumption.Queries.GetAllUsersConsumptionStatistics;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetAllUsersConsumptionStatisticsRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetAllUsersConsumptionStatisticsRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetAllUsersConsumptionStatisticsQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetAllUsersConsumptionStatisticsQuery ToQuery(this GetAllUsersConsumptionStatisticsRequest request)
|
||||
{
|
||||
return new GetAllUsersConsumptionStatisticsQuery(
|
||||
request.LibraryId,
|
||||
request.MediaKind,
|
||||
request.FromUtc,
|
||||
request.ToUtc
|
||||
);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaConsumption.Queries.GetConsumptionStatistics;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetConsumptionStatisticsRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetConsumptionStatisticsRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetConsumptionStatisticsQuery"/>.
|
||||
/// </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 GetConsumptionStatisticsQuery ToQuery(this GetConsumptionStatisticsRequest request, string? targetUserId)
|
||||
{
|
||||
return new GetConsumptionStatisticsQuery(
|
||||
targetUserId,
|
||||
request.LibraryId,
|
||||
request.MediaKind,
|
||||
request.FromUtc,
|
||||
request.ToUtc
|
||||
);
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DTO.Pagination;
|
||||
using Lumina.Application.Core.MediaConsumption.Queries.GetMostConsumed;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetMostConsumedRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetMostConsumedRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetMostConsumedQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <param name="targetUserId">The Id of the user whose history is retrieved, taken from the route, or <see langword="null"/> for the current user.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetMostConsumedQuery ToQuery(this GetMostConsumedRequest request, string? targetUserId)
|
||||
{
|
||||
PaginationDataDto? paginationData = null;
|
||||
if (request.CurrentPage is not null || request.PerPage is not null)
|
||||
paginationData = new PaginationDataDto
|
||||
{
|
||||
CurrentPage = request.CurrentPage ?? 1,
|
||||
PerPage = request.PerPage ?? 50
|
||||
};
|
||||
|
||||
return new GetMostConsumedQuery(targetUserId, request.LibraryId, request.MediaKind, paginationData);
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DTO.Pagination;
|
||||
using Lumina.Application.Core.MediaConsumption.Queries.GetRecentlyConsumed;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetRecentlyConsumedRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetRecentlyConsumedRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetRecentlyConsumedQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <param name="targetUserId">The Id of the user whose history is retrieved, taken from the route, or <see langword="null"/> for the current user.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static GetRecentlyConsumedQuery ToQuery(this GetRecentlyConsumedRequest request, string? targetUserId)
|
||||
{
|
||||
PaginationDataDto? paginationData = null;
|
||||
if (request.CurrentPage is not null || request.PerPage is not null)
|
||||
paginationData = new PaginationDataDto
|
||||
{
|
||||
CurrentPage = request.CurrentPage ?? 1,
|
||||
PerPage = request.PerPage ?? 50
|
||||
};
|
||||
|
||||
return new GetRecentlyConsumedQuery(targetUserId, request.LibraryId, request.MediaKind, paginationData);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaConsumption.Queries.GetTagConsumption;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="GetTagConsumptionRequest"/>.
|
||||
/// </summary>
|
||||
public static class GetTagConsumptionRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="GetTagConsumptionQuery"/>.
|
||||
/// </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 GetTagConsumptionQuery ToQuery(this GetTagConsumptionRequest request, string? targetUserId)
|
||||
{
|
||||
return new GetTagConsumptionQuery(
|
||||
targetUserId,
|
||||
request.LibraryId,
|
||||
request.MediaKind,
|
||||
request.TagKind,
|
||||
request.FromUtc,
|
||||
request.ToUtc
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user