Merge branch 'route_alternatives'
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
# Conflicts: # src/main/java/SuMoC/backend/user/models/User.java
This commit is contained in:
@@ -66,6 +66,16 @@ public class FriendshipController {
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@Operation(summary = "Request a friendship with another user by friend code.", description = "Sends a friendship request to another user identified by their friend code from the logged in user.")
|
||||
@PostMapping("/request/by-friendcode/{friendCode}")
|
||||
public ResponseEntity<Void> requestFriendshipByFriendcode(@PathVariable String friendCode) {
|
||||
User user = getAuthenticatedUser();
|
||||
User requestedFriend = userRepository.findByFriendCode(friendCode).orElseThrow();
|
||||
checkSelfAction(user.getId(), requestedFriend.getId());
|
||||
friendshipService.requestFriendship(user, requestedFriend.getId());
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@Operation(summary = "Accept a friendship request.", description = "Accepts a pending friendship request for the logged in user from user with friendId.")
|
||||
@PostMapping("/accept/{friendId}")
|
||||
public ResponseEntity<Void> acceptFriendship(@PathVariable Long friendId) {
|
||||
|
||||
Reference in New Issue
Block a user