Class PhotoService


  • @Service
    public class PhotoService
    extends Object
    This is a @Service class and holds the additional logic for the queries involving a photo in the PicMe database.
    • Constructor Detail

      • PhotoService

        @Autowired
        public PhotoService​(PhotoRepository photoRepository)
        This constructor initializes a PhotoRepository object.
        Parameters:
        photoRepository - is a PhotoRepository object.
    • Method Detail

      • save

        public Photo save​(Photo photo,
                          Event event)
        Saves a new photo associated with a specific event into the PicMe database.
        Parameters:
        photo - is a new photo object.
        event - is the event a photo was taken at.
        Returns:
        A saved Photo.
      • delete

        public void delete​(Photo photo,
                           Long id)
        Deletes a specific photo.
        Parameters:
        photo - is the photo that is being deleted.
        id - is the primary key of the photo that is being deleted.
      • getAllPhotosByUser

        public List<Photo> getAllPhotosByUser​(User user)
        Gets all the photos associated with a user.
        Parameters:
        user - is the person who took the photo.
        Returns:
        A list of photos that a user has taken.