Ignore:
Timestamp:
03/16/25 20:56:44 (3 months ago)
Author:
ste08 <sjovanoska@…>
Branches:
master
Children:
3a74959
Parents:
c064a42
Message:

Notifications + triggers!

Location:
src/main/java/com/example/skychasemk/services
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/skychasemk/services/BookingService.java

    rc064a42 r8a947b9  
    33import com.example.skychasemk.model.Booking;
    44import com.example.skychasemk.repository.BookingRepository;
     5import jakarta.transaction.Transactional;
    56import org.springframework.beans.factory.annotation.Autowired;
    67import org.springframework.stereotype.Service;
  • src/main/java/com/example/skychasemk/services/NotificationService.java

    rc064a42 r8a947b9  
    1515    private NotificationRepository notificationRepository;
    1616
    17     // Get all notifications
    18     public List<Notification> getAllNotifications() {
    19         return notificationRepository.findAll();
     17    public List<Notification> getAllNotifications(Integer userId) {
     18        return notificationRepository.findByUserId(userId);
    2019    }
    2120
    22     // Get notification by ID
    23     public Optional<Notification> getNotificationById(Integer notificationID) {
    24         return notificationRepository.findById(notificationID);
    25     }
    26 
    27     // Save a new notification
    2821    public Notification saveNotification(Notification notification) {
    2922        return notificationRepository.save(notification);
    3023    }
    3124
    32     // Update an existing notification
    3325    public Notification updateNotification(Integer notificationID, Notification notification) {
    3426        if (notificationRepository.existsById(notificationID)) {
     
    4032    }
    4133
    42     // Delete notification
    4334    public void deleteNotification(Integer notificationID) {
    4435        notificationRepository.deleteById(notificationID);
Note: See TracChangeset for help on using the changeset viewer.