Package org.localify.repositories
Interface ArtistEventRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<ArtistEvent,,ArtistEvent.Key> org.springframework.data.repository.Repository<ArtistEvent,ArtistEvent.Key>
public interface ArtistEventRepository
extends org.springframework.data.repository.CrudRepository<ArtistEvent,ArtistEvent.Key>
Repository for
ArtistEvent entities.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddArtistEvent(UUID artistId, UUID eventId) Adds a new artist-event relationship.countArtistsByEventStartTimeAfter(Instant startTime) Counts the number of distinct artists with events after a certain time.findAllByEventId(UUID eventId) Finds all artist-event relationships for an event.findByArtistAndEvent(Artist artist, Event event) Finds an artist-event relationship by artist and event.findByArtistIdAndEventId(UUID artistId, UUID eventId) Finds an artist-event relationship by artist ID and event ID.findByVenueId(UUID venueId, Instant after) Finds all artist-event relationships for a venue after a certain time.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
Method Details
-
findByArtistAndEvent
Finds an artist-event relationship by artist and event.- Parameters:
artist- The artist.event- The event.- Returns:
- An optional containing the artist-event relationship if found, otherwise empty.
-
findByArtistIdAndEventId
Finds an artist-event relationship by artist ID and event ID.- Parameters:
artistId- The ID of the artist.eventId- The ID of the event.- Returns:
- The artist-event relationship.
-
addArtistEvent
@Modifying @Query(value="insert into artist_events (artist_id, event_id) values (:artistId, :eventId) on conflict do nothing", nativeQuery=true) void addArtistEvent(UUID artistId, UUID eventId) Adds a new artist-event relationship.- Parameters:
artistId- The ID of the artist.eventId- The ID of the event.
-
findByVenueId
@Query("select ae from ArtistEvent ae where ae.event.venue.id = :venueId and ae.event.startTime > :after") List<ArtistEvent> findByVenueId(UUID venueId, Instant after) Finds all artist-event relationships for a venue after a certain time.- Parameters:
venueId- The ID of the venue.after- The timestamp to search after.- Returns:
- A list of artist-event relationships.
-
countArtistsByEventStartTimeAfter
@Async @Query("select count(distinct ae.artist) from ArtistEvent ae where ae.event.startTime >= :startTime") CompletableFuture<Integer> countArtistsByEventStartTimeAfter(Instant startTime) Counts the number of distinct artists with events after a certain time.- Parameters:
startTime- The timestamp to search after.- Returns:
- A completable future containing the number of artists.
-
findAllByEventId
Finds all artist-event relationships for an event.- Parameters:
eventId- The ID of the event.- Returns:
- A list of artist-event relationships.
-