Package org.localify.city
Class CityServiceImpl
java.lang.Object
org.localify.city.CityServiceImpl
- All Implemented Interfaces:
CityService
Implementation of the
CityService interface.-
Field Summary
Fields inherited from interface org.localify.city.CityService
MAX_NEAREST_RESULTS -
Constructor Summary
ConstructorsConstructorDescriptionCityServiceImpl(CityRepository cityRepository, EventRepository eventRepository, PointUtil pointUtil, ArtistCityRepository artistCityRepository, VenueRepository venueRepository, PlaylistService playlistService, UserFavoriteEventRepository userFavoriteEventRepository, UserCityRepository userCityRepository, UserRecentCityViewRepository userRecentCityViewRepository, UserRepository userRepository, LocalifyProperties properties, UserFavoriteArtistRepository userFavoriteArtistRepository) Constructs a new CityServiceImpl. -
Method Summary
Modifier and TypeMethodDescriptioncreatePlaylist(City city) Creates a playlist for a city.voiddeleteById(UUID cityId) Deletes a city by its ID.voidfindCityTimezone(City city) Finds the timezone for a city.findOrCreateCity(String locationText) Finds or creates a city from a location string.org.springframework.data.domain.Page<City.CityArtistApiResponse>getArtists(UUID cityId, PageOptions options, UUID userId) Gets the artists for a city.Gets a city by its ID.getByIdExtended(UUID cityId) Gets an extended city response by its ID.getByIdWithArtists(UUID userId, UUID cityId) Gets a city with its artists by its ID.getCityArtistProportions(PageOptions pageOptions) Gets the city-artist proportions.getCityArtistProportionsByCreation(PageOptions pageOptions) Gets the city-artist proportions, ordered by creation date.org.springframework.data.domain.Page<EventResponseExtendedLocal>getEvents(UUID cityId, PageOptions options, UUID userId) Gets the events for a city.getNearestCities(double latitude, double longitude) Gets the nearest cities to a given location.getOrCreatePlaylist(UUID cityId) Gets or creates a playlist for a city.getRelevantCities(String query, double latitude, double longitude) Gets the relevant cities for a given query and location.org.springframework.data.domain.Page<VenueEventNumResponse>getVenues(UUID cityId, PageOptions options) Gets the venues for a city.patchById(UUID cityId, CityPatchRequest request) Patches a city by its ID.voidrecordUserCityView(UUID cityId, UUID userId) Records a user's view of a city.
-
Constructor Details
-
CityServiceImpl
public CityServiceImpl(CityRepository cityRepository, EventRepository eventRepository, PointUtil pointUtil, ArtistCityRepository artistCityRepository, VenueRepository venueRepository, PlaylistService playlistService, UserFavoriteEventRepository userFavoriteEventRepository, UserCityRepository userCityRepository, UserRecentCityViewRepository userRecentCityViewRepository, UserRepository userRepository, LocalifyProperties properties, UserFavoriteArtistRepository userFavoriteArtistRepository) Constructs a new CityServiceImpl.- Parameters:
cityRepository- The city repository.eventRepository- The event repository.pointUtil- The point utility.artistCityRepository- The artist-city repository.venueRepository- The venue repository.playlistService- The playlist service.userFavoriteEventRepository- The user favorite event repository.userCityRepository- The user-city repository.userRecentCityViewRepository- The user recent city view repository.userRepository- The user repository.properties- The application properties.userFavoriteArtistRepository- The user favorite artist repository.
-
-
Method Details
-
getById
Description copied from interface:CityServiceGets a city by its ID.- Specified by:
getByIdin interfaceCityService- Parameters:
cityId- The ID of the city.- Returns:
- The city response.
-
getByIdExtended
Description copied from interface:CityServiceGets an extended city response by its ID.- Specified by:
getByIdExtendedin interfaceCityService- Parameters:
cityId- The ID of the city.- Returns:
- The extended city response.
-
patchById
Description copied from interface:CityServicePatches a city by its ID.- Specified by:
patchByIdin interfaceCityService- Parameters:
cityId- The ID of the city.request- The patch request.- Returns:
- The updated city response.
-
deleteById
Description copied from interface:CityServiceDeletes a city by its ID.- Specified by:
deleteByIdin interfaceCityService- Parameters:
cityId- The ID of the city.
-
getEvents
public org.springframework.data.domain.Page<EventResponseExtendedLocal> getEvents(UUID cityId, PageOptions options, UUID userId) Description copied from interface:CityServiceGets the events for a city.- Specified by:
getEventsin interfaceCityService- Parameters:
cityId- The ID of the city.options- The page options.userId- The ID of the user.- Returns:
- A page of events.
-
getArtists
public org.springframework.data.domain.Page<City.CityArtistApiResponse> getArtists(UUID cityId, PageOptions options, UUID userId) Description copied from interface:CityServiceGets the artists for a city.- Specified by:
getArtistsin interfaceCityService- Parameters:
cityId- The ID of the city.options- The page options.userId- The ID of the user.- Returns:
- A page of artists.
-
getVenues
public org.springframework.data.domain.Page<VenueEventNumResponse> getVenues(UUID cityId, PageOptions options) Description copied from interface:CityServiceGets the venues for a city.- Specified by:
getVenuesin interfaceCityService- Parameters:
cityId- The ID of the city.options- The page options.- Returns:
- A page of venues.
-
getRelevantCities
public List<CityResponse> getRelevantCities(@Nullable String query, double latitude, double longitude) Description copied from interface:CityServiceGets the relevant cities for a given query and location.- Specified by:
getRelevantCitiesin interfaceCityService- Parameters:
query- The search query.latitude- The latitude.longitude- The longitude.- Returns:
- A list of relevant cities.
-
getNearestCities
Description copied from interface:CityServiceGets the nearest cities to a given location.- Specified by:
getNearestCitiesin interfaceCityService- Parameters:
latitude- The latitude.longitude- The longitude.- Returns:
- A list of nearest cities.
-
createPlaylist
Description copied from interface:CityServiceCreates a playlist for a city.- Specified by:
createPlaylistin interfaceCityService- Parameters:
city- The city.- Returns:
- The created playlist.
-
getOrCreatePlaylist
Description copied from interface:CityServiceGets or creates a playlist for a city.- Specified by:
getOrCreatePlaylistin interfaceCityService- Parameters:
cityId- The ID of the city.- Returns:
- The playlist.
-
recordUserCityView
Records a user's view of a city.- Parameters:
cityId- The ID of the city.userId- The ID of the user.
-
getByIdWithArtists
Description copied from interface:CityServiceGets a city with its artists by its ID.- Specified by:
getByIdWithArtistsin interfaceCityService- Parameters:
userId- The ID of the user.cityId- The ID of the city.- Returns:
- The city artists response.
-
getCityArtistProportions
Description copied from interface:CityServiceGets the city-artist proportions.- Specified by:
getCityArtistProportionsin interfaceCityService- Parameters:
pageOptions- The page options.- Returns:
- A list of city-artist proportion responses.
-
getCityArtistProportionsByCreation
public List<CityArtistProportionResponse> getCityArtistProportionsByCreation(PageOptions pageOptions) Description copied from interface:CityServiceGets the city-artist proportions, ordered by creation date.- Specified by:
getCityArtistProportionsByCreationin interfaceCityService- Parameters:
pageOptions- The page options.- Returns:
- A list of city-artist proportion responses.
-
findOrCreateCity
Description copied from interface:CityServiceFinds or creates a city from a location string.- Specified by:
findOrCreateCityin interfaceCityService- Parameters:
locationText- The location string.- Returns:
- The found or created city.
-
findCityTimezone
Description copied from interface:CityServiceFinds the timezone for a city.- Specified by:
findCityTimezonein interfaceCityService- Parameters:
city- The city.
-