mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 07:11:10 +00:00
Adds the media consumption lifecycle commands and repository wiring
This commit is contained in:
1 parent
2ffacb5360
commit
bde7ee4b1f
30 files changed
+1962
-28
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaConsumption.Commands.CompleteConsumption;
|
||||
using Lumina.Contracts.Requests.MediaConsumption;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="CompleteConsumptionRequest"/>.
|
||||
/// </summary>
|
||||
public static class CompleteConsumptionRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="CompleteConsumptionCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <param name="consumptionRecordId">The Id of the consumption record, taken from the route.</param>
|
||||
/// <returns>The converted command.</returns>
|
||||
public static CompleteConsumptionCommand ToCommand(this CompleteConsumptionRequest request, string? consumptionRecordId)
|
||||
{
|
||||
return new CompleteConsumptionCommand(
|
||||
consumptionRecordId,
|
||||
request.Position?.Kind,
|
||||
request.Position?.TimeOffsetSeconds,
|
||||
request.Position?.Location,
|
||||
request.ProgressFraction,
|
||||
request.ConsumedDurationInSeconds
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user