Klasse ContactController
java.lang.Object
com.spaghetticodegang.trylater.contact.ContactController
REST controller providing endpoints for managing user contacts.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungorg.springframework.http.ResponseEntity
<ContactResponseDto> createContact
(User me, @Valid ContactRequestDto request) Handles a new contact request by delegating to the service layer.org.springframework.http.ResponseEntity
<Void> deleteContact
(User me, Long contactId) Deletes a contact or contact request by delegating the request to the service layer.org.springframework.http.ResponseEntity
<List<ContactResponseDto>> getAllContactsByStatusAndRole
(User me, ContactStatus contactStatus, ContactRole contactRole) Returns all contact or contact request for a user by delegating the request to the service layer.org.springframework.http.ResponseEntity
<ContactResponseDto> getContactById
(User me, Long contactId) Returns a contact or contact request by delegating the request to the service layer.org.springframework.http.ResponseEntity
<ContactResponseDto> updateContactStatus
(User me, Long contactId, @Valid ContactStatusRequestDto contactStatus) Updates the status of a contact by delegating the request to the service layer.
-
Konstruktordetails
-
ContactController
public ContactController()
-
-
Methodendetails
-
getAllContactsByStatusAndRole
@GetMapping public org.springframework.http.ResponseEntity<List<ContactResponseDto>> getAllContactsByStatusAndRole(@AuthenticationPrincipal User me, @RequestParam(name="status") ContactStatus contactStatus, @RequestParam(name="role",required=false) ContactRole contactRole) Returns all contact or contact request for a user by delegating the request to the service layer.- Parameter:
me
- the currently authenticated usercontactStatus
- the contact status provided by the usercontactRole
- the requester/receiver role provided by the user- Gibt zurück:
- the created contact as a response DTO
-
getContactById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<ContactResponseDto> getContactById(@AuthenticationPrincipal User me, @PathVariable("id") Long contactId) Returns a contact or contact request by delegating the request to the service layer.- Parameter:
me
- the currently authenticated usercontactId
- the ID of the contact whose is requested- Gibt zurück:
- the created contact as a response DTO
-
createContact
@PostMapping public org.springframework.http.ResponseEntity<ContactResponseDto> createContact(@AuthenticationPrincipal User me, @RequestBody @Valid @Valid ContactRequestDto request) Handles a new contact request by delegating to the service layer.- Parameter:
me
- the currently authenticated user (requester)request
- the contact request data including target user ID- Gibt zurück:
- the created contact as a response DTO
-
updateContactStatus
@PatchMapping("/{id}") public org.springframework.http.ResponseEntity<ContactResponseDto> updateContactStatus(@AuthenticationPrincipal User me, @PathVariable("id") Long contactId, @RequestBody @Valid @Valid ContactStatusRequestDto contactStatus) Updates the status of a contact by delegating the request to the service layer.- Parameter:
me
- the currently authenticated usercontactId
- the ID of the contact whose status is to be updatedcontactStatus
- the new contact status provided by the user- Gibt zurück:
- the updated contact as a response DTO
-
deleteContact
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> deleteContact(@AuthenticationPrincipal User me, @PathVariable("id") Long contactId) Deletes a contact or contact request by delegating the request to the service layer.- Parameter:
me
- the currently authenticated usercontactId
- the ID of the contact whose status is to be deleted- Gibt zurück:
- A
ResponseEntity
with HTTP status code 204 (NO_CONTENT)
-