Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/sophy/sophy/controller/MemberController.java
#	src/main/java/org/sophy/sophy/service/MemberService.java
  • Loading branch information
dong2ast committed Jul 12, 2023
2 parents 7382ad8 + b41987c commit 9f3da5b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import javax.validation.Valid;
import java.util.List;

@RestController
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public ApiResponseDto<List<MyPageBooktalkDto>> getMyBooktalks(@PathVariable("mem
@GetMapping("/author-booktalks/{memberId}")
@ResponseStatus(HttpStatus.OK)
public ApiResponseDto<List<MyPageBooktalkDto>> getAuthorBooktalks(@PathVariable("memberId") Long memberId) {
return ApiResponseDto.success(SuccessStatus.GET_AUTHOR_BOOKTALKS_SUCCESS, memberService.getAuthorByMemberId(memberId));
return ApiResponseDto.success(SuccessStatus.GET_AUTHOR_BOOKTALKS_SUCCESS, memberService.getAuthorBooktalksByMemberId(memberId));
}
}
3 changes: 1 addition & 2 deletions src/main/java/org/sophy/sophy/service/BooktalkService.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ public class BooktalkService {
@Transactional
public BooktalkCreateResponseDto createBooktalk(BooktalkRequestDto booktalkRequestDto) {
Place place = getPlaceById(booktalkRequestDto.getPlaceId());
//작가인지 확인할 필요가 있는지?
Member member = getMemberById(booktalkRequestDto.getMemberId());
if(!member.getIsAuthor()) {
if (!member.getIsAuthor()) {
throw new ForbiddenException(ErrorStatus.FORBIDDEN_USER_EXCEPTION, ErrorStatus.FORBIDDEN_USER_EXCEPTION.getMessage());
}
Booktalk booktalk = booktalkRequestDto.toBooktalk(place, member);
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/org/sophy/sophy/service/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private Member getMemberById(Long memberId) {
}

@Transactional
public List<MyPageBooktalkDto> getBooktalksByMemberId(Long memberId) {
public List<MyPageBooktalkDto> getBooktalksByMemberId(Long memberId) { //예정된 북토크 조회 메서드
List<MemberBooktalk> userBookTalkList = getMemberById(memberId).getUserBookTalkList();
List<MyPageBooktalkDto> booktalkResponseDtoList = new ArrayList<>();
userBookTalkList.forEach(memberBooktalk -> {
Expand All @@ -97,11 +97,10 @@ public List<MyPageBooktalkDto> getBooktalksByMemberId(Long memberId) {
}

@Transactional
public List<MyPageBooktalkDto> getAuthorByMemberId(Long memberId) {
List<MemberBooktalk> authorBookTalkList = getMemberById(memberId).getUserBookTalkList();
public List<MyPageBooktalkDto> getAuthorBooktalksByMemberId(Long memberId) { //작가 북토크 조회 메서드
List<Booktalk> authorBookTalkList = getMemberById(memberId).getAuthorProperty().getMyBookTalkList();
List<MyPageBooktalkDto> booktalkResponseDtoList = new ArrayList<>();
authorBookTalkList.forEach(memberBooktalk -> {
Booktalk booktalk = memberBooktalk.getBooktalk();
authorBookTalkList.forEach(booktalk -> {
booktalkResponseDtoList.add(MyPageBooktalkDto.builder()
.booktalkId(booktalk.getId())
.booktalkImageUrl(booktalk.getBooktalkImageUrl())
Expand Down

0 comments on commit 9f3da5b

Please sign in to comment.