Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ public class CreatePlayerDataUseCaseTests
private readonly Mock<IAccountRepository> _accountRepositoryMock = new();
private readonly Mock<ICurrencyRepository> _currencyRepositoryMock = new();
private readonly Mock<ISessionService> _sessionServiceMock = new();
private readonly Mock<ICacheService> _cacheServiceMock = new();
private readonly Mock<ITransactionScope> _transactionScopeMock = new();

private CreatePlayerDataUseCase CreateUseCase() => new(
_dataRepositoryMock.Object,
_accountRepositoryMock.Object,
_currencyRepositoryMock.Object,
_sessionServiceMock.Object,
_cacheServiceMock.Object,
_transactionScopeMock.Object
);

Expand Down
3 changes: 2 additions & 1 deletion PaperMania/Server/Api/Controller/Data/CharacterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public async Task<ActionResult<BaseResponse<GetAllPlayerCharactersResponse>>> Ge
/// <summary>
/// 유저의 보유 캐릭터를 추가합니다.
/// </summary>
[HttpPost]
[SessionAuthorize]
[HttpPost("player")]
public async Task<ActionResult<BaseResponse<EmptyResponse>>> AddPlayerCharacterData(
[FromBody] AddPlayerCharacterRequest request,
CancellationToken ct)
Expand Down
2 changes: 0 additions & 2 deletions PaperMania/Server/Application/UseCase/Auth/LoginUseCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public async Task<LoginResult> ExecuteAsync(LoginCommand request, CancellationTo
ct
);

Console.WriteLine($"[DEBUG] account.Id={account?.Id}");

if (account == null || string.IsNullOrEmpty(account.Password))
{
_passwordHasher.Verify(request.Password, "$2a$11$12345678901234567890123456789012345678901234567890123");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Server.Application.UseCase.Player.Command;
using Server.Application.UseCase.Player.Result;
using Server.Domain.Entity;
using Server.Infrastructure.Cache;

namespace Server.Application.UseCase.Player;

Expand All @@ -16,19 +17,22 @@ public class CreatePlayerDataUseCase : ICreatePlayerDataUseCase
private readonly IAccountRepository _accountRepository;
private readonly ICurrencyRepository _currencyRepository;
private readonly ISessionService _sessionService;
private readonly ICacheService _cacheService;
private readonly ITransactionScope _transactionScope;

public CreatePlayerDataUseCase(
IDataRepository dataRepository,
IAccountRepository accountRepository,
ICurrencyRepository currencyRepository,
ISessionService sessionService,
ICacheService cacheService,
ITransactionScope transactionScope)
{
_dataRepository = dataRepository;
_accountRepository = accountRepository;
_currencyRepository = currencyRepository;
_sessionService = sessionService;
_cacheService = cacheService;
_transactionScope = transactionScope;
}

Expand Down Expand Up @@ -57,6 +61,8 @@ await _transactionScope.ExecuteAsync(async (innerCt) =>
account.IsNewAccount = false;
await _accountRepository.UpdateAsync(account, innerCt);
}, ct);

await _cacheService.DeleteAsync(CacheKey.Account.ByPlayerId(account.PlayerId), ct);

return new AddPlayerDataResult(
PlayerName: request.PlayerName
Expand Down
Loading