-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 관리자 페이지 구현 #119
[FEAT] 관리자 페이지 구현 #119
Conversation
} | ||
|
||
@GetMapping("/review") | ||
@Secured(("ADMIN")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
괄호 두 개로 되어있음 수정 필요
|
||
@OneToOne | ||
@JoinColumn(name = "route_id", nullable = false) | ||
private BusRouteEntity route; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
routeId만 명시해도 괜찮을 것 같다는 생각이 듭니다. (실제 조회가 일어나지 않는 것 같아요.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
관리자 페이지에서 해당 노선 정보를 보여주기 위해서 넣었습니다.
import com.talkka.server.bus.dto.BusRouteStationRespDto; | ||
|
||
public record BookmarkStatRespDto( | ||
BusRouteStationRespDto busRouteStation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 친구는 왜 붙는지 궁금합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
관리자 페이지에서 노선-정거장 별로 그룹핑해서 보여주는데, 노선-정거장 정보 + 북마크 수를 같이 보여주기 위해 넣었습니다.
import com.talkka.server.bus.dto.BusRouteStationRespDto; | ||
|
||
public record BusReviewStatRespDto( | ||
BusRouteStationRespDto busRouteStation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 마찬가지 입니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
관리자 페이지에서 노선-정거장 별로 그룹핑해서 보여주는데, 노선-정거장 정보 + 리뷰 수 를 같이 보여주기 위해 넣었습니다.
public CollectBusRouteRespDto createCollectBusRoute(CollectBusRouteCreateDto dto) throws | ||
CollectBusRouteNotFoundException, | ||
CollectBusRouteAlreadyExistsException { | ||
if (collectBusRouteRepository.findByRouteId(dto.routeId()).isPresent()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
existsById로 바꾸는게 좋을 것 같아요.
} | ||
|
||
public void deleteCollectBusRoute(Long collectRouteId) throws CollectBusRouteNotFoundException { | ||
if (collectBusRouteRepository.findById(collectRouteId).isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 마찬가지로 existsById..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
빈 파일입니다.
schema 파일 업데이트 필요합니다. |
private final CollectBusRouteService collectBusRouteService; | ||
|
||
@GetMapping("") | ||
@Secured("ADMIN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 어노테이션 사용하지 않고 SecurityConfig에 있는 접근 제한으로 해결해도 될 듯 합니다!
# Conflicts: # server/src/main/java/com/talkka/server/bookmark/dao/BookmarkDetailRepository.java # server/src/main/java/com/talkka/server/config/SecurityConfig.java
PublicApiKeyProvider 를 현재 찾지 못하여 빌드 오류 발생합니다 확인 부탁드립니다.
|
추후 추가될 예정입니다.
public List<BookmarkStatRespDto> getBookmarkStats() throws BusRouteStationNotFoundException { | ||
Map<Long, Integer> map = bookmarkDetailRepository.countGroupedByBusRouteStationId(); | ||
List<BookmarkStatRespDto> result = new ArrayList<>(); | ||
for (Long key : map.keySet()) { | ||
var busRouteStation = busRouteStationRepository.findById(key); | ||
if (busRouteStation.isEmpty()) { | ||
log.warn("등록되지 않은 노선-정거장 입니다 : {}", key); | ||
continue; | ||
} | ||
result.add( | ||
new BookmarkStatRespDto( | ||
BusRouteStationRespDto.of(busRouteStation.get()), | ||
map.get(key) | ||
) | ||
); | ||
} | ||
result.sort((r1, r2) -> r2.count() - r1.count()); // count 로 오름차순 정렬 | ||
return result; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 메서드가 아래 메서드와 중복되는 부분이 많아보이는데 제네릭 이용해서 통합하는건 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 클래스가 변경되서 TEST 코드에서 에러가 발생하는 것으로 보입니다.
수정 부탁드려요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, 테스트에서 빈 주입 안되는 문제는 E2E 이후 분석해서 수정이 필요함
관리자 페이지 구현
close #115