File tree Expand file tree Collapse file tree
src/main/java/com/itasocialacademy/oitassist/competition Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,4 +59,15 @@ public interface CompetitionFacade {
5959 * @return the competition tree, or empty if no competition with this ID exists
6060 */
6161 Optional <CompetitionTreeDetail > findCompetitionTreeByCompetitionId (Long competitionId );
62+
63+ /**
64+ * Retrieves tours by their IDs.
65+ *
66+ * @param tourIds Tour IDs, must not be {@code null} (an empty list yields an
67+ * empty result)
68+ * @return the tours found for the given IDs, in unspecified order; IDs with no
69+ * matching tour are silently omitted, so the result may be smaller than
70+ * {@code tourIds}
71+ */
72+ List <TourDetail > findToursByIds (List <Long > tourIds );
6273}
Original file line number Diff line number Diff line change @@ -78,6 +78,18 @@ public Optional<CompetitionTreeDetail> findCompetitionTreeByCompetitionId(Long c
7878 .map (this ::buildTreeDetail );
7979 }
8080
81+ @ Override
82+ @ Transactional (readOnly = true )
83+ public List <TourDetail > findToursByIds (List <Long > tourIds ) {
84+ Objects .requireNonNull (tourIds , "tourIds must not be null" );
85+ if (tourIds .isEmpty ()) {
86+ return List .of ();
87+ }
88+ return tourRepository .findAllById (tourIds ).stream ()
89+ .map (tourMapper ::toTourDetail )
90+ .toList ();
91+ }
92+
8193 private CompetitionTreeDetail buildTreeDetail (Competition competitionEntity ) {
8294 CompetitionDetail competitionDetail = competitionMapper .toCompetitionDetail (competitionEntity );
8395
You can’t perform that action at this time.
0 commit comments