Skip to content

Commit

Permalink
fix: UserData modify error
Browse files Browse the repository at this point in the history
  • Loading branch information
downfa11 committed Jul 4, 2024
1 parent 5b441eb commit 7f2ba77
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private SubTask getUserDataByMembershipId(SubTask subTask){
try {
UserDataMembership userData = userDataMapper.mapToDomainJump(membershipId);
subTask.setData(userData);
log.info(userData.toString());
log.info("userData: "+userData.toString());
subTask.setStatus("success");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ public UserDataMembership mapToDomain(UserData userData) {
}

public UserDataMembership mapToDomainJump(Long userId){
UserDataJpaEntity userDataJpaEntity = userDataRepository.findById(userId)
.orElseThrow(() -> new RuntimeException("User not found with ID: " + userId));
UserDataJpaEntity userDataJpaEntity = userDataRepository.findByUserId(userId);

if (userDataJpaEntity == null) {
throw new RuntimeException("User not found with ID: " + userId);
}

UserData userData = mapToDomainEntity(userDataJpaEntity);
return mapToDomain(userData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public UserDataJpaEntity createUserData(UserData.UserId userId, UserData.UserNam

@Override
public UserDataJpaEntity modifyUserData(UserData.UserId userId,UserData.UserGold userGold, UserData.UserHighscore userHighscore, UserData.UserEnergy userEnergy, UserData.UserScenario userScenario, UserData.UserHead userHead, UserData.UserBody userBody, UserData.UserArm userArm, UserData.UserHealth userHealth, UserData.UserAttack userAttack, UserData.UserCritical userCritical, UserData.UserDurability userDurability) {
UserDataJpaEntity entity = userDataRepository.getById(userId.getUserId());
UserDataJpaEntity entity = userDataRepository.findByUserId(userId.getUserId());

entity.setGold(userGold.getUserGold());
entity.setHighscore(userHighscore.getUserHighscore());
Expand Down

0 comments on commit 7f2ba77

Please sign in to comment.