Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
03c3b83
Article Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
7102469
Article Custom Error Exception 구현
qowl880 May 28, 2025
c1430ba
Auditing 설정 추가
qowl880 May 28, 2025
d3bb9b0
Article Create Controller 구현
qowl880 May 28, 2025
a99878a
Article Delete Controller 구현
qowl880 May 28, 2025
84c5f3e
Article Controller CUD 구현
qowl880 May 28, 2025
86eeeaa
Comment Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
7da5d10
Comment Controller Create 구현
qowl880 May 28, 2025
329c767
application yml파일 배포/로컬 분리
qowl880 May 28, 2025
8b4103c
Article Create Controller 구현
qowl880 May 28, 2025
d2bbbe3
Article Delete Controller 구현
qowl880 May 28, 2025
0e44782
Article Controller CUD 구현
qowl880 May 28, 2025
227dfe2
application.yml 통합
qowl880 May 28, 2025
9fa5a98
Article Repository 설정
qowl880 Jun 3, 2025
98011d8
Comment Error Exception 생성
qowl880 Jun 4, 2025
150b6ba
구조 변경
qowl880 Jun 4, 2025
8eee7d1
Comment Read 전용 Dao 생성
qowl880 Jun 4, 2025
3ad47f5
application yml파일 배포/로컬 분리
qowl880 May 28, 2025
f3e6495
Article Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
3838e61
Article Create Controller 구현
qowl880 May 28, 2025
cdeb58d
Article Delete Controller 구현
qowl880 May 28, 2025
70fddf9
Article Controller CUD 구현
qowl880 May 28, 2025
7730320
application.yml 통합
qowl880 May 28, 2025
4947b6a
Article Repository 설정
qowl880 Jun 3, 2025
213b1ca
개행 추가
qowl880 Jun 6, 2025
836179d
ErrorException 통합
qowl880 Jun 8, 2025
d65cb62
Dao -> QueryResult 파일명 변경
qowl880 Jun 8, 2025
6681092
Update IdolApplication.java
qowl880 Jun 10, 2025
750f478
유저 인증 검사 추가
qowl880 Jun 14, 2025
d2124ce
Article Entity 구현
qowl880 May 28, 2025
5bb6ac8
Article Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
572a66b
Article Custom Error Exception 구현
qowl880 May 28, 2025
c14a5c4
Auditing 설정 추가
qowl880 May 28, 2025
2474615
Article Create Controller 구현
qowl880 May 28, 2025
5895558
Article Delete Controller 구현
qowl880 May 28, 2025
11e7b8d
Article Controller CUD 구현
qowl880 May 28, 2025
7aca898
S3 관련 이미지 업로드 및 호출 기능 구현
qowl880 May 28, 2025
a61d442
Comment Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
ead36e5
Comment Controller Create 구현
qowl880 May 28, 2025
3443188
application yml파일 배포/로컬 분리
qowl880 May 28, 2025
c0124e1
Article Create Controller 구현
qowl880 May 28, 2025
0a4646b
Article Delete Controller 구현
qowl880 May 28, 2025
2188c71
Article Controller CUD 구현
qowl880 May 28, 2025
62d9660
application.yml 통합
qowl880 May 28, 2025
e5e8c78
Article Repository 설정
qowl880 Jun 3, 2025
14ead0d
Comment Error Exception 생성
qowl880 Jun 4, 2025
c54d691
구조 변경
qowl880 Jun 4, 2025
4c125c7
Comment Read 전용 Dao 생성
qowl880 Jun 4, 2025
46f437e
application yml파일 배포/로컬 분리
qowl880 May 28, 2025
6c3a097
Article Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
dc65bc9
Article Create Controller 구현
qowl880 May 28, 2025
2fc404a
Article Delete Controller 구현
qowl880 May 28, 2025
ca0d913
Article Controller CUD 구현
qowl880 May 28, 2025
ee1df8a
application.yml 통합
qowl880 May 28, 2025
784c408
SoftDelete 추가
qowl880 Jun 3, 2025
8a2841b
Article Repository 설정
qowl880 Jun 3, 2025
1f3687d
개행 추가
qowl880 Jun 6, 2025
a819c29
ErrorException 통합
qowl880 Jun 8, 2025
cf02cc0
Dao -> QueryResult 파일명 변경
qowl880 Jun 8, 2025
c61540b
S3 의존성 변경에 따른 구조 변경
qowl880 Jun 8, 2025
cf22561
Update IdolApplication.java
qowl880 Jun 10, 2025
b6fbd65
유저 인증 검사 추가
qowl880 Jun 14, 2025
2602e33
@Where 삭제
qowl880 Jun 17, 2025
68be269
오류로 인한 주석처리
qowl880 Jun 18, 2025
ae68fc6
aws 관련 설정 추가
qowl880 Jun 19, 2025
44fa33f
무한 스크롤 구현
qowl880 Jun 22, 2025
1414bbd
댓글 업데이트, 삭제 기능 수정
qowl880 Jun 22, 2025
f4e2b57
유저 정보 수정 기능 수정
qowl880 Jun 22, 2025
147c0ea
유저 정보 수정 기능 수정
qowl880 Jun 22, 2025
c12eb77
Total 기능 추가
qowl880 Jun 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public ApiResponse<Long> deleteComment(@PathVariable(name = "articleId") Long ar
@Operation(summary = "댓글 수정", description = "댓글 수정")
@PatchMapping("/{articleId}/comment")
public ApiResponse<Long> updateComment(@PathVariable Long articleId, @RequestBody CommentUpdateRequestDto requestDto, @MemberId Long writerId) {
Long commentId = updateCommentUseCase.updateComment(requestDto,writerId);
Long returnCommentId = updateCommentUseCase.updateComment(requestDto,writerId);

return ApiResponse.ok(commentId, "댓글 생성 성공");
return ApiResponse.ok(returnCommentId, "댓글 수정 성공");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ public class GetMyPageController {

@Operation(summary = "나의 펜팔 출력", description = "나의 펜팔 출력")
@GetMapping()
public ApiResponse<List<ArticleListResponseDto>> readAllJoinMyPage(
public ApiResponse<UserAnswerTotalResponseDto> readAllJoinMyPage(
@RequestParam(value = "limit")Long limit,
@RequestParam(value = "page")Long page,
@MemberId Long userId
){

List<ArticleListResponseDto> dto = readMypageUseCase.readJoinMypageList(limit,page,userId);
UserAnswerTotalResponseDto dto = readMypageUseCase.readJoinMypageList(limit,page,userId);

return ApiResponse.ok(dto, "나의 펜팔 리스트 조회 성공");
}


@Operation(summary = "내가 만든 펜팔 출력", description = "내가 만든 펜팔 출력")
@GetMapping("/self")
public ApiResponse<List<ArticleListResponseDto>> readAllCreateMyPage(
public ApiResponse<UserAnswerTotalResponseDto> readAllCreateMyPage(
@RequestParam(value = "limit")Long limit,
@RequestParam(value = "page")Long page,
@MemberId Long userId
){

List<ArticleListResponseDto> dto = readMypageUseCase.readMypageList(limit,page,userId);
UserAnswerTotalResponseDto dto = readMypageUseCase.readMypageList(limit,page,userId);

return ApiResponse.ok(dto, "나가 만든 펜팔 리스트 조회 성공");
}
Expand All @@ -70,9 +70,10 @@ public ApiResponse<UserDataResponseDto> readUserInformation(
@GetMapping("/answer")
public ApiResponse<UserAnswerTotalResponseDto> readAllAnswers(
@RequestParam(value = "lastArticleId", required = false) Long lastArticleId,
@RequestParam(value = "limit")Long limit,
@MemberId Long userId
) {
UserAnswerTotalResponseDto response= readMypageUseCase.readAllAnswers(lastArticleId,userId);
UserAnswerTotalResponseDto response= readMypageUseCase.readAllAnswers(lastArticleId,userId, limit);
return ApiResponse.ok(response, "나의 답변 리스트 출력 성공");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import java.util.List;

public record UserAnswerTotalResponseDto(
public record UserAnswerTotalResponseDto<T>(
int totalCount,
List<UserAnswerResponseDto> data
List<T> data
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ List<ArticleListReadQueryResult> findArticleList(

List<ArticleListReadQueryResult> findJoinMyPageArticle(List<Long> articleIds, Long limit, Long offset);

List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArticle(Long userId);
List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArticle(Long lastArticleId, Long userId);
List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArticle(Long userId, Long limit);
List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArticle(Long lastArticleId, Long userId, Long limit);
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public List<ArticleListReadQueryResult> findJoinMyPageArticle(List<Long> article
}

@Override
public List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArticle( Long userId) {
public List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArticle( Long userId, Long limit) {
return queryFactory
.select(Projections.constructor(ArticleReadAnswerQueryResult.class,
article.articleId,
Expand All @@ -138,12 +138,13 @@ public List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArt
article.isDeleted.eq(false),
article.writerId.in(userId)
)
.limit(limit)
.fetch();
}

@Override
public List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArticle(
Long lastArticleId, Long userId) {
Long lastArticleId, Long userId, Long limit) {
return queryFactory
.select(Projections.constructor(ArticleReadAnswerQueryResult.class,
article.articleId,
Expand All @@ -154,11 +155,12 @@ public List<ArticleReadAnswerQueryResult> findAllByWriterIdInfiniteScrollFromArt
article.isDeleted.eq(false),
article.writerId.in(userId),
new BooleanBuilder()
.or(article.articleId.eq(lastArticleId))
.or(article.articleId.gt(lastArticleId))
)
.orderBy(
article.articleId.asc()
)
.limit(limit)
.fetch();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private boolean hasChildren(Comment comment) {
}

private void validateUserHasPermission(Comment comment, Long writerId) {
if (Long.compare(comment.getWriterId(), writerId) == 0) {
if (comment.getWriterId() != writerId) {
throw new IllegalArgumentException("Comment",comment.getCommentId());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class UpdateCommentService implements UpdateCommentUseCase {
private final CommentRepository commentRepository;

@Override
public Long updateComment(CommentUpdateRequestDto commentUpdateRequestDto, Long writerId) {
public Long updateComment(CommentUpdateRequestDto commentUpdateRequestDto, Long writerId) {
Comment comment = commentRepository.findByCommentId(commentUpdateRequestDto.commentId())
.orElseThrow(() -> new NotFoundException("Comment", commentUpdateRequestDto.commentId()));

Expand All @@ -31,7 +31,7 @@ public Long updateComment(CommentUpdateRequestDto commentUpdateRequestDto, Long
}

private void validateUserHasPermission(Comment comment, Long writerId) {
if (Long.compare(comment.getWriterId(), writerId) == 0) {
if (comment.getWriterId() != writerId) {
throw new IllegalArgumentException("Comment",comment.getCommentId());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import com.idol.global.util.PasswordEncryptor;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
@Transactional
public class UpdateMyPageService implements UpdateMyPageUseCase {

private final MemberJpaRepository memberJpaRepository;
Expand All @@ -21,8 +23,11 @@ public class UpdateMyPageService implements UpdateMyPageUseCase {
public Long updateProfile(MyPageUpdateRequestDto dto, Long userId) {
Member member = memberJpaRepository.findById(userId)
.orElseThrow(() -> new NotFoundException("Member", userId));
String encryptedPassword = null;

String encryptedPassword = passwordEncryptor.encrypt(dto.password());
if(dto.password() != null){
encryptedPassword = passwordEncryptor.encrypt(dto.password());
}

member.update(dto, encryptedPassword);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ReadMyPageService implements ReadMyPageUseCase {
private final CountWishUsecase countWishUsecase;

@Override
public List<ArticleListResponseDto> readMypageList(Long limit, Long page, Long userId) {
public UserAnswerTotalResponseDto readMypageList(Long limit, Long page, Long userId) {
List<ArticleListResponseDto> searchMyPageList = articleRepository.findMyPageArticle(userId, limit, (page -1) * limit)
.stream().map(result ->
ArticleListResponseDto.from(
Expand All @@ -57,12 +57,12 @@ public List<ArticleListResponseDto> readMypageList(Long limit, Long page, Long u
))
.collect(Collectors.toList());

return searchMyPageList;
return new UserAnswerTotalResponseDto(searchMyPageList.size(), searchMyPageList);
}


@Override
public List<ArticleListResponseDto> readJoinMypageList(Long limit, Long page, Long userId) {
public UserAnswerTotalResponseDto readJoinMypageList(Long limit, Long page, Long userId) {
List<Participant> participants = participantRepository.findParticipantFromWriterId(userId);

List<Long> articleIds = participants.stream().map(Participant::getArticleId).collect(Collectors.toList());
Expand All @@ -77,7 +77,8 @@ public List<ArticleListResponseDto> readJoinMypageList(Long limit, Long page, Lo
))
.collect(Collectors.toList());

return searchMyPageList;

return new UserAnswerTotalResponseDto(searchMyPageList.size(), searchMyPageList);
}

@Override
Expand All @@ -96,13 +97,13 @@ public UserDataResponseDto readUserInformation(Long userId) {
}

@Override
public UserAnswerTotalResponseDto readAllAnswers(Long lastArticleId, Long userId) {
public UserAnswerTotalResponseDto readAllAnswers(Long lastArticleId, Long userId, Long limit) {

List<UserAnswerResponseDto> userAnswerResponseDtos = new ArrayList<>();

List<ArticleReadAnswerQueryResult> answerArticles = lastArticleId == null?
articleRepository.findAllByWriterIdInfiniteScrollFromArticle(userId) :
articleRepository.findAllByWriterIdInfiniteScrollFromArticle(lastArticleId, userId);
articleRepository.findAllByWriterIdInfiniteScrollFromArticle(userId, limit) :
articleRepository.findAllByWriterIdInfiniteScrollFromArticle(lastArticleId, userId, limit);

for(ArticleReadAnswerQueryResult articles : answerArticles){
List<CommentReadAnswerQueryResult> answerComments =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import java.util.List;

public interface ReadMyPageUseCase {
List<ArticleListResponseDto> readMypageList(Long limit, Long page, Long userId);
UserAnswerTotalResponseDto readMypageList(Long limit, Long page, Long userId);

List<ArticleListResponseDto> readJoinMypageList(Long limit, Long page, Long userId);
UserAnswerTotalResponseDto readJoinMypageList(Long limit, Long page, Long userId);

UserDataResponseDto readUserInformation(Long userId);

UserAnswerTotalResponseDto readAllAnswers(
Long lastArticleId, Long userId);
Long lastArticleId, Long userId, Long limit);
}
1 change: 1 addition & 0 deletions src/main/java/com/idol/domains/member/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private Member(String email, String password, String nickname) {


public void update(MyPageUpdateRequestDto dto, String encryptedPassword) {
if(dto.email() != null ) this.email = dto.email();
if(dto.nickName() != null) this.nickname = dto.nickName();
if(dto.information() != null) this.information = dto.information();
if(dto.profileImgUrl() != null) this.profileImgUrl = dto.profileImgUrl();
Expand Down