generated from Game-as-a-Service/Gaas-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete unused endpoints and add new game-related endpoints
- Loading branch information
Showing
40 changed files
with
735 additions
and
183 deletions.
There are no files selected for viewing
38 changes: 0 additions & 38 deletions
38
src/BackEnd/src/Core/Application/UseCases/ConfirmPlayerRoleUseCase.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ion/UseCases/DiscoverPlayerRoleUseCase.cs → ...ases/Players/DiscoverPlayerRoleUseCase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/BackEnd/src/Core/Application/UseCases/Players/PlayerGetRoleUseCase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Wsa.Gaas.Werewolf.Application.UseCases.Players; | ||
public class PlayerGetRoleRequest | ||
{ | ||
public ulong DiscordVoiceChannelId { get; set; } | ||
public ulong PlayerId { get; set; } | ||
} | ||
|
||
public record PlayerGetRoleResponse(string GameId, string PlayerId, string Role); | ||
|
||
public class PlayerGetRoleUseCase : UseCase<PlayerGetRoleRequest, PlayerGetRoleResponse> | ||
{ | ||
public PlayerGetRoleUseCase(IRepository repository, GameEventBus gameEventBus) : base(repository, gameEventBus) | ||
{ | ||
} | ||
|
||
public async override Task<PlayerGetRoleResponse> ExecuteAsync(PlayerGetRoleRequest request, CancellationToken cancellationToken = default) | ||
{ | ||
// Query | ||
var game = await Repository.FindByDiscordChannelIdAsync(request.DiscordVoiceChannelId) | ||
?? throw new GameNotFoundException(request.DiscordVoiceChannelId); | ||
|
||
// Update (Query) | ||
var gameEvent = game.PlayerGetRole(request.PlayerId); | ||
|
||
// Push | ||
return new PlayerGetRoleResponse( | ||
gameEvent.Data.DiscordVoiceChannelId.ToString(), | ||
gameEvent.PlayerId.ToString(), | ||
gameEvent.Role | ||
); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ion/UseCases/PlayerTriggerSkillUseCase.cs → ...ases/Players/PlayerTriggerSkillUseCase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...plication/UseCases/WerewolfVoteUseCase.cs → ...n/UseCases/Players/WerewolfVoteUseCase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ation/UseCases/WitchUseAntidoteUseCase.cs → ...eCases/Players/WitchUseAntidoteUseCase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ication/UseCases/WitchUsePoisonUseCase.cs → ...UseCases/Players/WitchUsePoisonUseCase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
src/BackEnd/src/Presentation/WebApi/Endpoints/ConfirmPlayerRoleEndpoint.cs
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
src/BackEnd/src/Presentation/WebApi/Endpoints/CreateGameEndpoint.cs
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
src/BackEnd/src/Presentation/WebApi/Endpoints/EndGameEndpoint.cs
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/BackEnd/src/Presentation/WebApi/Endpoints/Games/GameCreateEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Wsa.Gaas.Werewolf.Application.UseCases.Games; | ||
|
||
namespace Wsa.Gaas.Werewolf.WebApi.Endpoints.Games; | ||
public class GameCreateEndpoint : WebApiEndpoint<GameCreateRequest, GameCreateResponse> | ||
{ | ||
public override void Configure() | ||
{ | ||
Post("/games"); | ||
AllowAnonymous(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/BackEnd/src/Presentation/WebApi/Endpoints/Games/GameEndEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Wsa.Gaas.Werewolf.Application.UseCases.Games; | ||
|
||
namespace Wsa.Gaas.Werewolf.WebApi.Endpoints.Games; | ||
public class GameEndEndpoint : WebApiEndpoint<GameEndRequest, GameEndResponse> | ||
{ | ||
public override void Configure() | ||
{ | ||
Post("/games/{DiscordVoiceChannelId}/end"); | ||
AllowAnonymous(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/BackEnd/src/Presentation/WebApi/Endpoints/Games/GameGetEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Wsa.Gaas.Werewolf.Application.UseCases.Games; | ||
|
||
namespace Wsa.Gaas.Werewolf.WebApi.Endpoints.Games; | ||
|
||
public class GameGetEndpoint : WebApiEndpoint<GameGetRequest, GameGetResponse> | ||
{ | ||
public override void Configure() | ||
{ | ||
Get("/games/{DiscordVoiceChannelId}"); | ||
AllowAnonymous(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/BackEnd/src/Presentation/WebApi/Endpoints/Games/GameStartEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Wsa.Gaas.Werewolf.Application.UseCases.Games; | ||
|
||
namespace Wsa.Gaas.Werewolf.WebApi.Endpoints.Games; | ||
public class GameStartEndpoint : WebApiEndpoint<GameStartRequest, GameStartResponse> | ||
{ | ||
public override void Configure() | ||
{ | ||
Post("/games/{DiscordVoiceChannelId}/start"); | ||
AllowAnonymous(); | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
src/BackEnd/src/Presentation/WebApi/Endpoints/GetGameEndpoint.cs
This file was deleted.
Oops, something went wrong.
4 changes: 3 additions & 1 deletion
4
...i/Endpoints/DiscoverPlayerRoleEndpoint.cs → ...nts/Players/DiscoverPlayerRoleEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.