Skip to content
Merged
Show file tree
Hide file tree
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 @@ -59,4 +59,15 @@ public interface CompetitionFacade {
* @return the competition tree, or empty if no competition with this ID exists
*/
Optional<CompetitionTreeDetail> findCompetitionTreeByCompetitionId(Long competitionId);

/**
* Retrieves tours by their IDs.
*
* @param tourIds Tour IDs, must not be {@code null} (an empty list yields an
* empty result)
* @return the tours found for the given IDs, in unspecified order; IDs with no
* matching tour are silently omitted, so the result may be smaller than
* {@code tourIds}
*/
List<TourDetail> findToursByIds(List<Long> tourIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ public Optional<CompetitionTreeDetail> findCompetitionTreeByCompetitionId(Long c
.map(this::buildTreeDetail);
}

@Override
@Transactional(readOnly = true)
public List<TourDetail> findToursByIds(List<Long> tourIds) {
Objects.requireNonNull(tourIds, "tourIds must not be null");
if (tourIds.isEmpty()) {
return List.of();
}
return tourRepository.findAllById(tourIds).stream()
.map(tourMapper::toTourDetail)
.toList();
}

private CompetitionTreeDetail buildTreeDetail(Competition competitionEntity) {
CompetitionDetail competitionDetail = competitionMapper.toCompetitionDetail(competitionEntity);

Expand Down
Loading