diff --git a/Application/Api/GetCardsQuery.cs b/Application/Api/GetCardsQuery.cs new file mode 100644 index 0000000..e2ee86c --- /dev/null +++ b/Application/Api/GetCardsQuery.cs @@ -0,0 +1,18 @@ +namespace Application.Api; + +public record GetCardsQuery() : IRequestWrapper>; + +public class GetCardsQueryHandler : RequestHandlerBase> +{ + public GetCardsQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate) + { + } + + public override async Task>> Handle(GetCardsQuery request, CancellationToken cancellationToken) + { + var cards = await CardDbContext.CardMains.ToListAsync(cancellationToken: cancellationToken); + var dtoList = cards.Select(card => card.CardMainToClientDto()).ToList(); + + return new ServiceResult>(dtoList); + } +} \ No newline at end of file diff --git a/Application/Api/GetPlayOptionQuery.cs b/Application/Api/GetPlayOptionQuery.cs new file mode 100644 index 0000000..e51d89b --- /dev/null +++ b/Application/Api/GetPlayOptionQuery.cs @@ -0,0 +1,41 @@ +namespace Application.Api; + +public record GetPlayOptionQuery(long CardId) : IRequestWrapper; + +public class GetPlayOptionQueryHandler : RequestHandlerBase +{ + public GetPlayOptionQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate) + { + } + + public override async Task> Handle(GetPlayOptionQuery request, + CancellationToken cancellationToken) + { + var optionDetail1 = await CardDbContext.CardDetails.FirstOrDefaultAsync(detail => + detail.CardId == request.CardId && + detail.Pcol1 == 0 && + detail.Pcol2 == 0 && + detail.Pcol3 == 0, + cancellationToken: cancellationToken); + var optionDetail2 = await CardDbContext.CardDetails.FirstOrDefaultAsync(detail => + detail.CardId == request.CardId && + detail.Pcol1 == 1 && + detail.Pcol2 == 0 && + detail.Pcol3 == 0, + cancellationToken: cancellationToken); + if (optionDetail1 is null || + optionDetail2 is null) + { + return ServiceResult.Failed(ServiceError.CustomMessage("At least one of the play option records not found")); + } + + var result = new PlayOptionData + { + CardId = request.CardId, + OptionPart1 = optionDetail1.CardDetailToFirstOption(), + OptionPart2 = optionDetail2.CardDetailToSecondOption() + }; + + return new ServiceResult(result); + } +} \ No newline at end of file diff --git a/Application/Api/GetTotalResultQuery.cs b/Application/Api/GetTotalResultQuery.cs new file mode 100644 index 0000000..36cb635 --- /dev/null +++ b/Application/Api/GetTotalResultQuery.cs @@ -0,0 +1,79 @@ +using Microsoft.Extensions.Logging; + +namespace Application.Api; + +public record GetTotalResultQuery(long CardId) : IRequestWrapper; + +public class GetTotalResultQueryHandler : RequestHandlerBase +{ + private const int S_SCORE = 900000; + private const int SS_SCORE = 950000; + private const int SSS_SCORE = 990000; + + private readonly ILogger logger; + + public GetTotalResultQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + { + this.logger = logger; + } + + public override async Task> Handle(GetTotalResultQuery request, CancellationToken cancellationToken) + { + var card = await CardDbContext.CardMains.FirstOrDefaultAsync(card => card.CardId == request.CardId, cancellationToken); + if (card is null) + { + logger.LogWarning("Trying to get total result for non existing card: {CardId}", request.CardId); + return ServiceResult.Failed(ServiceError.UserNotFound); + } + + var result = new TotalResultData + { + CardId = card.CardId, + PlayerName = card.PlayerName + }; + + var totalSongCount = await MusicDbContext.MusicUnlocks.CountAsync(cancellationToken: cancellationToken); + var totalExtraCount = await MusicDbContext.MusicExtras.CountAsync(cancellationToken: cancellationToken); + var totalStageCount = totalSongCount * 3 + totalExtraCount; + result.PlayerData.TotalSongCount = totalSongCount; + result.StageCountData.Total = totalStageCount; + + var playedStageDetails = await CardDbContext.CardDetails.Where(detail => + detail.CardId == request.CardId && + detail.Pcol1 == 20).ToListAsync(cancellationToken: cancellationToken); + + var playedStageScores = await CardDbContext.CardDetails.Where(detail => + detail.CardId == request.CardId && + detail.Pcol1 == 21).ToListAsync(cancellationToken: cancellationToken); + + var playedSongCount = playedStageDetails.DistinctBy(detail => detail.Pcol2).Count(); + var playedStageCount = playedStageDetails.Count; + var clearedStageCount = playedStageDetails.Count(detail => detail.ScoreUi2 > 0); + var noMissStageCount = playedStageDetails.Count(detail => detail.ScoreUi3 > 0); + var fullChainStageCount = playedStageDetails.Count(detail => detail.ScoreUi4 > 0); + var perfectStageCount = playedStageDetails.Count(detail => detail.ScoreUi6 > 0); + + var sStageCount = playedStageScores.Count(detail => detail.ScoreUi1 > S_SCORE); + var ssStageCount = playedStageScores.Count(detail => detail.ScoreUi1 > SS_SCORE); + var sssStageCount = playedStageScores.Count(detail => detail.ScoreUi1 > SSS_SCORE); + result.PlayerData.PlayedSongCount = playedSongCount; + result.StageCountData.Cleared = clearedStageCount; + result.StageCountData.NoMiss = noMissStageCount; + result.StageCountData.FullChain = fullChainStageCount; + result.StageCountData.Perfect = perfectStageCount; + result.StageCountData.S = sStageCount; + result.StageCountData.Ss = ssStageCount; + result.StageCountData.Sss = sssStageCount; + + var totalScore = playedStageScores.Sum(detail => detail.ScoreUi1); + var averageScore = playedStageCount == 0 ? 0 : totalScore / playedStageCount; + result.PlayerData.TotalScore = totalScore; + result.PlayerData.AverageScore = (int)averageScore; + + var rank = await CardDbContext.GlobalScoreRanks.FirstOrDefaultAsync(rank => rank.CardId == request.CardId, + cancellationToken: cancellationToken); + result.PlayerData.Rank = (int)(rank?.Rank ?? -1); + + return new ServiceResult(result); + } +} \ No newline at end of file diff --git a/Application/Api/SetFavoriteMusicCommand.cs b/Application/Api/SetFavoriteMusicCommand.cs new file mode 100644 index 0000000..5342c35 --- /dev/null +++ b/Application/Api/SetFavoriteMusicCommand.cs @@ -0,0 +1,39 @@ +using Microsoft.Extensions.Logging; + +namespace Application.Api; + +public record SetFavoriteMusicCommand(MusicDetailDto Data) : IRequestWrapper; + +public class SetFavoriteMusicCommandHandler : RequestHandlerBase +{ + private readonly ILogger logger; + + public SetFavoriteMusicCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + { + this.logger = logger; + } + + public override async Task> Handle(SetFavoriteMusicCommand request, + CancellationToken cancellationToken) + { + var musicDetail = await CardDbContext.CardDetails.FirstOrDefaultAsync(detail => + detail.CardId == request.Data.CardId && + detail.Pcol1 == 10 && + detail.Pcol2 == request.Data.MusicId && + detail.Pcol3 == 0, + cancellationToken); + + if (musicDetail is null) + { + logger.LogWarning("Attempt to set favorite for non existing music, card id: {CardId}, music id: {MusicId}", + request.Data.CardId, request.Data.MusicId); + return ServiceResult.Failed(ServiceError.CustomMessage("Music record not found")); + } + + musicDetail.Fcol1 = request.Data.IsFavorite ? 1 : 0; + CardDbContext.CardDetails.Update(musicDetail); + var count = await CardDbContext.SaveChangesAsync(cancellationToken); + + return count == 1 ? new ServiceResult(true) : ServiceResult.Failed(ServiceError.DatabaseSaveFailed); + } +} \ No newline at end of file diff --git a/Application/Api/SetPlayOptionCommand.cs b/Application/Api/SetPlayOptionCommand.cs new file mode 100644 index 0000000..427bd92 --- /dev/null +++ b/Application/Api/SetPlayOptionCommand.cs @@ -0,0 +1,48 @@ +using Microsoft.Extensions.Logging; + +namespace Application.Api; + +public record SetPlayOptionCommand(PlayOptionData Data) : IRequestWrapper; + +public class SetPlayOptionCommandHandler : RequestHandlerBase +{ + private readonly ILogger logger; + + public SetPlayOptionCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + { + this.logger = logger; + } + + public override async Task> Handle(SetPlayOptionCommand request, CancellationToken cancellationToken) + { + var optionDetail1 = await CardDbContext.CardDetails.FirstOrDefaultAsync(detail => + detail.CardId == request.Data.CardId && + detail.Pcol1 == 0 && + detail.Pcol2 == 0 && + detail.Pcol3 == 0, + cancellationToken: cancellationToken); + var optionDetail2 = await CardDbContext.CardDetails.FirstOrDefaultAsync(detail => + detail.CardId == request.Data.CardId && + detail.Pcol1 == 1 && + detail.Pcol2 == 0 && + detail.Pcol3 == 0, + cancellationToken: cancellationToken); + + if (optionDetail1 is null || + optionDetail2 is null) + { + logger.LogWarning("Attempt to set play options for card id {CardId} failed due to missing data", + request.Data.CardId); + return ServiceResult.Failed(ServiceError.CustomMessage("At least one of the play option records not found")); + } + + request.Data.OptionPart1.MapFirstOptionDetail(optionDetail1); + request.Data.OptionPart2.MapSecondOptionDetail(optionDetail2); + + CardDbContext.CardDetails.Update(optionDetail1); + CardDbContext.CardDetails.Update(optionDetail2); + + var count = await CardDbContext.SaveChangesAsync(cancellationToken); + return count == 1 ? new ServiceResult(true) : ServiceResult.Failed(ServiceError.DatabaseSaveFailed); + } +} \ No newline at end of file diff --git a/Application/Api/SetPlayerNameCommand.cs b/Application/Api/SetPlayerNameCommand.cs new file mode 100644 index 0000000..797346d --- /dev/null +++ b/Application/Api/SetPlayerNameCommand.cs @@ -0,0 +1,33 @@ +using Application.Common.Helpers; +using Microsoft.Extensions.Logging; + +namespace Application.Api; + +public record SetPlayerNameCommand(ClientCardDto Card) : IRequestWrapper; + +public class SetPlayerNameCommandHandler : RequestHandlerBase +{ + private readonly ILogger logger; + public SetPlayerNameCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + { + this.logger = logger; + } + + public override async Task> Handle(SetPlayerNameCommand request, CancellationToken cancellationToken) + { + var card = await CardDbContext.CardMains.FirstOrDefaultAsync(card => card.CardId == request.Card.CardId, cancellationToken: cancellationToken); + + if (card is null) + { + logger.LogWarning("Attempt to set name for a non existing card {CardId}", request.Card.CardId); + return ServiceResult.Failed(ServiceError.UserNotFound); + } + + card.PlayerName = request.Card.PlayerName; + card.Modified = TimeHelper.CurrentTimeToString(); + + CardDbContext.CardMains.Update(card); + var count = await CardDbContext.SaveChangesAsync(cancellationToken); + return count == 1 ? new ServiceResult(true) : ServiceResult.Failed(ServiceError.DatabaseSaveFailed); + } +} \ No newline at end of file diff --git a/Application/Game/Card/CardRequestHandlerBase.cs b/Application/Common/Base/RequestHandlerBase.cs similarity index 71% rename from Application/Game/Card/CardRequestHandlerBase.cs rename to Application/Common/Base/RequestHandlerBase.cs index 1b58983..b767283 100644 --- a/Application/Game/Card/CardRequestHandlerBase.cs +++ b/Application/Common/Base/RequestHandlerBase.cs @@ -1,8 +1,8 @@ using Domain.Config; -namespace Application.Game.Card; +namespace Application.Common.Base; -public abstract class CardRequestHandlerBase: IRequestHandlerWrapper +public abstract class RequestHandlerBase: IRequestHandlerWrapper where TIn : IRequestWrapper { protected ICardDbContext CardDbContext { get; } @@ -10,7 +10,7 @@ public abstract class CardRequestHandlerBase: IRequestHandlerWrapper< protected GameConfig Config { get; } - public CardRequestHandlerBase(ICardDependencyAggregate aggregate) + public RequestHandlerBase(ICardDependencyAggregate aggregate) { CardDbContext = aggregate.CardDbContext; MusicDbContext = aggregate.MusicDbContext; diff --git a/Application/Common/Models/PlayOptionData.cs b/Application/Common/Models/PlayOptionData.cs new file mode 100644 index 0000000..904db05 --- /dev/null +++ b/Application/Common/Models/PlayOptionData.cs @@ -0,0 +1,10 @@ +namespace Application.Common.Models; + +public class PlayOptionData +{ + public long CardId { get; set; } + + public FirstPlayOptionDto OptionPart1 { get; set; } = new(); + + public SecondPlayOptionDto OptionPart2 { get; set; } = new(); +} \ No newline at end of file diff --git a/Application/Common/Models/ServiceError.cs b/Application/Common/Models/ServiceError.cs index 628b13a..851c24d 100644 --- a/Application/Common/Models/ServiceError.cs +++ b/Application/Common/Models/ServiceError.cs @@ -61,9 +61,11 @@ public class ServiceError return new ServiceError(errorMessage, (int)CardReturnCode.Unknown); } + public static ServiceError DatabaseSaveFailed => new ServiceError("Database save failed", 800); + public static ServiceError NotReissue => new ServiceError("Not reissue, registering a new card", (int)CardReturnCode.NotReissue); - public static ServiceError UserNotFound => new("User with this id does not exist", 996); + public static ServiceError UserNotFound => new("Card with this id does not exist", 996); public static ServiceError UserFailedToCreate => new("Failed to create User.", 995); diff --git a/Application/Common/Models/TotalResultData.cs b/Application/Common/Models/TotalResultData.cs new file mode 100644 index 0000000..fa0c97f --- /dev/null +++ b/Application/Common/Models/TotalResultData.cs @@ -0,0 +1,44 @@ +namespace Application.Common.Models; + +public class TotalResultData +{ + public long CardId { get; set; } + + public string PlayerName { get; set; } = string.Empty; + + public PlayerData PlayerData { get; set; } = new(); + + public StageCountData StageCountData { get; set; } = new(); +} + +public class PlayerData +{ + public long TotalScore { get; set; } + + public int AverageScore { get; set; } + + public int TotalSongCount { get; set; } + + public int PlayedSongCount { get; set; } + + public int Rank { get; set; } +} + +public class StageCountData +{ + public int Total { get; set; } + + public int Cleared { get; set; } + + public int NoMiss { get; set; } + + public int FullChain { get; set; } + + public int S { get; set; } + + public int Ss { get; set; } + + public int Sss { get; set; } + + public int Perfect { get; set; } +} \ No newline at end of file diff --git a/Application/Dto/Api/ClientCardDto.cs b/Application/Dto/Api/ClientCardDto.cs new file mode 100644 index 0000000..40afae5 --- /dev/null +++ b/Application/Dto/Api/ClientCardDto.cs @@ -0,0 +1,8 @@ +namespace Application.Dto.Api; + +public class ClientCardDto +{ + public long CardId { get; set; } + + public string PlayerName { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/Application/Dto/Api/FirstPlayOptionDto.cs b/Application/Dto/Api/FirstPlayOptionDto.cs new file mode 100644 index 0000000..96ff164 --- /dev/null +++ b/Application/Dto/Api/FirstPlayOptionDto.cs @@ -0,0 +1,16 @@ +using Domain.Enums; + +namespace Application.Dto.Api; + +public class FirstPlayOptionDto +{ + public long CardId { get; set; } + + public long AvatarId { get; set; } + + public int TitleId { get; set; } + + public ShowFastSlowOption ShowFastSlowOption { get; set; } + + public ShowFeverTranceOption ShowFeverTranceOption { get; set; } +} \ No newline at end of file diff --git a/Application/Dto/Api/MusicDetailDto.cs b/Application/Dto/Api/MusicDetailDto.cs new file mode 100644 index 0000000..c544cea --- /dev/null +++ b/Application/Dto/Api/MusicDetailDto.cs @@ -0,0 +1,10 @@ +namespace Application.Dto.Api; + +public class MusicDetailDto +{ + public long CardId { get; set; } + + public int MusicId { get; set; } + + public bool IsFavorite { get; set; } +} \ No newline at end of file diff --git a/Application/Dto/Api/SecondPlayOptionDto.cs b/Application/Dto/Api/SecondPlayOptionDto.cs new file mode 100644 index 0000000..ce50e0a --- /dev/null +++ b/Application/Dto/Api/SecondPlayOptionDto.cs @@ -0,0 +1,8 @@ +namespace Application.Dto.Api; + +public class SecondPlayOptionDto +{ + public long CardId { get; set; } + + public long NavigatorId { get; set; } +} \ No newline at end of file diff --git a/Application/Dto/AvatarDto.cs b/Application/Dto/Game/AvatarDto.cs similarity index 95% rename from Application/Dto/AvatarDto.cs rename to Application/Dto/Game/AvatarDto.cs index fb639a0..b2cdfd2 100644 --- a/Application/Dto/AvatarDto.cs +++ b/Application/Dto/Game/AvatarDto.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace Application.Dto; +namespace Application.Dto.Game; public class AvatarDto { diff --git a/Application/Dto/CardBDatumDto.cs b/Application/Dto/Game/CardBDatumDto.cs similarity index 89% rename from Application/Dto/CardBDatumDto.cs rename to Application/Dto/Game/CardBDatumDto.cs index 3d55d21..36eb7ea 100644 --- a/Application/Dto/CardBDatumDto.cs +++ b/Application/Dto/Game/CardBDatumDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class CardBDatumDto { diff --git a/Application/Dto/CardDetailDto.cs b/Application/Dto/Game/CardDetailDto.cs similarity index 98% rename from Application/Dto/CardDetailDto.cs rename to Application/Dto/Game/CardDetailDto.cs index f259f5d..084d6ed 100644 --- a/Application/Dto/CardDetailDto.cs +++ b/Application/Dto/Game/CardDetailDto.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace Application.Dto; +namespace Application.Dto.Game; public class CardDetailDto { diff --git a/Application/Dto/CardDto.cs b/Application/Dto/Game/CardDto.cs similarity index 96% rename from Application/Dto/CardDto.cs rename to Application/Dto/Game/CardDto.cs index a0d9e37..b0f45f0 100644 --- a/Application/Dto/CardDto.cs +++ b/Application/Dto/Game/CardDto.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace Application.Dto; +namespace Application.Dto.Game; public class CardDto { diff --git a/Application/Dto/CoinDto.cs b/Application/Dto/Game/CoinDto.cs similarity index 93% rename from Application/Dto/CoinDto.cs rename to Application/Dto/Game/CoinDto.cs index 976d2bc..8cc8e04 100644 --- a/Application/Dto/CoinDto.cs +++ b/Application/Dto/Game/CoinDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class CoinDto { diff --git a/Application/Dto/ItemDto.cs b/Application/Dto/Game/ItemDto.cs similarity index 94% rename from Application/Dto/ItemDto.cs rename to Application/Dto/Game/ItemDto.cs index 31d07ed..8840fc9 100644 --- a/Application/Dto/ItemDto.cs +++ b/Application/Dto/Game/ItemDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class ItemDto { diff --git a/Application/Dto/MusicAouDto.cs b/Application/Dto/Game/MusicAouDto.cs similarity index 88% rename from Application/Dto/MusicAouDto.cs rename to Application/Dto/Game/MusicAouDto.cs index 67505be..d7be416 100644 --- a/Application/Dto/MusicAouDto.cs +++ b/Application/Dto/Game/MusicAouDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class MusicAouDto { diff --git a/Application/Dto/MusicDto.cs b/Application/Dto/Game/MusicDto.cs similarity index 95% rename from Application/Dto/MusicDto.cs rename to Application/Dto/Game/MusicDto.cs index 1f62d83..b0de7c4 100644 --- a/Application/Dto/MusicDto.cs +++ b/Application/Dto/Game/MusicDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class MusicDto { diff --git a/Application/Dto/MusicExtraDto.cs b/Application/Dto/Game/MusicExtraDto.cs similarity index 88% rename from Application/Dto/MusicExtraDto.cs rename to Application/Dto/Game/MusicExtraDto.cs index fbae5f9..3a996e9 100644 --- a/Application/Dto/MusicExtraDto.cs +++ b/Application/Dto/Game/MusicExtraDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class MusicExtraDto { diff --git a/Application/Dto/NavigatorDto.cs b/Application/Dto/Game/NavigatorDto.cs similarity index 94% rename from Application/Dto/NavigatorDto.cs rename to Application/Dto/Game/NavigatorDto.cs index d4cbaa1..8161434 100644 --- a/Application/Dto/NavigatorDto.cs +++ b/Application/Dto/Game/NavigatorDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class NavigatorDto { diff --git a/Application/Dto/PlayNumRankDto.cs b/Application/Dto/Game/PlayNumRankDto.cs similarity index 94% rename from Application/Dto/PlayNumRankDto.cs rename to Application/Dto/Game/PlayNumRankDto.cs index 30bbc50..2f81642 100644 --- a/Application/Dto/PlayNumRankDto.cs +++ b/Application/Dto/Game/PlayNumRankDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class PlayNumRankDto { diff --git a/Application/Dto/ScoreRankDto.cs b/Application/Dto/Game/ScoreRankDto.cs similarity index 97% rename from Application/Dto/ScoreRankDto.cs rename to Application/Dto/Game/ScoreRankDto.cs index 212075a..36b2f26 100644 --- a/Application/Dto/ScoreRankDto.cs +++ b/Application/Dto/Game/ScoreRankDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class ScoreRankDto { diff --git a/Application/Dto/SessionDto.cs b/Application/Dto/Game/SessionDto.cs similarity index 93% rename from Application/Dto/SessionDto.cs rename to Application/Dto/Game/SessionDto.cs index df7c25e..834d7d9 100644 --- a/Application/Dto/SessionDto.cs +++ b/Application/Dto/Game/SessionDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class SessionDto { diff --git a/Application/Dto/SkinDto.cs b/Application/Dto/Game/SkinDto.cs similarity index 94% rename from Application/Dto/SkinDto.cs rename to Application/Dto/Game/SkinDto.cs index c17fb3b..ff5ab46 100644 --- a/Application/Dto/SkinDto.cs +++ b/Application/Dto/Game/SkinDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class SkinDto { diff --git a/Application/Dto/SoundEffectDto.cs b/Application/Dto/Game/SoundEffectDto.cs similarity index 94% rename from Application/Dto/SoundEffectDto.cs rename to Application/Dto/Game/SoundEffectDto.cs index 825f0c9..d41464a 100644 --- a/Application/Dto/SoundEffectDto.cs +++ b/Application/Dto/Game/SoundEffectDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class SoundEffectDto { diff --git a/Application/Dto/TitleDto.cs b/Application/Dto/Game/TitleDto.cs similarity index 94% rename from Application/Dto/TitleDto.cs rename to Application/Dto/Game/TitleDto.cs index 9262661..b99660e 100644 --- a/Application/Dto/TitleDto.cs +++ b/Application/Dto/Game/TitleDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class TitleDto { diff --git a/Application/Dto/TotalTrophyDto.cs b/Application/Dto/Game/TotalTrophyDto.cs similarity index 85% rename from Application/Dto/TotalTrophyDto.cs rename to Application/Dto/Game/TotalTrophyDto.cs index b074fd4..7f696a1 100644 --- a/Application/Dto/TotalTrophyDto.cs +++ b/Application/Dto/Game/TotalTrophyDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class TotalTrophyDto { diff --git a/Application/Dto/UnlockKeyNumDto.cs b/Application/Dto/Game/UnlockKeyNumDto.cs similarity index 95% rename from Application/Dto/UnlockKeyNumDto.cs rename to Application/Dto/Game/UnlockKeyNumDto.cs index a9d2da2..c3c8ff5 100644 --- a/Application/Dto/UnlockKeyNumDto.cs +++ b/Application/Dto/Game/UnlockKeyNumDto.cs @@ -1,4 +1,4 @@ -namespace Application.Dto; +namespace Application.Dto.Game; public class UnlockKeyNumDto { diff --git a/Application/Game/Card/Management/CardRegisterCommand.cs b/Application/Game/Card/Management/CardRegisterCommand.cs index 3c2b2fd..df9b14c 100644 --- a/Application/Game/Card/Management/CardRegisterCommand.cs +++ b/Application/Game/Card/Management/CardRegisterCommand.cs @@ -2,9 +2,9 @@ public record CardRegisterCommand(long CardId, string Data) : IRequestWrapper; -public class CardRegisterCommandHandler : CardRequestHandlerBase +public class RegisterCommandHandler : RequestHandlerBase { - public CardRegisterCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) + public RegisterCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) { } diff --git a/Application/Game/Card/Management/CardReissueCommand.cs b/Application/Game/Card/Management/CardReissueCommand.cs index 6b51d74..ed36bee 100644 --- a/Application/Game/Card/Management/CardReissueCommand.cs +++ b/Application/Game/Card/Management/CardReissueCommand.cs @@ -2,9 +2,9 @@ public record CardReissueCommand(long CardId) : IRequestWrapper; -public class CardReissueCommandHandler : CardRequestHandlerBase +public class ReissueCommandHandler : RequestHandlerBase { - public CardReissueCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) + public ReissueCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) { } diff --git a/Application/Game/Card/OnlineMatching/StartOnlineMatchingCommand.cs b/Application/Game/Card/OnlineMatching/StartOnlineMatchingCommand.cs index e07b4cd..5ab8ef5 100644 --- a/Application/Game/Card/OnlineMatching/StartOnlineMatchingCommand.cs +++ b/Application/Game/Card/OnlineMatching/StartOnlineMatchingCommand.cs @@ -2,7 +2,7 @@ public record StartOnlineMatchingCommand(long CardId, string Data) : IRequestWrapper; -public class StartOnlineMatchingCommandHandler : CardRequestHandlerBase +public class StartOnlineMatchingCommandHandler : RequestHandlerBase { public StartOnlineMatchingCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) { diff --git a/Application/Game/Card/OnlineMatching/UpdateOnlineMatchingCommand.cs b/Application/Game/Card/OnlineMatching/UpdateOnlineMatchingCommand.cs index 0ad5b21..aa749c7 100644 --- a/Application/Game/Card/OnlineMatching/UpdateOnlineMatchingCommand.cs +++ b/Application/Game/Card/OnlineMatching/UpdateOnlineMatchingCommand.cs @@ -2,7 +2,7 @@ public record UpdateOnlineMatchingCommand(long CardId, string Data) : IRequestWrapper; -public class UpdateOnlineMatchingCommandHandler : CardRequestHandlerBase +public class UpdateOnlineMatchingCommandHandler : RequestHandlerBase { public UpdateOnlineMatchingCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) { diff --git a/Application/Game/Card/OnlineMatching/UploadOnlineMatchingResultCommand.cs b/Application/Game/Card/OnlineMatching/UploadOnlineMatchingResultCommand.cs index 7880dca..4aaf06c 100644 --- a/Application/Game/Card/OnlineMatching/UploadOnlineMatchingResultCommand.cs +++ b/Application/Game/Card/OnlineMatching/UploadOnlineMatchingResultCommand.cs @@ -2,7 +2,7 @@ public record UploadOnlineMatchingResultCommand(long CardId, string Data) : IRequestWrapper; -public class UploadOnlineMatchingResultCommandHandler : CardRequestHandlerBase +public class UploadOnlineMatchingResultCommandHandler : RequestHandlerBase { public UploadOnlineMatchingResultCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) { diff --git a/Application/Game/Card/Read/ReadAllCardDetailsQuery.cs b/Application/Game/Card/Read/ReadAllCardDetailsQuery.cs index abc7ede..07e037c 100644 --- a/Application/Game/Card/Read/ReadAllCardDetailsQuery.cs +++ b/Application/Game/Card/Read/ReadAllCardDetailsQuery.cs @@ -7,14 +7,14 @@ namespace Application.Game.Card.Read; public record ReadAllCardDetailsQuery(long CardId) : IRequestWrapper; -public class ReadAllCardDetailsQueryHandler : CardRequestHandlerBase +public class ReadAllDetailsQueryHandler : RequestHandlerBase { private const string CARD_DETAILS_XPATH = "/root/card_detail"; private const string RECORD_XPATH = $"{CARD_DETAILS_XPATH}/record"; - private readonly ILogger logger; + private readonly ILogger logger; - public ReadAllCardDetailsQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + public ReadAllDetailsQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) { this.logger = logger; } diff --git a/Application/Game/Card/Read/ReadAvatarQuery.cs b/Application/Game/Card/Read/ReadAvatarQuery.cs index f3e6cce..ab328e0 100644 --- a/Application/Game/Card/Read/ReadAvatarQuery.cs +++ b/Application/Game/Card/Read/ReadAvatarQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadAvatarQuery(long CardId) : IRequestWrapper; -public class ReadAvatarQueryHandler : CardRequestHandlerBase +public class ReadAvatarQueryHandler : RequestHandlerBase { private const string AVATAR_XPATH = "/root/avatar/record"; diff --git a/Application/Game/Card/Read/ReadCardBDataQuery.cs b/Application/Game/Card/Read/ReadCardBDataQuery.cs index a784147..3d18f4e 100644 --- a/Application/Game/Card/Read/ReadCardBDataQuery.cs +++ b/Application/Game/Card/Read/ReadCardBDataQuery.cs @@ -6,13 +6,13 @@ namespace Application.Game.Card.Read; public record ReadCardBDataQuery(long CardId) : IRequestWrapper; -public class ReadCardBDataQueryHandler : CardRequestHandlerBase +public class ReadBDataQueryHandler : RequestHandlerBase { private const string CARD_BDATA_XPATH = "/root/card_bdata"; - private readonly ILogger logger; + private readonly ILogger logger; - public ReadCardBDataQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + public ReadBDataQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) { this.logger = logger; } diff --git a/Application/Game/Card/Read/ReadCardDetailQuery.cs b/Application/Game/Card/Read/ReadCardDetailQuery.cs index df8b2b8..f5d147b 100644 --- a/Application/Game/Card/Read/ReadCardDetailQuery.cs +++ b/Application/Game/Card/Read/ReadCardDetailQuery.cs @@ -6,13 +6,13 @@ namespace Application.Game.Card.Read; public record ReadCardDetailQuery(long CardId, string Data) : IRequestWrapper; -public class ReadCardDetailQueryHandler : CardRequestHandlerBase +public class ReadDetailQueryHandler : RequestHandlerBase { private const string CARD_DETAILS_XPATH = "/root/card_detail"; - private readonly ILogger logger; + private readonly ILogger logger; - public ReadCardDetailQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + public ReadDetailQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) { this.logger = logger; } diff --git a/Application/Game/Card/Read/ReadCardQuery.cs b/Application/Game/Card/Read/ReadCardQuery.cs index 1d65a08..963f9f7 100644 --- a/Application/Game/Card/Read/ReadCardQuery.cs +++ b/Application/Game/Card/Read/ReadCardQuery.cs @@ -5,11 +5,11 @@ namespace Application.Game.Card.Read; public record ReadCardQuery(long CardId) : IRequestWrapper; -public class ReadCardQueryHandler : CardRequestHandlerBase +public class ReadQueryHandler : RequestHandlerBase { - private readonly ILogger logger; + private readonly ILogger logger; - public ReadCardQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) { + public ReadQueryHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) { this.logger = logger; } diff --git a/Application/Game/Card/Read/ReadCoinQuery.cs b/Application/Game/Card/Read/ReadCoinQuery.cs index 752025f..ba6a6f3 100644 --- a/Application/Game/Card/Read/ReadCoinQuery.cs +++ b/Application/Game/Card/Read/ReadCoinQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadCoinQuery(long CardId) : IRequestWrapper; -public class ReadCoinQueryHandler : CardRequestHandlerBase +public class ReadCoinQueryHandler : RequestHandlerBase { private const string COIN_XPATH = "/root/coin"; diff --git a/Application/Game/Card/Read/ReadCondQuery.cs b/Application/Game/Card/Read/ReadCondQuery.cs index 1dcbdcd..382c00e 100644 --- a/Application/Game/Card/Read/ReadCondQuery.cs +++ b/Application/Game/Card/Read/ReadCondQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadCondQuery(long CardId) : IRequestWrapper; -public class ReadCondQueryHandler : CardRequestHandlerBase +public class ReadCondQueryHandler : RequestHandlerBase { private const string COND_XPATH = "/root/cond"; diff --git a/Application/Game/Card/Read/ReadEventRewardQuery.cs b/Application/Game/Card/Read/ReadEventRewardQuery.cs index 4c0248d..8d4b879 100644 --- a/Application/Game/Card/Read/ReadEventRewardQuery.cs +++ b/Application/Game/Card/Read/ReadEventRewardQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadEventRewardQuery(long CardId) : IRequestWrapper; -public class ReadEventRewardQueryHandler : CardRequestHandlerBase +public class ReadEventRewardQueryHandler : RequestHandlerBase { private const string EVENT_REWARD_XPATH = "/root/event_reward"; diff --git a/Application/Game/Card/Read/ReadGetMessageQuery.cs b/Application/Game/Card/Read/ReadGetMessageQuery.cs index e540240..d8e68df 100644 --- a/Application/Game/Card/Read/ReadGetMessageQuery.cs +++ b/Application/Game/Card/Read/ReadGetMessageQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadGetMessageQuery(long CardId) : IRequestWrapper; -public class ReadGetMessageQueryHandler : CardRequestHandlerBase +public class ReadGetMessageQueryHandler : RequestHandlerBase { private const string GET_MESSAGE_XPATH = "/root/get_message"; diff --git a/Application/Game/Card/Read/ReadItemQuery.cs b/Application/Game/Card/Read/ReadItemQuery.cs index 380db18..2b82200 100644 --- a/Application/Game/Card/Read/ReadItemQuery.cs +++ b/Application/Game/Card/Read/ReadItemQuery.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Read; public record ReadItemQuery(long CardId) : IRequestWrapper; -public class ReadItemQueryHandler : CardRequestHandlerBase +public class ReadItemQueryHandler : RequestHandlerBase { private const string ITEM_XPATH = "/root/item/record"; diff --git a/Application/Game/Card/Read/ReadMusicAouQuery.cs b/Application/Game/Card/Read/ReadMusicAouQuery.cs index 34bc39b..7c0e49c 100644 --- a/Application/Game/Card/Read/ReadMusicAouQuery.cs +++ b/Application/Game/Card/Read/ReadMusicAouQuery.cs @@ -5,7 +5,7 @@ namespace Application.Game.Card.Read; public record ReadMusicAouQuery(long CardId) : IRequestWrapper; -public class ReadMusicAouQueryHandler : CardRequestHandlerBase +public class ReadMusicAouQueryHandler : RequestHandlerBase { private const string MUSIC_AOU_XPATH = "/root/music_aou"; diff --git a/Application/Game/Card/Read/ReadMusicExtraQuery.cs b/Application/Game/Card/Read/ReadMusicExtraQuery.cs index 7e6038a..434500a 100644 --- a/Application/Game/Card/Read/ReadMusicExtraQuery.cs +++ b/Application/Game/Card/Read/ReadMusicExtraQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadMusicExtraQuery(long CardId) : IRequestWrapper; -public class ReadMusicExtraQueryHandler : CardRequestHandlerBase +public class ReadMusicExtraQueryHandler : RequestHandlerBase { private const string MUSIC_EXTRA_XPATH = "/root/music_extra"; diff --git a/Application/Game/Card/Read/ReadMusicQuery.cs b/Application/Game/Card/Read/ReadMusicQuery.cs index 59055c6..b2736a1 100644 --- a/Application/Game/Card/Read/ReadMusicQuery.cs +++ b/Application/Game/Card/Read/ReadMusicQuery.cs @@ -5,7 +5,7 @@ namespace Application.Game.Card.Read; public record ReadMusicQuery(long CardId) : IRequestWrapper; -public class ReadMusicQueryHandler : CardRequestHandlerBase +public class ReadMusicQueryHandler : RequestHandlerBase { private const string MUSIC_XPATH = "/root/music/record"; public ReadMusicQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate) diff --git a/Application/Game/Card/Read/ReadNavigatorQuery.cs b/Application/Game/Card/Read/ReadNavigatorQuery.cs index 28f22ff..fe43153 100644 --- a/Application/Game/Card/Read/ReadNavigatorQuery.cs +++ b/Application/Game/Card/Read/ReadNavigatorQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadNavigatorQuery(long CardId) : IRequestWrapper; -public class ReadNavigatorQueryHandler : CardRequestHandlerBase +public class ReadNavigatorQueryHandler : RequestHandlerBase { private const string NAVIGATOR_XPATH = "/root/navigator/record"; diff --git a/Application/Game/Card/Read/ReadSkinQuery.cs b/Application/Game/Card/Read/ReadSkinQuery.cs index 7431fb6..aa590bf 100644 --- a/Application/Game/Card/Read/ReadSkinQuery.cs +++ b/Application/Game/Card/Read/ReadSkinQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadSkinQuery(long CardId) : IRequestWrapper; -public class ReadSkinQueryHandler : CardRequestHandlerBase +public class ReadSkinQueryHandler : RequestHandlerBase { private const string SKIN_XPATH = "/root/skin/record"; diff --git a/Application/Game/Card/Read/ReadSoundEffectQuery.cs b/Application/Game/Card/Read/ReadSoundEffectQuery.cs index a20fb90..6976fc1 100644 --- a/Application/Game/Card/Read/ReadSoundEffectQuery.cs +++ b/Application/Game/Card/Read/ReadSoundEffectQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadSoundEffectQuery(long CardId) : IRequestWrapper; -public class ReadSoundEffectQueryHandler : CardRequestHandlerBase +public class ReadSoundEffectQueryHandler : RequestHandlerBase { private const string SOUND_EFFECT_XPATH = "/root/sound_effect/record"; public ReadSoundEffectQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate) diff --git a/Application/Game/Card/Read/ReadTitleQuery.cs b/Application/Game/Card/Read/ReadTitleQuery.cs index f78fc7a..45dcd07 100644 --- a/Application/Game/Card/Read/ReadTitleQuery.cs +++ b/Application/Game/Card/Read/ReadTitleQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadTitleQuery(long CardId) : IRequestWrapper; -public class ReadTitleQueryHandler : CardRequestHandlerBase +public class ReadTitleQueryHandler : RequestHandlerBase { private const string TITLE_XPATH = "/root/title/record"; diff --git a/Application/Game/Card/Read/ReadTotalTrophyQuery.cs b/Application/Game/Card/Read/ReadTotalTrophyQuery.cs index 61fb23f..67f7c8d 100644 --- a/Application/Game/Card/Read/ReadTotalTrophyQuery.cs +++ b/Application/Game/Card/Read/ReadTotalTrophyQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadTotalTrophyQuery(long CardId) : IRequestWrapper; -public class ReadTotalTrophyQueryHandler : CardRequestHandlerBase +public class ReadTotalTrophyQueryHandler : RequestHandlerBase { private const string TOTAL_TROPHY_XPATH = "/root/total_trophy"; diff --git a/Application/Game/Card/Read/ReadUnlockKeynumQuery.cs b/Application/Game/Card/Read/ReadUnlockKeynumQuery.cs index 45e6df0..747a76a 100644 --- a/Application/Game/Card/Read/ReadUnlockKeynumQuery.cs +++ b/Application/Game/Card/Read/ReadUnlockKeynumQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadUnlockKeynumQuery(long CardId) : IRequestWrapper; -public class ReadUnlockKeynumQueryHandler : CardRequestHandlerBase +public class ReadUnlockKeynumQueryHandler : RequestHandlerBase { private const string UNLOCK_KEYNUM_XPATH = "/root/unlock_keynum/record"; public ReadUnlockKeynumQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate) diff --git a/Application/Game/Card/Read/ReadUnlockRewardQuery.cs b/Application/Game/Card/Read/ReadUnlockRewardQuery.cs index 24c1ff0..2540d18 100644 --- a/Application/Game/Card/Read/ReadUnlockRewardQuery.cs +++ b/Application/Game/Card/Read/ReadUnlockRewardQuery.cs @@ -3,7 +3,7 @@ namespace Application.Game.Card.Read; public record ReadUnlockRewardQuery(long CardId) : IRequestWrapper; -public class ReadUnlockRewardQueryHandler : CardRequestHandlerBase +public class ReadUnlockRewardQueryHandler : RequestHandlerBase { private const string UNLOCK_REWARD_XPATH = "/root/unlock_reward/record"; diff --git a/Application/Game/Card/Session/GetSessionCommand.cs b/Application/Game/Card/Session/GetSessionCommand.cs index 829cb41..bdda5d2 100644 --- a/Application/Game/Card/Session/GetSessionCommand.cs +++ b/Application/Game/Card/Session/GetSessionCommand.cs @@ -2,7 +2,7 @@ public record GetSessionCommand(long CardId, string Mac) : IRequestWrapper; -public class GetSessionCommandHandler : CardRequestHandlerBase +public class GetSessionCommandHandler : RequestHandlerBase { private const string SESSION_XPATH = "/root/session"; diff --git a/Application/Game/Card/Write/WriteAvatarCommand.cs b/Application/Game/Card/Write/WriteAvatarCommand.cs index 17692d9..481a07b 100644 --- a/Application/Game/Card/Write/WriteAvatarCommand.cs +++ b/Application/Game/Card/Write/WriteAvatarCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteAvatarCommand(long CardId, string Data) : IRequestWrapper; -public class WriteAvatarCommandHandler : CardRequestHandlerBase +public class WriteAvatarCommandHandler : RequestHandlerBase { public WriteAvatarCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/Game/Card/Write/WriteCardBDataCommand.cs b/Application/Game/Card/Write/WriteCardBDataCommand.cs index d8bd127..bee48b9 100644 --- a/Application/Game/Card/Write/WriteCardBDataCommand.cs +++ b/Application/Game/Card/Write/WriteCardBDataCommand.cs @@ -5,11 +5,11 @@ namespace Application.Game.Card.Write; public record WriteCardBDataCommand(long CardId, string Data) : IRequestWrapper; -public class WriteCardBDataCommandHandler : CardRequestHandlerBase +public class WriteBDataCommandHandler : RequestHandlerBase { - private readonly ILogger logger; + private readonly ILogger logger; - public WriteCardBDataCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + public WriteBDataCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) { this.logger = logger; } diff --git a/Application/Game/Card/Write/WriteCardCommand.cs b/Application/Game/Card/Write/WriteCardCommand.cs index 67f1050..d2d3ce3 100644 --- a/Application/Game/Card/Write/WriteCardCommand.cs +++ b/Application/Game/Card/Write/WriteCardCommand.cs @@ -5,11 +5,11 @@ namespace Application.Game.Card.Write; public record WriteCardCommand(long CardId, string Data) : IRequestWrapper; -public class WriteCardCommandHandler : CardRequestHandlerBase +public class WriteCommandHandler : RequestHandlerBase { - private readonly ILogger logger; + private readonly ILogger logger; - public WriteCardCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + public WriteCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) { this.logger = logger; } diff --git a/Application/Game/Card/Write/WriteCardDetailCommand.cs b/Application/Game/Card/Write/WriteCardDetailCommand.cs index 0479c7f..ab861ff 100644 --- a/Application/Game/Card/Write/WriteCardDetailCommand.cs +++ b/Application/Game/Card/Write/WriteCardDetailCommand.cs @@ -5,11 +5,11 @@ namespace Application.Game.Card.Write; public record WriteCardDetailCommand(long CardId, string Data) : IRequestWrapper; -public class WriteCardDetailCommandHandler : CardRequestHandlerBase +public class WriteDetailCommandHandler : RequestHandlerBase { - private readonly ILogger logger; + private readonly ILogger logger; - public WriteCardDetailCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) + public WriteDetailCommandHandler(ICardDependencyAggregate aggregate, ILogger logger) : base(aggregate) { this.logger = logger; } diff --git a/Application/Game/Card/Write/WriteCoinCommand.cs b/Application/Game/Card/Write/WriteCoinCommand.cs index bfe59f5..4158578 100644 --- a/Application/Game/Card/Write/WriteCoinCommand.cs +++ b/Application/Game/Card/Write/WriteCoinCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteCoinCommand(long CardId, string Data) : IRequestWrapper; -public class WriteCoinCommandHandler : CardRequestHandlerBase +public class WriteCoinCommandHandler : RequestHandlerBase { public WriteCoinCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/Game/Card/Write/WriteItemCommand.cs b/Application/Game/Card/Write/WriteItemCommand.cs index 6c33cea..9a5b6a2 100644 --- a/Application/Game/Card/Write/WriteItemCommand.cs +++ b/Application/Game/Card/Write/WriteItemCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteItemCommand(long CardId, string Data) : IRequestWrapper; -public class WriteItemCommandHandler : CardRequestHandlerBase +public class WriteItemCommandHandler : RequestHandlerBase { public WriteItemCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/Game/Card/Write/WriteMusicDetailCommand.cs b/Application/Game/Card/Write/WriteMusicDetailCommand.cs index 4f09887..84d3d24 100644 --- a/Application/Game/Card/Write/WriteMusicDetailCommand.cs +++ b/Application/Game/Card/Write/WriteMusicDetailCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteMusicDetailCommand(long CardId, string Data) : IRequestWrapper; -public class WriteMusicDetailCommandHandler : CardRequestHandlerBase +public class WriteMusicDetailCommandHandler : RequestHandlerBase { public WriteMusicDetailCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/Game/Card/Write/WriteNavigatorCommand.cs b/Application/Game/Card/Write/WriteNavigatorCommand.cs index 48514f3..8df2c9d 100644 --- a/Application/Game/Card/Write/WriteNavigatorCommand.cs +++ b/Application/Game/Card/Write/WriteNavigatorCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteNavigatorCommand(long CardId, string Data) : IRequestWrapper; -public class WriteNavigatorCommandHandler : CardRequestHandlerBase +public class WriteNavigatorCommandHandler : RequestHandlerBase { public WriteNavigatorCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/Game/Card/Write/WriteSkinCommand.cs b/Application/Game/Card/Write/WriteSkinCommand.cs index 460291d..1dc597f 100644 --- a/Application/Game/Card/Write/WriteSkinCommand.cs +++ b/Application/Game/Card/Write/WriteSkinCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteSkinCommand(long CardId, string Data) : IRequestWrapper; -public class WriteSkinCommandHandler : CardRequestHandlerBase +public class WriteSkinCommandHandler : RequestHandlerBase { public WriteSkinCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/Game/Card/Write/WriteSoundEffectCommand.cs b/Application/Game/Card/Write/WriteSoundEffectCommand.cs index e4ae9f0..e79a8ad 100644 --- a/Application/Game/Card/Write/WriteSoundEffectCommand.cs +++ b/Application/Game/Card/Write/WriteSoundEffectCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteSoundEffectCommand(long CardId, string Data) : IRequestWrapper; -public class WriteSoundEffectCommandHandler : CardRequestHandlerBase +public class WriteSoundEffectCommandHandler : RequestHandlerBase { public WriteSoundEffectCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/Game/Card/Write/WriteTitleCommand.cs b/Application/Game/Card/Write/WriteTitleCommand.cs index b5c67c7..fac49b7 100644 --- a/Application/Game/Card/Write/WriteTitleCommand.cs +++ b/Application/Game/Card/Write/WriteTitleCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteTitleCommand(long CardId, string Data) : IRequestWrapper; -public class WriteTitleCommandHandler : CardRequestHandlerBase +public class WriteTitleCommandHandler : RequestHandlerBase { public WriteTitleCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/Game/Card/Write/WriteUnlockKeynumCommand.cs b/Application/Game/Card/Write/WriteUnlockKeynumCommand.cs index 54a91b3..31cd35e 100644 --- a/Application/Game/Card/Write/WriteUnlockKeynumCommand.cs +++ b/Application/Game/Card/Write/WriteUnlockKeynumCommand.cs @@ -2,7 +2,7 @@ namespace Application.Game.Card.Write; public record WriteUnlockKeynumCommand(long CardId, string Data) : IRequestWrapper; -public class WriteUnlockKeynumCommandHandler : CardRequestHandlerBase +public class WriteUnlockKeynumCommandHandler : RequestHandlerBase { public WriteUnlockKeynumCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} diff --git a/Application/GlobalUsings.cs b/Application/GlobalUsings.cs index 5815156..c8a762a 100644 --- a/Application/GlobalUsings.cs +++ b/Application/GlobalUsings.cs @@ -1,9 +1,11 @@ // Global using directives -global using System.Xml.Serialization; global using Microsoft.EntityFrameworkCore; +global using System.Xml.Serialization; +global using Application.Common.Base; global using Application.Common.Extensions; global using Application.Common.Models; +global using Application.Dto.Api; +global using Application.Dto.Game; global using Application.Interfaces; -global using Application.Mappers; -global using Application.Dto; \ No newline at end of file +global using Application.Mappers; \ No newline at end of file diff --git a/Application/Mappers/CardDetailMapper.cs b/Application/Mappers/CardDetailMapper.cs index b6fae63..6955887 100644 --- a/Application/Mappers/CardDetailMapper.cs +++ b/Application/Mappers/CardDetailMapper.cs @@ -9,4 +9,25 @@ public static partial class CardDetailMapper public static partial CardDetailDto CardDetailToDto(this CardDetail cardDetail); public static partial CardDetail DtoToCardDetail(this CardDetailDto dto); + + [MapperIgnoreSource(nameof(FirstPlayOptionDto.CardId))] + [MapProperty(nameof(FirstPlayOptionDto.AvatarId), nameof(CardDetail.ScoreI1))] + [MapProperty(nameof(FirstPlayOptionDto.TitleId), nameof(CardDetail.Fcol2))] + [MapProperty(nameof(FirstPlayOptionDto.ShowFastSlowOption), nameof(CardDetail.ScoreUi1))] + [MapProperty(nameof(FirstPlayOptionDto.ShowFeverTranceOption), nameof(CardDetail.ScoreUi2))] + public static partial void MapFirstOptionDetail(this FirstPlayOptionDto dto, CardDetail detail); + + [MapperIgnoreSource(nameof(SecondPlayOptionDto.CardId))] + [MapProperty(nameof(SecondPlayOptionDto.NavigatorId), nameof(CardDetail.ScoreI1))] + public static partial void MapSecondOptionDetail(this SecondPlayOptionDto dto, CardDetail detail); + + [MapProperty(nameof(CardDetail.ScoreI1), nameof(FirstPlayOptionDto.AvatarId))] + [MapProperty(nameof(CardDetail.Fcol2), nameof(FirstPlayOptionDto.TitleId))] + [MapProperty(nameof(CardDetail.ScoreUi1), nameof(FirstPlayOptionDto.ShowFastSlowOption))] + [MapProperty(nameof(CardDetail.ScoreUi2), nameof(FirstPlayOptionDto.ShowFeverTranceOption))] + public static partial FirstPlayOptionDto CardDetailToFirstOption(this CardDetail detail); + + [MapProperty(nameof(CardDetail.ScoreI1), nameof(SecondPlayOptionDto.NavigatorId))] + public static partial SecondPlayOptionDto CardDetailToSecondOption(this CardDetail detail); + } \ No newline at end of file diff --git a/Application/Mappers/CardMapper.cs b/Application/Mappers/CardMapper.cs index 0afef1c..f2b69b5 100644 --- a/Application/Mappers/CardMapper.cs +++ b/Application/Mappers/CardMapper.cs @@ -8,4 +8,6 @@ public static partial class CardMapper { public static partial CardDto CardMainToCardDto(this CardMain cardMain); public static partial CardMain CardDtoToCardMain(this CardDto cardDto); + + public static partial ClientCardDto CardMainToClientDto(this CardMain cardMain); } \ No newline at end of file diff --git a/Domain/Enums/ShowFastSlowOption.cs b/Domain/Enums/ShowFastSlowOption.cs new file mode 100644 index 0000000..f7f7f91 --- /dev/null +++ b/Domain/Enums/ShowFastSlowOption.cs @@ -0,0 +1,8 @@ +namespace Domain.Enums; + +public enum ShowFastSlowOption : long +{ + NearAvatar = 1, + NearJudgement = 2, + NotShow = 3 +} \ No newline at end of file diff --git a/Domain/Enums/ShowFeverTranceOption.cs b/Domain/Enums/ShowFeverTranceOption.cs new file mode 100644 index 0000000..37c4f95 --- /dev/null +++ b/Domain/Enums/ShowFeverTranceOption.cs @@ -0,0 +1,7 @@ +namespace Domain.Enums; + +public enum ShowFeverTranceOption : long +{ + Show = 1, + NotShow = 2 +} \ No newline at end of file diff --git a/GC-local-server-rewrite.sln b/GC-local-server-rewrite.sln index e5e8e8e..36a2db7 100644 --- a/GC-local-server-rewrite.sln +++ b/GC-local-server-rewrite.sln @@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domain", "Domain\Domain.csp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{2666D734-0E81-431E-A22D-216218FC9023}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebUI", "WebUI\WebUI.csproj", "{DDF8DE35-62C5-4033-93CE-0CB811A9CAEC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -63,6 +65,10 @@ Global {2666D734-0E81-431E-A22D-216218FC9023}.Debug|Any CPU.Build.0 = Debug|Any CPU {2666D734-0E81-431E-A22D-216218FC9023}.Release|Any CPU.ActiveCfg = Release|Any CPU {2666D734-0E81-431E-A22D-216218FC9023}.Release|Any CPU.Build.0 = Release|Any CPU + {DDF8DE35-62C5-4033-93CE-0CB811A9CAEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DDF8DE35-62C5-4033-93CE-0CB811A9CAEC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DDF8DE35-62C5-4033-93CE-0CB811A9CAEC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DDF8DE35-62C5-4033-93CE-0CB811A9CAEC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MainServer/Configurations/database.json b/MainServer/Configurations/database.json index 3c9ff35..ae84581 100644 --- a/MainServer/Configurations/database.json +++ b/MainServer/Configurations/database.json @@ -1,4 +1,4 @@ { - "CardDbName": "card.db3", + "CardDbName": "card1.db3", "MusicDbName": "music471omni.db3" } \ No newline at end of file diff --git a/MainServer/Controllers/API/PlayOptionController.cs b/MainServer/Controllers/API/PlayOptionController.cs new file mode 100644 index 0000000..0a69e5d --- /dev/null +++ b/MainServer/Controllers/API/PlayOptionController.cs @@ -0,0 +1,24 @@ +using Application.Api; +using Application.Common.Models; +using Microsoft.AspNetCore.Mvc; + +namespace MainServer.Controllers.API; + +[ApiController] +[Route("api/[controller]")] +public class PlayOptionController : BaseController +{ + [HttpGet("{cardId:long}")] + public async Task>> GetPlayOptionById(long cardId) + { + var result = await Mediator.Send(new GetPlayOptionQuery(cardId)); + return result; + } + + [HttpPost] + public async Task>> SetPlayOption(PlayOptionData data) + { + var result = await Mediator.Send(new SetPlayOptionCommand(data)); + return result; + } +} \ No newline at end of file diff --git a/MainServer/Controllers/API/ProfilesController.cs b/MainServer/Controllers/API/ProfilesController.cs new file mode 100644 index 0000000..93aea69 --- /dev/null +++ b/MainServer/Controllers/API/ProfilesController.cs @@ -0,0 +1,39 @@ +using Application.Api; +using Application.Common.Models; +using Application.Dto.Api; +using Microsoft.AspNetCore.Mvc; + +namespace MainServer.Controllers.API; + +[ApiController] +[Route("api/[controller]")] +public class ProfilesController : BaseController +{ + [HttpGet] + public async Task>>> GetAllCards() + { + var result = await Mediator.Send(new GetCardsQuery()); + return result; + } + + [HttpGet("{cardId:long}")] + public async Task>> GetCardTotalResultById(long cardId) + { + var result = await Mediator.Send(new GetTotalResultQuery(cardId)); + return result; + } + + [HttpPost("Favorite")] + public async Task>> SetFavoriteMusic(MusicDetailDto detail) + { + var result = await Mediator.Send(new SetFavoriteMusicCommand(detail)); + return result; + } + + [HttpPost("PlayerName")] + public async Task>> SetPlayerName(ClientCardDto card) + { + var result = await Mediator.Send(new SetPlayerNameCommand(card)); + return result; + } +} \ No newline at end of file diff --git a/MainServer/MainServer.csproj b/MainServer/MainServer.csproj index 1ce8fa4..4e28b64 100644 --- a/MainServer/MainServer.csproj +++ b/MainServer/MainServer.csproj @@ -72,7 +72,6 @@ - diff --git a/MudAdmin/Shared/NavMenu.razor b/MudAdmin/Shared/NavMenu.razor index 246001d..cd8ff8e 100644 --- a/MudAdmin/Shared/NavMenu.razor +++ b/MudAdmin/Shared/NavMenu.razor @@ -1,4 +1,4 @@  Home - Users + Cards \ No newline at end of file diff --git a/WebUI/App.razor b/WebUI/App.razor new file mode 100644 index 0000000..dcdcd36 --- /dev/null +++ b/WebUI/App.razor @@ -0,0 +1,11 @@ + + + + + + Not found + +

Sorry, there's nothing at this address.

+
+
+
\ No newline at end of file diff --git a/WebUI/Pages/Cards.razor b/WebUI/Pages/Cards.razor new file mode 100644 index 0000000..fd0c3f0 --- /dev/null +++ b/WebUI/Pages/Cards.razor @@ -0,0 +1,2 @@ +@page "/Cards" +

Cards

diff --git a/WebUI/Pages/Cards.razor.cs b/WebUI/Pages/Cards.razor.cs new file mode 100644 index 0000000..a46e1d6 --- /dev/null +++ b/WebUI/Pages/Cards.razor.cs @@ -0,0 +1,34 @@ +using System.Net.Http.Json; +using Application.Common.Models; +using Application.Dto.Api; +using Microsoft.AspNetCore.Components; + +namespace WebUI.Pages; + +public partial class Cards +{ + [Inject] + public HttpClient Client { get; set; } = null!; + + private List? CardDtos { get; set; } + + private string ErrorMessage { get; set; } = string.Empty; + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + var result = await Client.GetFromJsonAsync>>("api/Profiles"); + if (result is null) + { + ErrorMessage = "Parse result failed"; + return; + } + + if (!result.Succeeded) + { + ErrorMessage = result.Error!.Message; + return; + } + CardDtos = result.Data; + } +} \ No newline at end of file diff --git a/WebUI/Pages/Index.razor b/WebUI/Pages/Index.razor new file mode 100644 index 0000000..802b143 --- /dev/null +++ b/WebUI/Pages/Index.razor @@ -0,0 +1,5 @@ +@page "/" + +Index + +Welcome to GC Local Server WebUI \ No newline at end of file diff --git a/WebUI/Program.cs b/WebUI/Program.cs new file mode 100644 index 0000000..0b1e10a --- /dev/null +++ b/WebUI/Program.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using WebUI; +using MudBlazor.Services; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); +builder.RootComponents.Add("#app"); +builder.RootComponents.Add("head::after"); + +builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); +builder.Services.AddMudServices(); + +await builder.Build().RunAsync(); \ No newline at end of file diff --git a/WebUI/Properties/launchSettings.json b/WebUI/Properties/launchSettings.json new file mode 100644 index 0000000..bb34c40 --- /dev/null +++ b/WebUI/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:65283", + "sslPort": 44398 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Mudblazor.Template": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/WebUI/Shared/MainLayout.razor b/WebUI/Shared/MainLayout.razor new file mode 100644 index 0000000..f5dccc1 --- /dev/null +++ b/WebUI/Shared/MainLayout.razor @@ -0,0 +1,60 @@ +@inherits LayoutComponentBase + + + + + + + + + + + + + + + + + + + + + + GC Local Server WebUI + + + + + + @Body + + + + +@code { + bool drawerOpen = true; + + public bool IsDarkMode { get; set; } + + public MudThemeProvider MudThemeProvider { get; set; } = null!; + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + IsDarkMode = await MudThemeProvider.GetSystemPreference(); + StateHasChanged(); + } + } + + void DrawerToggle() + { + drawerOpen = !drawerOpen; + } + +} \ No newline at end of file diff --git a/WebUI/Shared/NavMenu.razor b/WebUI/Shared/NavMenu.razor new file mode 100644 index 0000000..b7587a0 --- /dev/null +++ b/WebUI/Shared/NavMenu.razor @@ -0,0 +1,4 @@ + + Home + Cards + \ No newline at end of file diff --git a/WebUI/WebUI.csproj b/WebUI/WebUI.csproj new file mode 100644 index 0000000..3dc207e --- /dev/null +++ b/WebUI/WebUI.csproj @@ -0,0 +1,20 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebUI/WebUI.sln b/WebUI/WebUI.sln new file mode 100644 index 0000000..bf23482 --- /dev/null +++ b/WebUI/WebUI.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31717.71 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebUI", "WebUI.csproj", "{14A8F0A8-0A25-44AD-83B4-8BFE328E3148}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {14A8F0A8-0A25-44AD-83B4-8BFE328E3148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14A8F0A8-0A25-44AD-83B4-8BFE328E3148}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14A8F0A8-0A25-44AD-83B4-8BFE328E3148}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14A8F0A8-0A25-44AD-83B4-8BFE328E3148}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5A60C47D-9115-4F94-A725-C8F37B455972} + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/WebUI/_Imports.razor b/WebUI/_Imports.razor new file mode 100644 index 0000000..33f26df --- /dev/null +++ b/WebUI/_Imports.razor @@ -0,0 +1,11 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.AspNetCore.Components.WebAssembly.Http +@using Microsoft.JSInterop +@using MudBlazor +@using WebUI +@using WebUI.Shared \ No newline at end of file diff --git a/WebUI/wwwroot/favicon.ico b/WebUI/wwwroot/favicon.ico new file mode 100644 index 0000000..1239223 Binary files /dev/null and b/WebUI/wwwroot/favicon.ico differ diff --git a/WebUI/wwwroot/index.html b/WebUI/wwwroot/index.html new file mode 100644 index 0000000..561826d --- /dev/null +++ b/WebUI/wwwroot/index.html @@ -0,0 +1,25 @@ + + + + + + + WebUI + + + + + + +
Loading...
+ +
+ An unhandled error has occurred. + Reload + 🗙 +
+ + + + + \ No newline at end of file diff --git a/WebUI/wwwroot/sample-data/weather.json b/WebUI/wwwroot/sample-data/weather.json new file mode 100644 index 0000000..06463c0 --- /dev/null +++ b/WebUI/wwwroot/sample-data/weather.json @@ -0,0 +1,27 @@ +[ + { + "date": "2018-05-06", + "temperatureC": 1, + "summary": "Freezing" + }, + { + "date": "2018-05-07", + "temperatureC": 14, + "summary": "Bracing" + }, + { + "date": "2018-05-08", + "temperatureC": -13, + "summary": "Freezing" + }, + { + "date": "2018-05-09", + "temperatureC": -16, + "summary": "Balmy" + }, + { + "date": "2018-05-10", + "temperatureC": -2, + "summary": "Chilly" + } +]