Class NotificationController

java.lang.Object
edu.ntnu.idatt2106_2023_06.backend.controller.NotificationController

@RestController @CrossOrigin("*") @RequestMapping("/notification") public class NotificationController extends Object
This class represents the REST controller for managing notifications for a user. It handles requests related to retrieving, updating, and deleting notifications for a user.
Author:
Brage Halvorsen Kvamme, Trym Hamer Gudvangen
  • Constructor Details

    • NotificationController

      public NotificationController()
  • Method Details

    • getNotifications

      @GetMapping("/get") public org.springframework.http.ResponseEntity<Object> getNotifications()
      This method returns all notifications for a given user.
      Returns:
      ResponseEntity containing a list of NotificationDTOs representing all notifications for a given user
    • updateNotifications

      @GetMapping("/update") public org.springframework.http.ResponseEntity<Object> updateNotifications()
      This method updates notifications for a given user.
      Returns:
      ResponseEntity indicating that the notifications have been updated
    • deleteAllNotifications

      @DeleteMapping("/delete/all/{fridgeId}") public org.springframework.http.ResponseEntity<Object> deleteAllNotifications(@PathVariable Long fridgeId)
      This method deletes all notifications of a user.
      Parameters:
      fridgeId - The ID of the fridge the notifications belong to
      Returns:
      ResponseEntity indicating that all notifications have been deleted
    • deleteNotification

      @DeleteMapping("/delete/{notificationId}") public org.springframework.http.ResponseEntity<Object> deleteNotification(@PathVariable Long notificationId)
      This method deletes a single notification of a user.
      Parameters:
      notificationId - The ID of the notification to delete
      Returns:
      ResponseEntity indicating that the notification has been deleted
    • setNotificationAsRead

      @PutMapping("/read/all") public org.springframework.http.ResponseEntity<Object> setNotificationAsRead()
      Set all notifications as read.
      Returns:
      ResponseEntity indicating that all notifications have been set as read