Refactor API/service boundaries and modularize frontend
This commit is contained in:
47
RpgRoller/Api/RequestMappings.cs
Normal file
47
RpgRoller/Api/RequestMappings.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user