Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ public ReportResponseDto getReportById(Long reportId) {
}

@Transactional
public List<ReportResponseDto> getAllReportsByUserName(String userName) {
if (!userRepository.existsByName(userName)) {
throw new IllegalArgumentException("User not found with name: " + userName);
public List<ReportResponseDto> getAllReportsByUserId(String userId) {
if (!userRepository.existsById(userId)) {
throw new IllegalArgumentException("User not found with uid: " + userId);
}

List<Report> reports = reportRepository.findByUser(userRepository.findByName(userName).orElseThrow(() -> new IllegalArgumentException("User not found with name: " + userName)));
List<Report> reports = reportRepository.findByUser(userRepository.findByUid(userId).orElseThrow(() -> new IllegalArgumentException("User not found with uid: " + userId)));

return reports.stream()
.map(this::convertToDto)
Expand Down
Loading