Skip to content

Commit

Permalink
Merge pull request #85 from dongkyun0713/dongkyun
Browse files Browse the repository at this point in the history
fix() : ์นดํ…Œ๊ณ ๋ฆฌ ๋ถ„๋ฅ˜ ์ˆ˜์ •
  • Loading branch information
dongkyun0713 authored Feb 24, 2024
2 parents b14aaef + cf1f1fe commit 2b3ef38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.titto_backend.matchingBoard.controller;

import com.example.titto_backend.matchingBoard.domain.matchingBoard.Category;
import com.example.titto_backend.matchingBoard.dto.request.MatchingPostRequest.MatchingPostPagingRequestDto;
import com.example.titto_backend.matchingBoard.dto.response.matchingPostResponse.MatchingPostPagingResponseDto;
import com.example.titto_backend.matchingBoard.service.matchingBoard.MatchingBoardService;
Expand Down Expand Up @@ -64,7 +63,7 @@ public MatchingPostPagingResponseDto searchByKeyWord(@RequestParam("page") int p
@ApiResponse(responseCode = "500", description = "๊ด€๋ฆฌ์ž ๋ฌธ์˜")
})
public MatchingPostPagingResponseDto findByCategory(@RequestParam("page") int page,
@RequestParam Category category) {
@RequestParam String category) {
MatchingPostPagingRequestDto requestDto = new MatchingPostPagingRequestDto();
requestDto.setPage(page + 1);
return matchingBoardService.findByCategory(requestDto, category);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ public MatchingPostPagingResponseDto searchByKeyWord(MatchingPostPagingRequestDt
return MatchingPostPagingResponseDto.from(matchingPosts);
}

public MatchingPostPagingResponseDto findByCategory(MatchingPostPagingRequestDto matchingPostPagingRequestDto, Category category) {
public MatchingPostPagingResponseDto findByCategory(MatchingPostPagingRequestDto matchingPostPagingRequestDto,
String category) {
int page = matchingPostPagingRequestDto.getPage() - 1;

Sort sort = Sort.by(Sort.Direction.DESC, "matchingPostId");
Pageable pageable = PageRequest.of(page, 10, sort);
Page<MatchingPost> matchingPosts = matchingPostRepository.findByCategory(category, pageable);
Page<MatchingPost> matchingPosts = matchingPostRepository.findByCategory(Category.valueOf(category), pageable);
return MatchingPostPagingResponseDto.from(matchingPosts);
}
}
Expand Down

0 comments on commit 2b3ef38

Please sign in to comment.