diff --git a/src/main/java/com/dnd/gooding/domain/feed/controller/FeedController.java b/src/main/java/com/dnd/gooding/domain/feed/controller/FeedController.java index 44ce08c..56c9efd 100644 --- a/src/main/java/com/dnd/gooding/domain/feed/controller/FeedController.java +++ b/src/main/java/com/dnd/gooding/domain/feed/controller/FeedController.java @@ -38,10 +38,10 @@ public class FeedController { @GetMapping(value = "/{userId}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity> feed( @PathVariable Long userId, - @RequestParam(name = "interests") List interests, + @RequestParam(name = "interestCodes") List interestCodes, @Parameter(hidden = true) Pageable pageable) { return ResponseEntity .ok() - .body(feedService.findByRecordIsNotUserId(userId, pageable)); + .body(feedService.findByRecordByInterestCodeAndIsNotUserId(userId, interestCodes, pageable)); } } diff --git a/src/main/java/com/dnd/gooding/domain/feed/repository/FeedRepositoryCustom.java b/src/main/java/com/dnd/gooding/domain/feed/repository/FeedRepositoryCustom.java index b7620de..9fe9ad6 100644 --- a/src/main/java/com/dnd/gooding/domain/feed/repository/FeedRepositoryCustom.java +++ b/src/main/java/com/dnd/gooding/domain/feed/repository/FeedRepositoryCustom.java @@ -1,5 +1,7 @@ package com.dnd.gooding.domain.feed.repository; +import java.util.List; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -7,5 +9,5 @@ public interface FeedRepositoryCustom { - Page findByRecordIsNotUserId(Long userId, Pageable pageable); + Page findByRecordByInterestCodeAndIsNotUserId(Long userId, List interestCodes, Pageable pageable); } diff --git a/src/main/java/com/dnd/gooding/domain/feed/repository/FeedRepositoryImpl.java b/src/main/java/com/dnd/gooding/domain/feed/repository/FeedRepositoryImpl.java index 83555bc..3cca58b 100644 --- a/src/main/java/com/dnd/gooding/domain/feed/repository/FeedRepositoryImpl.java +++ b/src/main/java/com/dnd/gooding/domain/feed/repository/FeedRepositoryImpl.java @@ -4,6 +4,8 @@ import static com.dnd.gooding.domain.record.model.QRecord.*; import static com.dnd.gooding.domain.user.model.QUser.*; +import java.util.List; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -19,7 +21,7 @@ public FeedRepositoryImpl() { } @Override - public Page findByRecordIsNotUserId(Long userId, Pageable pageable) { + public Page findByRecordByInterestCodeAndIsNotUserId(Long userId, List interestCodes, Pageable pageable) { return applyPagination(pageable, contentQuery -> contentQuery .select(record).distinct() .from(record) diff --git a/src/main/java/com/dnd/gooding/domain/feed/service/FeedService.java b/src/main/java/com/dnd/gooding/domain/feed/service/FeedService.java index 31036df..febde21 100644 --- a/src/main/java/com/dnd/gooding/domain/feed/service/FeedService.java +++ b/src/main/java/com/dnd/gooding/domain/feed/service/FeedService.java @@ -1,5 +1,7 @@ package com.dnd.gooding.domain.feed.service; +import java.util.List; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -7,5 +9,5 @@ public interface FeedService { - Page findByRecordIsNotUserId(Long userId, Pageable pageable); + Page findByRecordByInterestCodeAndIsNotUserId(Long userId, List interestCodes, Pageable pageable); } diff --git a/src/main/java/com/dnd/gooding/domain/feed/service/FeedServiceImpl.java b/src/main/java/com/dnd/gooding/domain/feed/service/FeedServiceImpl.java index 706c76d..8aade9f 100644 --- a/src/main/java/com/dnd/gooding/domain/feed/service/FeedServiceImpl.java +++ b/src/main/java/com/dnd/gooding/domain/feed/service/FeedServiceImpl.java @@ -1,5 +1,6 @@ package com.dnd.gooding.domain.feed.service; +import java.util.List; import java.util.stream.Collectors; import org.springframework.data.domain.Page; @@ -22,9 +23,9 @@ public class FeedServiceImpl implements FeedService { private final FeedRepository feedRepository; @Override - public Page findByRecordIsNotUserId(Long userId, Pageable pageable) { - Page records = feedRepository.findByRecordIsNotUserId(userId, pageable); - return new PageImpl(records.stream() + public Page findByRecordByInterestCodeAndIsNotUserId(Long userId, List interestCodes, Pageable pageable) { + Page records = feedRepository.findByRecordByInterestCodeAndIsNotUserId(userId, interestCodes, pageable); + return new PageImpl<>(records.stream() .map(FeedResponse::new) .collect(Collectors.toList()), pageable, records.getTotalElements()); diff --git a/src/main/java/com/dnd/gooding/domain/onboarding/model/Onboarding.java b/src/main/java/com/dnd/gooding/domain/onboarding/model/Onboarding.java index 65b57bb..13db856 100644 --- a/src/main/java/com/dnd/gooding/domain/onboarding/model/Onboarding.java +++ b/src/main/java/com/dnd/gooding/domain/onboarding/model/Onboarding.java @@ -21,7 +21,6 @@ public class Onboarding extends BaseEntity { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; - @Enumerated @Column(name = "interest_type") @Convert(converter = InterestConverter.class) private InterestType interestType;