Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Hooking-CEOS/Hooking_BE int…
Browse files Browse the repository at this point in the history
…o feature/copy
  • Loading branch information
Jiwon committed Jul 25, 2023
2 parents 8fb85f6 + f928c7b commit 2f4a2ab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/shop/hooking/hooking/service/BrandService.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class BrandService {

private final MoodRepository moodRepository;

private final ScrapRepository scrapRepository;

public List<BrandRes.BrandDto> getBrandList(){
List<BrandRes.BrandDto> brandDtoList = new ArrayList<>();
List<Brand> brands = brandRepository.findAll();
Expand Down Expand Up @@ -62,6 +64,15 @@ public BrandRes.BrandDetailDto getOneBrand(Long id) {

List<Card> cards = cardRepository.findCardsByBrandId(brand.getId());

for(Card card : cards){
Long cardId = card.getId();

List<Scrap> scraps = scrapRepository.findByCardId(cardId);
int length = scraps.size();
card.setScrapCnt(length);

}

List<String> cardTexts = new ArrayList<>();
int maxCardCount = Math.min(cards.size(), 3);
for (int i = 0; i < maxCardCount; i++) {
Expand Down

0 comments on commit 2f4a2ab

Please sign in to comment.