diff --git a/src/main/java/com/seoultech/sanEseo/post/adapter/PostController.java b/src/main/java/com/seoultech/sanEseo/post/adapter/PostController.java index a2ac909..9923170 100644 --- a/src/main/java/com/seoultech/sanEseo/post/adapter/PostController.java +++ b/src/main/java/com/seoultech/sanEseo/post/adapter/PostController.java @@ -3,14 +3,13 @@ import com.seoultech.sanEseo.global.config.web.AuthMember; import com.seoultech.sanEseo.global.config.web.LoginMember; import com.seoultech.sanEseo.global.response.ApiResponse; +import com.seoultech.sanEseo.like.application.service.LikeService; import com.seoultech.sanEseo.post.application.service.AddPostRequest; import com.seoultech.sanEseo.post.application.service.GetPostResponse; import com.seoultech.sanEseo.post.application.service.PostService; import com.seoultech.sanEseo.post.application.service.UpdatePostRequest; import com.seoultech.sanEseo.post.domain.Post; -import com.seoultech.sanEseo.post_district.application.service.GetPostDistrictResponse; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -20,9 +19,11 @@ @RequestMapping("/api/posts") public class PostController { private final PostService postService; + private final LikeService likeService; - public PostController(PostService postService) { + public PostController(PostService postService, LikeService likeService) { this.postService = postService; + this.likeService = likeService; } @PostMapping @@ -52,7 +53,9 @@ public ResponseEntity deletePost(@LoginMember AuthMember authMember, @PathVar @GetMapping("/by-district-prefix") public ResponseEntity getPostsByDistrictPrefix(@RequestParam String districtName) { List posts = postService.findPostsByDistrictNameStart(districtName); - return ApiResponse.ok("입력된 자치구를 포함하는 게시글 반환 완료.", posts); + List filterPostsByCategory = likeService.filterPostsByCategory(posts, 1); + + return ApiResponse.ok("입력된 자치구를 포함하는 게시글 반환 완료", filterPostsByCategory); } } diff --git a/src/main/java/com/seoultech/sanEseo/post/adapter/PostRepository.java b/src/main/java/com/seoultech/sanEseo/post/adapter/PostRepository.java index fdb72a0..c8f2bba 100644 --- a/src/main/java/com/seoultech/sanEseo/post/adapter/PostRepository.java +++ b/src/main/java/com/seoultech/sanEseo/post/adapter/PostRepository.java @@ -7,6 +7,4 @@ public interface PostRepository extends JpaRepository { boolean existsByTitleAndDescription(String title, String description); - - List findByMemberId(Long memberId); } diff --git a/src/main/java/com/seoultech/sanEseo/post_district/application/service/PostDistrictService.java b/src/main/java/com/seoultech/sanEseo/post_district/application/service/PostDistrictService.java index 6b1d1be..63d2f77 100644 --- a/src/main/java/com/seoultech/sanEseo/post_district/application/service/PostDistrictService.java +++ b/src/main/java/com/seoultech/sanEseo/post_district/application/service/PostDistrictService.java @@ -43,14 +43,6 @@ public PostDistrictService(DistrictPort districtPort, PostDistrictPort postDistr this.postPort = postPort; } - public void createPostDistrictRelation(Post post, Long districtId) { - District district = districtPort.findById(districtId); - PostDistrict postDistrict = new PostDistrict(post, district); - - postDistrictPort.save(postDistrict); - - } - public List getPostDistrict(Long districtId) { List postDistricts = postDistrictPort.findByDistrictId(districtId); // 해당 post의 image를 가져오기 위해 imageService를 사용