Skip to content

Commit

Permalink
Merge pull request #44 from DEPthes/fix/charater-equip-items
Browse files Browse the repository at this point in the history
@transaction 어노테이션 추가
  • Loading branch information
EunbeenDev authored Aug 17, 2024
2 parents e0716a5 + 4445a97 commit 44d7731
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public ResponseEntity<?> createInitialCharacter(UserPrincipal userPrincipal, New
}


@Transactional
public ResponseEntity<?> myCharacterEquipItem(UserPrincipal userPrincipal, MyCharacterEquipItemReq myCharacterEquipItemReq) {
Character character = characterRepository.findByUserId(userPrincipal.getId()).orElseThrow(() -> new IllegalArgumentException("캐릭터를 찾을 수 없습니다."));
List<Item> item = character.getItems();
Expand All @@ -220,6 +221,7 @@ public ResponseEntity<?> myCharacterEquipItem(UserPrincipal userPrincipal, MyCha
Item equitItem = (Item) itemRepository.findById(itemId).orElseThrow(()->new IllegalArgumentException("아이템을 찾을 수 없습니다."));
equitItem.updateEquipped(true);


// // 장착 해제할 아이템 찾기 후 isEquipped = false로 변경
// Item itemToUnequip = item.stream()
// .filter(i -> i.getItemImage().getItemType().equals(itemType) && i.isEquipped())
Expand Down

0 comments on commit 44d7731

Please sign in to comment.