diff --git a/ApplicationLayer/Monopoly.ApplicationLayer.Application/MonopolyUsecases/Queries/CheckGameExistenceQuery.cs b/ApplicationLayer/Monopoly.ApplicationLayer.Application/MonopolyUsecases/Queries/CheckGameExistenceQuery.cs index fe3da0e..3b518c6 100644 --- a/ApplicationLayer/Monopoly.ApplicationLayer.Application/MonopolyUsecases/Queries/CheckGameExistenceQuery.cs +++ b/ApplicationLayer/Monopoly.ApplicationLayer.Application/MonopolyUsecases/Queries/CheckGameExistenceQuery.cs @@ -10,11 +10,11 @@ public record Request(string GameId) : BaseRequest; public record Response(bool IsExist) : Common.Response; - public override Task ExecuteAsync(Request request, + public override async Task ExecuteAsync(Request request, IPresenter presenter, CancellationToken cancellationToken = default) { - var isExist = inquiry.CheckGameExistence(request.GameId); - return presenter.PresentAsync(new Response(isExist), cancellationToken); + var isExist = await inquiry.CheckGameExistenceAsync(request.GameId); + await presenter.PresentAsync(new Response(isExist), cancellationToken); } } \ No newline at end of file diff --git a/ApplicationLayer/Monopoly.ApplicationLayer.Application/MonopolyUsecases/Queries/Interfaces/IGameExistenceInquiry.cs b/ApplicationLayer/Monopoly.ApplicationLayer.Application/MonopolyUsecases/Queries/Interfaces/IGameExistenceInquiry.cs index 028257d..70861b9 100644 --- a/ApplicationLayer/Monopoly.ApplicationLayer.Application/MonopolyUsecases/Queries/Interfaces/IGameExistenceInquiry.cs +++ b/ApplicationLayer/Monopoly.ApplicationLayer.Application/MonopolyUsecases/Queries/Interfaces/IGameExistenceInquiry.cs @@ -1,6 +1,14 @@ namespace Monopoly.ApplicationLayer.Application.MonopolyUsecases.Queries.Interfaces; +/// +/// 用來確認遊戲是否存在的查詢介面 +/// public interface IGameExistenceInquiry { - bool CheckGameExistence(string gameId); + /// + /// 確認遊戲是否存在 + /// + /// 遊戲 Id + /// 當遊戲存在則回傳 true + Task CheckGameExistenceAsync(string gameId); } \ No newline at end of file diff --git a/InterfaceAdapterLayer/Monopoly.InterfaceAdapterLayer.Server/Repositories/Inquiries/GameExistenceInquiry.cs b/InterfaceAdapterLayer/Monopoly.InterfaceAdapterLayer.Server/Repositories/Inquiries/GameExistenceInquiry.cs index 1fe0979..fc34b14 100644 --- a/InterfaceAdapterLayer/Monopoly.InterfaceAdapterLayer.Server/Repositories/Inquiries/GameExistenceInquiry.cs +++ b/InterfaceAdapterLayer/Monopoly.InterfaceAdapterLayer.Server/Repositories/Inquiries/GameExistenceInquiry.cs @@ -6,9 +6,9 @@ namespace Monopoly.InterfaceAdapterLayer.Server.Repositories.Inquiries; /// internal class GameExistenceInquiry(FakeInMemoryDatabase database) : IGameExistenceInquiry { - public bool CheckGameExistence(string gameId) + public async Task CheckGameExistenceAsync(string gameId) { - var monopoly = database.FindByIdAsync(gameId); + var monopoly = await database.FindByIdAsync(gameId); return monopoly is not null; } } \ No newline at end of file