48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using RpgRoller.Contracts;
|
|
using RpgRoller.Services;
|
|
|
|
namespace RpgRoller.Api;
|
|
|
|
internal static class RequestMappings
|
|
{
|
|
public static RegisterCommand ToCommand(this RegisterRequest request)
|
|
{
|
|
return new RegisterCommand(request.Username, request.Password, request.DisplayName);
|
|
}
|
|
|
|
public static LoginCommand ToCommand(this LoginRequest request)
|
|
{
|
|
return new LoginCommand(request.Username, request.Password);
|
|
}
|
|
|
|
public static CreateCampaignCommand ToCommand(this CreateCampaignRequest request)
|
|
{
|
|
return new CreateCampaignCommand(request.Name, request.RulesetId);
|
|
}
|
|
|
|
public static CreateCharacterCommand ToCommand(this CreateCharacterRequest request)
|
|
{
|
|
return new CreateCharacterCommand(request.Name, request.CampaignId);
|
|
}
|
|
|
|
public static UpdateCharacterCommand ToCommand(this UpdateCharacterRequest request)
|
|
{
|
|
return new UpdateCharacterCommand(request.Name, request.CampaignId);
|
|
}
|
|
|
|
public static CreateSkillCommand ToCommand(this CreateSkillRequest request)
|
|
{
|
|
return new CreateSkillCommand(request.Name, request.DiceRollDefinition);
|
|
}
|
|
|
|
public static UpdateSkillCommand ToCommand(this UpdateSkillRequest request)
|
|
{
|
|
return new UpdateSkillCommand(request.Name, request.DiceRollDefinition);
|
|
}
|
|
|
|
public static RollSkillCommand ToCommand(this RollSkillRequest request)
|
|
{
|
|
return new RollSkillCommand(request.Visibility);
|
|
}
|
|
}
|