Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
a3a497d
Article Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
bc9463b
Article Custom Error Exception 구현
qowl880 May 28, 2025
d6a6d72
Auditing 설정 추가
qowl880 May 28, 2025
9ef6b4a
Article Create Controller 구현
qowl880 May 28, 2025
fbce44f
Article Delete Controller 구현
qowl880 May 28, 2025
9bd2c34
Article Controller CUD 구현
qowl880 May 28, 2025
36d5434
Comment Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
f8af420
Comment Controller Create 구현
qowl880 May 28, 2025
f1ca578
application yml파일 배포/로컬 분리
qowl880 May 28, 2025
ff07710
Article Create Controller 구현
qowl880 May 28, 2025
48725a8
Article Delete Controller 구현
qowl880 May 28, 2025
a470292
Article Controller CUD 구현
qowl880 May 28, 2025
d58ecf5
application.yml 통합
qowl880 May 28, 2025
a51f859
Article Repository 설정
qowl880 Jun 3, 2025
60aec6b
Comment Error Exception 생성
qowl880 Jun 4, 2025
68e59b3
구조 변경
qowl880 Jun 4, 2025
022706f
Comment Read 전용 Dao 생성
qowl880 Jun 4, 2025
2e2d2a6
application yml파일 배포/로컬 분리
qowl880 May 28, 2025
0ce44e8
Article Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
9554182
Article Create Controller 구현
qowl880 May 28, 2025
3d3c37e
Article Delete Controller 구현
qowl880 May 28, 2025
1b1f55f
Article Controller CUD 구현
qowl880 May 28, 2025
172ffb5
application.yml 통합
qowl880 May 28, 2025
5321826
Article Repository 설정
qowl880 Jun 3, 2025
b58e1c7
개행 추가
qowl880 Jun 6, 2025
88ab887
ErrorException 통합
qowl880 Jun 8, 2025
db0231d
Dao -> QueryResult 파일명 변경
qowl880 Jun 8, 2025
86656a0
Update IdolApplication.java
qowl880 Jun 10, 2025
51a83c3
유저 인증 검사 추가
qowl880 Jun 14, 2025
caa98e9
Article Entity 구현
qowl880 May 28, 2025
fd72d43
Article Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
506ac5f
Article Custom Error Exception 구현
qowl880 May 28, 2025
0d99d08
Auditing 설정 추가
qowl880 May 28, 2025
255317d
Article Create Controller 구현
qowl880 May 28, 2025
ea4d0ae
Article Delete Controller 구현
qowl880 May 28, 2025
6a4dc26
Article Controller CUD 구현
qowl880 May 28, 2025
1f226ff
S3 관련 이미지 업로드 및 호출 기능 구현
qowl880 May 28, 2025
3ef68dd
Comment Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
54dfcf0
Comment Controller Create 구현
qowl880 May 28, 2025
e5248a9
application yml파일 배포/로컬 분리
qowl880 May 28, 2025
ba32d25
Article Create Controller 구현
qowl880 May 28, 2025
95b2c4e
Article Delete Controller 구현
qowl880 May 28, 2025
be3516d
Article Controller CUD 구현
qowl880 May 28, 2025
0650529
application.yml 통합
qowl880 May 28, 2025
3820004
Article Repository 설정
qowl880 Jun 3, 2025
0a2a99d
Comment Error Exception 생성
qowl880 Jun 4, 2025
7e43fdd
구조 변경
qowl880 Jun 4, 2025
244275c
Comment Read 전용 Dao 생성
qowl880 Jun 4, 2025
db69166
application yml파일 배포/로컬 분리
qowl880 May 28, 2025
d68caea
Article Repository Jpa / Query 전용 구분
qowl880 May 28, 2025
5d30c8f
Article Create Controller 구현
qowl880 May 28, 2025
2af16f6
Article Delete Controller 구현
qowl880 May 28, 2025
e5f2345
Article Controller CUD 구현
qowl880 May 28, 2025
349d461
application.yml 통합
qowl880 May 28, 2025
ca48857
SoftDelete 추가
qowl880 Jun 3, 2025
ccb3633
Article Repository 설정
qowl880 Jun 3, 2025
6c65db6
개행 추가
qowl880 Jun 6, 2025
2a59c9e
ErrorException 통합
qowl880 Jun 8, 2025
5808c31
Dao -> QueryResult 파일명 변경
qowl880 Jun 8, 2025
a0c3afa
S3 의존성 변경에 따른 구조 변경
qowl880 Jun 8, 2025
0fe59f7
Update IdolApplication.java
qowl880 Jun 10, 2025
2015768
유저 인증 검사 추가
qowl880 Jun 14, 2025
55d1da8
@Where 삭제
qowl880 Jun 17, 2025
fb41566
오류로 인한 주석처리
qowl880 Jun 18, 2025
f52cf1f
aws 관련 설정 추가
qowl880 Jun 19, 2025
2d7180a
게시글 모집 취소
qowl880 Jun 21, 2025
de518d2
mypage - 내가 참여한 펜팔 리스트 출력
qowl880 Jun 21, 2025
93b5f6d
mypage - 댓글 관련 코드 수정
qowl880 Jun 21, 2025
d5b4017
신청한 펜팔 리스트 삭제
qowl880 Jun 21, 2025
3def157
mypage - 내가 만든, 내가 신청한 펜팔 리스트, 유저 정보 Read
qowl880 Jun 21, 2025
b3a01af
UserData 삭제
qowl880 Jun 21, 2025
a0b9967
게시글 close 상태 변경
qowl880 Jun 21, 2025
e4b7f32
인증 범위 설정
qowl880 Jun 21, 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 @@ -46,6 +46,13 @@ public ApiResponse<Long> updateArticle(@RequestBody ArticleUpdateRequestDto requ
return ApiResponse.ok(updatedArticleId, "게시글 수정 성공");
}

@Operation(summary = "게시글 모집 취소", description = "게시글 모집 취소")
@PatchMapping("/{articleId}/statusClose")
public ApiResponse<Long> updateArticleClose(@PathVariable Long articleId, @MemberId Long writerId) {
Long updatedArticleId = updateArticleUserCase.updateOpenStatusClose(articleId, writerId);
return ApiResponse.ok(updatedArticleId, "게시글 모집 취소");
}


@Operation(summary = "펜팔 참여", description = "펜팔 참여")
@PostMapping("/{articleId}/fanFal")
Expand All @@ -61,4 +68,5 @@ public ApiResponse<Long> cancelFanFal(@PathVariable Long articleId, @MemberId Lo
return ApiResponse.ok(fanFalId, "펜팔 취소 성공");
}


}
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package com.idol.board.controller.mypage.command;

import com.idol.board.dto.request.myPage.MyPageUpdateRequestDto;
import com.idol.board.usecase.mypage.UpdateMyPageUseCase;
import com.idol.board.usecase.mypage.command.DeleteMyPageUseCase;
import com.idol.board.usecase.mypage.command.UpdateMyPageUseCase;
import com.idol.board.dto.response.mypage.UserDataResponseDto;
import com.idol.domains.auth.util.annotation.MemberId;
import com.idol.domains.member.dto.request.SignupMemberRequestDto;
import com.idol.domains.member.dto.response.SignupMemberResponseDto;
import com.idol.global.common.response.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

Expand All @@ -15,14 +21,21 @@
public class MyPageController {

private final UpdateMyPageUseCase updateMyPageUseCase;
private final DeleteMyPageUseCase deleteMyPageUseCase;


@Operation(summary = "프로필 수정", description = "이미지, 닉네임, 자기소개 수정")
@PatchMapping()
public ApiResponse<Long> updateProfile(@RequestBody MyPageUpdateRequestDto dto, @MemberId Long userId){

Long memberId = updateMyPageUseCase.updateProfile(dto,userId);
return ApiResponse.ok(memberId,"개인 정보 수정 완료");
}

@Operation(summary = "내가 참여한 펜팔 삭제", description = "내가 참여하나 펜팔 삭제")
@DeleteMapping("/{articleId}")
public ApiResponse<Long> deleteMyFanFal(@PathVariable Long articleId, @MemberId Long userId){
Long memberId = deleteMyPageUseCase.deleteMyFanFal(articleId, userId);
return ApiResponse.ok(memberId,"내가 참여한 펜팔 삭제");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
import com.idol.board.domain.BigCategory;
import com.idol.board.domain.SmallCategory;
import com.idol.board.dto.response.article.ArticleListResponseDto;
import com.idol.board.dto.response.comment.CommentResponseDto;
import com.idol.board.dto.response.mypage.MyPageQuestionResponseDto;
import com.idol.board.dto.response.mypage.UserDataResponseDto;
import com.idol.board.service.article.query.ReadArticleService;
import com.idol.board.usecase.article.query.ReadArticleUseCase;
import com.idol.board.usecase.mypage.query.ReadMyPageUseCase;
import com.idol.domains.auth.util.annotation.MemberId;
import com.idol.global.common.response.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.sql.Timestamp;
import java.util.List;
Expand All @@ -23,22 +24,57 @@
@RequiredArgsConstructor
@Tag(name = "마이페이지 Read API", description = "마이페이지 Read API")
public class GetMyPageController {
private final ReadArticleUseCase readArticleUseCase;
private final ReadMyPageUseCase readMypageUseCase;


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

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

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


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

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

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


// @Operation(summary = "나의 질문 출력", description = "나의 질문 출력")
// @GetMapping("/self")
// public ApiResponse<MyPageQuestionResponseDto> readAllQuestionMyPage(
// @RequestParam(value = "lastParentCommentId", required = false) Long lastParentCommentId,
// @RequestParam(value = "lastCommentId", required = false) Long lastCommentId,
// @RequestParam(value = "pageSize") Long limit,
// @MemberId Long userId
// ){
// MyPageQuestionResponseDto dto = readMypageUseCase.readMyQuestion(userId, lastParentCommentId,lastCommentId,limit);
//
// return ApiResponse.ok(dto, "나의 질문 조회 성공");
// }


@Operation(summary = "유저 정보 전달", description = "유저 정보 전달을 진행합니다.")
@GetMapping("/user")
public ApiResponse<UserDataResponseDto> readUserInformation(
@MemberId Long userId
) {
UserDataResponseDto response = readMypageUseCase.readUserInformation(userId);
return ApiResponse.ok(response, "유저 정보 전달 성공");
}
}
3 changes: 3 additions & 0 deletions src/main/java/com/idol/board/domain/entity/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class Comment extends BaseEntity {
@Column(name = "secret", nullable = false)
private boolean secret;

// @Column(name = "parent_check")
// private boolean parentCheck;

@Builder
public Comment(Long commentId, Long articleId, Long writerId, String content, Long parentCommentId, boolean secret) {
this.commentId = commentId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.idol.board.dto.response.comment;

import com.idol.board.domain.entity.Article;
import com.idol.board.repository.mapper.CommentReadQueryResult;
import com.idol.board.repository.mapper.CommentReadQuestionQueryResult;

import java.sql.Timestamp;

public record CommentQuestionResponseDto(
Long commentId,
String content,
Long parentCommentId,
Long writerId,
boolean deleted,
Long createdAt,
boolean secret,
String nickName,
String writerImageUrl,
Long articleId,
String title,
String locationAddress
) {

public static Long changeToUnixTime(Timestamp ts) {
// 2. 밀리초 단위 UNIX timestamp 얻기
long unixMillis = ts.getTime(); // 1750288750000

// 3. 초 단위 UNIX timestamp 얻기
long unixSeconds = unixMillis / 1000; // 1750288750

return unixSeconds;
}

public static CommentQuestionResponseDto from(CommentReadQuestionQueryResult result, String nickName, String writerImageUrl, Article article) {
return new CommentQuestionResponseDto(
result.commentId(),
result.content(),
result.parentCommentId(),
result.writerId(),
result.isDeleted(),
changeToUnixTime(Timestamp.valueOf(result.createdAt())),
result.secret(),
nickName,
writerImageUrl,
article.getArticleId(),
article.getTitle(),
article.getLocationAddress());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.idol.board.dto.response.mypage;

import com.idol.board.dto.response.comment.CommentQuestionResponseDto;
import com.idol.board.dto.response.comment.CommentResponseDto;

import java.util.List;

public record MyPageQuestionResponseDto(
List<CommentQuestionResponseDto> answerWait,
List<CommentResponseDto> answerComplete
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.idol.board.dto.response.mypage;

import com.idol.domains.member.domain.Member;

public record UserDataResponseDto(
String nickName,
String profileImg,
int wishLikeCount,
String description
) {

public static UserDataResponseDto from(Member member, String profileImg, int wishLikeCount) {
return new UserDataResponseDto(
member.getNickname(),
profileImg,
wishLikeCount,
member.getInformation()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ List<ArticleListReadQueryResult> findArticleList(
Timestamp date, String sort, boolean sortAsc, Long limit, Long offset);

List<ArticleListReadQueryResult> findMyPageArticle(Long userId, Long limit, Long offset);

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

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.idol.board.repository.article;

import com.idol.board.domain.BigCategory;
import com.idol.board.domain.OpenStatus;
import com.idol.board.domain.SmallCategory;
import com.idol.board.domain.UseStatus;
import com.idol.board.domain.entity.Article;
import com.idol.board.domain.entity.QArticle;
import com.idol.board.dto.response.article.ArticleListResponseDto;
Expand All @@ -17,6 +19,7 @@
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -95,6 +98,32 @@ public List<ArticleListReadQueryResult> findMyPageArticle(Long userId, Long limi
.fetch();
}

@Override
public List<ArticleListReadQueryResult> findJoinMyPageArticle(List<Long> articleIds, Long limit, Long offset) {
return queryFactory
.select(Projections.constructor(ArticleListReadQueryResult.class,
article.articleId,
article.title,
article.locationId,
article.articleImageKey,
article.date,
article.deadline,
article.createdAt,
article.currentPerson,
article.maxPerson,
article.openStatus,
article.useStatus))

.from(article)
.where(
article.isDeleted.eq(false),
article.articleId.in(articleIds)
)
.limit(limit)
.offset(offset)
.fetch();
}

private BooleanExpression eqWriterId(Long userId) {
return userId != null ? article.writerId.eq(userId) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.idol.board.domain.entity.Comment;
import com.idol.board.repository.mapper.CommentReadQueryResult;
import com.idol.board.repository.mapper.CommentReadQuestionQueryResult;

import java.util.List;
import java.util.Optional;

Expand All @@ -16,4 +18,8 @@ public interface CommentRepositoryCustom {
List<CommentReadQueryResult> findAllInfiniteScroll(Long articleId, Long lastParentCommentId, Long lastCommentId, Long limit);

Optional<Comment> findByParentCommentId(Long parentCommentId);


// List<CommentReadQuestionQueryResult> findQuestionAllInfiniteScroll(Long userId, Long limit);
// List<CommentReadQueryResult> findQuestionAllInfiniteScroll(Long userId, Long lastParentCommentId, Long lastCommentId, Long limit);
}
Loading