Class ContactPreferencesController

java.lang.Object
restapi.controllers.ContactPreferencesController

@RestController @RequestMapping("/contact") public class ContactPreferencesController extends Object
  • Field Details

    • userService

      @NonNull private final @NonNull UserService userService
    • contactPreferencesService

      @NonNull private final @NonNull ContactPreferencesService contactPreferencesService
    • contactService

      @NonNull private final @NonNull ContactService contactService
  • Constructor Details

    • ContactPreferencesController

      public ContactPreferencesController()
  • Method Details

    • getContacts

      @GetMapping("/all") public org.springframework.http.ResponseEntity<RestResponse> getContacts(@AuthenticationPrincipal LoggedUser user)
      Endpoint to get all contacts for User endpoint /contact/all
      Parameters:
      user - Authenticated LoggedUser from token
      Returns:
      user's contacts
    • getContactPreferences

      @GetMapping("/details") public org.springframework.http.ResponseEntity<RestResponse> getContactPreferences(@AuthenticationPrincipal LoggedUser user, @RequestParam long contactId)
      Endpoint to get the details of specific contact endpoint /contact/details
      Parameters:
      user - Authenticated LoggedUser from token
      contactId - id of contact to get the details from
      Returns:
      contacts' details in form of ContactDTO
      See Also:
    • updateContactRange

      @PutMapping("/range") public org.springframework.http.ResponseEntity<RestResponse> updateContactRange(@AuthenticationPrincipal LoggedUser user, @RequestParam long contactId, @RequestParam long range)
      Endpoint to update range for specific contact endpoint /contact/range
      Parameters:
      user - Authenticated LoggedUser from token
      contactId - Id of contact we want to change the range for
      range - New range to save on database
      Returns:
      Rest Message OK or Error 404
    • updateContactBlocked

      @PutMapping("/block") public org.springframework.http.ResponseEntity<RestResponse> updateContactBlocked(@AuthenticationPrincipal LoggedUser user, @RequestParam long contactId, @RequestParam boolean blocked)
      Changes if a given contact is blocked by user or not, and updates the shared preferences. The end result of blocked is given by the parameter blocked. endpoint /contact/block
      Parameters:
      user - Authenticated LoggedUser from token
      contactId - Id of contact we want to block or unblock
      blocked - True if the user wants to block contact, false otherwise
      Returns:
      Rest Message OK or Error 404