Skip to content

Commit

Permalink
Merge pull request #41 from Groom-Team11/develop
Browse files Browse the repository at this point in the history
Merge develop to main
  • Loading branch information
EunbeenDev authored Sep 28, 2024
2 parents 00ad048 + c3b4309 commit 7f4e3ae
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,22 @@ public ResponseEntity<?> getRandomFlower(User user) {

@Transactional
public void createDictionary(User user) {
// 모든 꽃 조회
List<Flower> flowers = flowerRepository.findAll();

// 꽃 도감 객체 생성
List<FlowerDictionary> flowerDictionaries = new ArrayList<>();
flowers.forEach(flower -> {

for (Flower flower : flowers) {
FlowerDictionary flowerDictionary = FlowerDictionary.builder()
.user(user)
.flower(flower)
.isAcquired(false)
.build();
flowerDictionaries.add(flowerDictionary);
});
}

// FlowerDictionary 목록을 저장
flowerDictionaryRepository.saveAll(flowerDictionaries);
}
}

0 comments on commit 7f4e3ae

Please sign in to comment.