Skip to content

Commit

Permalink
♻️ style: friend controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerohertz committed Oct 30, 2024
1 parent 910fb95 commit 03ae5d8
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class FriendController {
@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/request")
@Operation(summary = "친구 신청 생성", description = "친구 신청할 사용자의 이름을 입력하여 친구 신청 생성")
public ApiResponseDto<String> createFriendRequest(@RequestParam String receiptUsername,
HttpServletRequest request) {
public ApiResponseDto<String> createFriendRequest(HttpServletRequest request,
@RequestParam String receiptUsername) {
String requestUsername = jwtService.extractUsernameFromToken(request).get();
friendService.createFriendRequest(requestUsername, receiptUsername);
return ApiResponseDto.success(HttpStatus.CREATED.value(),
Expand All @@ -58,8 +58,8 @@ public ApiResponseDto<List<GetFriendOutDto>> getFriendRequest(
@ResponseStatus(HttpStatus.OK)
@DeleteMapping("/request")
@Operation(summary = "친구 신청 취소", description = "친구 신청할 사용자의 이름을 입력하여 친구 신청 삭제")
public ApiResponseDto<String> deleteFriendRequest(@RequestParam String receiptUsername,
HttpServletRequest request) {
public ApiResponseDto<String> deleteFriendRequest(HttpServletRequest request,
@RequestParam String receiptUsername) {
String requestUsername = jwtService.extractUsernameFromToken(request).get();
friendService.deleteFriendRequest(requestUsername, receiptUsername);
return ApiResponseDto.success(HttpStatus.OK.value(), String
Expand All @@ -69,9 +69,8 @@ public ApiResponseDto<String> deleteFriendRequest(@RequestParam String receiptUs
@ResponseStatus(HttpStatus.OK)
@GetMapping("/receipt")
@Operation(summary = "친구 내역 조회", description = "사용자 기준 신청 받은 내역")
public ApiResponseDto<List<GetFriendOutDto>> getFriendReceipt(
@RequestParam(required = false) FriendState state,
HttpServletRequest request) {
public ApiResponseDto<List<GetFriendOutDto>> getFriendReceipt(HttpServletRequest request,
@RequestParam(required = false) FriendState state) {
String username = jwtService.extractUsernameFromToken(request).get();
List<GetFriendOutDto> getUserOutDtos = friendService.getReceiptUser(username, state);
return ApiResponseDto.success(HttpStatus.OK.value(), getUserOutDtos);
Expand All @@ -80,8 +79,8 @@ public ApiResponseDto<List<GetFriendOutDto>> getFriendReceipt(
@ResponseStatus(HttpStatus.CREATED)
@PutMapping("/receipt")
@Operation(summary = "친구 신청 승인", description = "친구 신청을 승인할 사용자의 이름을 입력하여 친구 신청 승인")
public ApiResponseDto<String> approveFriendRequest(@RequestParam String requestUsername,
HttpServletRequest request) {
public ApiResponseDto<String> approveFriendRequest(HttpServletRequest request,
@RequestParam String requestUsername) {
String receiptUsername = jwtService.extractUsernameFromToken(request).get();
friendService.acceptFriendRequest(requestUsername, receiptUsername);
return ApiResponseDto.success(HttpStatus.CREATED.value(), String.format(
Expand Down

0 comments on commit 03ae5d8

Please sign in to comment.