Skip to content

Commit

Permalink
fix() : 카테고리 분류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
dongkyun0713 committed Feb 24, 2024
1 parent dba689b commit cf1f1fe
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 cf1f1fe

Please sign in to comment.