Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: 게시글 공동저자 설정 / 공개 범위 설정 / 소속 팀 설정 API 기능 구현 #299

Merged
merged 3 commits into from
Jan 16, 2025

Conversation

ParkJh38
Copy link
Member

@ParkJh38 ParkJh38 commented Jan 5, 2025

#️⃣연관된 이슈

#297

📝작업 내용

  • 게시글 공동 저자 설정 API 기능 구현
  • 게시글 공개 범위 설정 API 기능 구현
  • 게시글 소속 팀 설정 API 기능 구현

🔎코드 설명 및 참고 사항

멤버 및 팀의 접근 권한에 따라 설정 가능하도록 구현

💬리뷰 요구사항

@ParkJh38 ParkJh38 added the ✨ Feature 기능 개발 label Jan 5, 2025
@ParkJh38 ParkJh38 self-assigned this Jan 5, 2025
@ParkJh38 ParkJh38 linked an issue Jan 5, 2025 that may be closed by this pull request
3 tasks
@PatchMapping("/coauthor/{postId}")
@Operation(summary = "게시글 공동 저자 설정 API", description = "게시글의 공동 저자를 설정합니다.")
public ApiResponse<PostResponseDTO.UpdatePostResultDTO> setPostCoauthor(@PathVariable Long postId, @RequestBody PostRequestDTO.UpdateCoauthorRequestDTO request) {
Member member = memberCommandService.getRequester();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

멤버정보는 @AuthenticationPrincipal CustomMemberDetails customMemberDetails 사용하면 될 것 같습니다!

// 새로운 공동 저자 리스트 추가
Set<Author> coauthors = request.getMemberIds().stream()
.map(newCoauthorId -> {
Member newCoauthor = memberRepository.findById(newCoauthorId).orElseThrow(() -> new IllegalArgumentException("Member not found: " + newCoauthorId));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예외처리 GeneralException 사용 안하신 이유가 있나요?

public Post setPostTeam(Long postId, Long teamId) {
Post post = postRepository.findById(postId).orElseThrow(() -> new GeneralException(ErrorStatus.POST_NOT_FOUND));

Member authenticatedMember = getAuthenticatedMember();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAuthenticatedMember를 만드신 이유가 궁금합니다!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 로그인한 사용자가 게시글을 작성한 저자와 일치하는지 확인하기 위해 썼습니다!

@ParkJh38 ParkJh38 merged commit f5bec8f into develop Jan 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: 게시글 공동저자 설정 / 공개 범위 설정 / 소속 팀 설정
2 participants