Class PhotoService
- java.lang.Object
-
- edu.cnm.deepdive.picmegallery.service.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 Summary
Constructors Constructor Description PhotoService(PhotoRepository photoRepository)
This constructor initializes a PhotoRepository object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(Photo photo, Long id)
Deletes a specific photo.List<Photo>
getAllPhotosByUser(User user)
Gets all the photos associated with a user.Photo
save(Photo photo, Event event)
Saves a new photo associated with a specific event into 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.
-
-