Skip to content

Commit

Permalink
[refactor] 지원정보 컨트롤러 인증된 사용자 객체를 가져오도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
SoulTree-Lovers committed Oct 17, 2024
1 parent 9e991ec commit d3bcf1d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import com.bbteam.budgetbuddies.domain.supportinfo.dto.SupportRequest;
import com.bbteam.budgetbuddies.domain.supportinfo.dto.SupportResponseDto;
import com.bbteam.budgetbuddies.domain.supportinfo.service.SupportInfoService;
import com.bbteam.budgetbuddies.domain.user.dto.UserDto;
import com.bbteam.budgetbuddies.domain.user.validation.ExistUser;
import com.bbteam.budgetbuddies.global.security.utils.AuthUser;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
Expand Down Expand Up @@ -43,10 +45,10 @@ public ApiResponse<SupportResponseDto> registerSupportInfo(
@Override
@PostMapping("/likes/{supportInfoId}")
public ApiResponse<SupportResponseDto> likeSupportInfo(
@RequestParam @ExistUser Long userId,
@AuthUser UserDto.AuthUserDto user,
@PathVariable Long supportInfoId
) {
SupportResponseDto supportResponseDto = supportInfoService.toggleLike(userId, supportInfoId);
SupportResponseDto supportResponseDto = supportInfoService.toggleLike(user.getId(), supportInfoId);

return ApiResponse.onSuccess(supportResponseDto);
}
Expand Down Expand Up @@ -84,11 +86,11 @@ public ApiResponse<SupportResponseDto> getSupportInfo(
@Override
@GetMapping("/liked-all")
public ApiResponse<Page<SupportResponseDto>> getLikedSupportInfo(
@RequestParam @ExistUser Long userId,
@AuthUser UserDto.AuthUserDto user,
@RequestParam(defaultValue = "0") Integer page,
@RequestParam(defaultValue = "10") Integer size
) {
Page<SupportResponseDto> likedSupportInfoPage = supportInfoService.getLikedSupportInfo(userId, page, size);
Page<SupportResponseDto> likedSupportInfoPage = supportInfoService.getLikedSupportInfo(user.getId(), page, size);

return ApiResponse.onSuccess(likedSupportInfoPage);
}
Expand Down

0 comments on commit d3bcf1d

Please sign in to comment.