File tree Expand file tree Collapse file tree
src/main/java/net/onelitefeather/vulpes/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import jakarta .persistence .GeneratedValue ;
55import jakarta .persistence .GenerationType ;
66import jakarta .persistence .Id ;
7+ import jakarta .persistence .JoinColumn ;
8+ import jakarta .persistence .ManyToOne ;
79import net .onelitefeather .vulpes .api .generator .VulpesGenerator ;
810import net .onelitefeather .vulpes .api .model .VulpesModel ;
911import org .hibernate .annotations .ColumnDefault ;
@@ -41,6 +43,10 @@ public class SoundFileSource implements VulpesModel {
4143 @ ColumnDefault ("'type_file'" )
4244 private String type ;
4345
46+ @ ManyToOne
47+ @ JoinColumn (name = "sound_event_id" )
48+ private SoundEventEntity soundEvent ;
49+
4450 /**
4551 * Default constructor for JPA and Micronaut Data.
4652 * <p>
@@ -232,6 +238,14 @@ public boolean isStreamable() {
232238 return stream ;
233239 }
234240
241+ public SoundEventEntity getSoundEvent () {
242+ return soundEvent ;
243+ }
244+
245+ public void setSoundEvent (SoundEventEntity soundEvent ) {
246+ this .soundEvent = soundEvent ;
247+ }
248+
235249 @ Override
236250 public boolean equals (Object o ) {
237251 if (o == null || getClass () != o .getClass ()) return false ;
Original file line number Diff line number Diff line change 1+ package net .onelitefeather .vulpes .api .repository ;
2+
3+ import io .micronaut .data .annotation .Query ;
4+ import io .micronaut .data .annotation .Repository ;
5+ import io .micronaut .data .model .Page ;
6+ import io .micronaut .data .model .Pageable ;
7+ import io .micronaut .data .repository .PageableRepository ;
8+ import net .onelitefeather .vulpes .api .model .sound .SoundFileSource ;
9+
10+ import java .util .List ;
11+ import java .util .UUID ;
12+
13+ /**
14+ * The {@link SoundFileSourceRepository} interface inherits from {@link PageableRepository} and provides methods to manage {@link SoundFileSource} objects.
15+ *
16+ * @author theEvilReaper
17+ * @version 1.0.0
18+ * @since 1.5.1
19+ */
20+ @ Repository
21+ public interface SoundFileSourceRepository extends PageableRepository <SoundFileSource , UUID > {
22+
23+ /**
24+ * Retrieves the sound file sources associated with a sound event by its ID.
25+ *
26+ * @param id the unique identifier of the sound event
27+ * @param pageable the pagination information
28+ * @return a list of sound file sources associated with the sound event
29+ */
30+ @ Query (value = "SELECT f FROM sound_data f WHERE f.soundEvent.id = :id" ,
31+ countQuery = "SELECT count(f) FROM sound_data f WHERE f.soundEvent.id = :id" )
32+ Page <SoundFileSource > findSoundFileSourcesBySoundEvent (UUID id , Pageable pageable );
33+
34+ }
You can’t perform that action at this time.
0 commit comments