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 #21] : 답변 등록/조회 API #22

Merged
merged 29 commits into from
Aug 7, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e19997d
[feat] : Answer 엔티티 질문자여부 필드 추가, questionPost 연관관계 매핑 아이디로 대체
hyun2371 Aug 6, 2024
3960fdc
[feat] : 상세답변 응답 DTO 추가
hyun2371 Aug 6, 2024
5db6245
[feat] : 답변등록 요청 DTO 추가
hyun2371 Aug 6, 2024
9f29aa8
[feat] : 답변 DTO<-> 엔티티 Mapper 추가
hyun2371 Aug 6, 2024
50db282
[feat] : answer repository 추가
hyun2371 Aug 6, 2024
fc9f7fe
[feat] : 답변 등록 비즈니스 로직 작성
hyun2371 Aug 6, 2024
b402979
[feat] : 답변 등록 controller 함수 추가
hyun2371 Aug 6, 2024
897508d
[refactor] : static import 제거
hyun2371 Aug 6, 2024
e4fb45e
[feat] : answer fixture 추가
hyun2371 Aug 6, 2024
aded720
[refactor] : 불필요한 모킹 제거
hyun2371 Aug 6, 2024
5a33762
[test] : 단위 테스트용 member fixture 생성
hyun2371 Aug 6, 2024
b216952
[test] : 답변 등록 단위 테스트 작성
hyun2371 Aug 6, 2024
53f50e1
[feat] : 답변 등록 검증 로직 추가
hyun2371 Aug 6, 2024
c40a8a0
[refactor] : 불필요한 출력문 제거
hyun2371 Aug 6, 2024
0785f41
[style] : fixture 파라미터 명시적으로 수정
hyun2371 Aug 6, 2024
0521376
[test] : memberFixture 새로운 유저 객체 추가
hyun2371 Aug 6, 2024
036717f
[test] : 답변 등록 통합 테스트 작성
hyun2371 Aug 6, 2024
3b44b3b
[feat] 페이징 응답 dto 및 변환 함수 추가
hyun2371 Aug 6, 2024
9e2ac38
[feat] : 질문글 아이디로 답변 조회 함수 추가
hyun2371 Aug 6, 2024
eca6a17
[test] : answer fixture 파라미터 추가
hyun2371 Aug 6, 2024
15ad368
[feat] : 질문글의 답변 모두 조회 비즈니스 로직 작성
hyun2371 Aug 6, 2024
635c5f6
[test] : 질문글의 답변 모두 조회 로직 테스트
hyun2371 Aug 6, 2024
0a3f34e
[feat] : 질문글 아이디로 답변 조회 API 작성
hyun2371 Aug 6, 2024
2a1f925
[test] : AnswerFixture 객체 추가
hyun2371 Aug 6, 2024
89ea108
[feat] : 답변 등록 request validation 추가
hyun2371 Aug 6, 2024
15fe1e9
[test] : 질문글의 답변 모두 조회 api 테스트
hyun2371 Aug 7, 2024
6e1a083
[style] : 코드 리포멧팅
hyun2371 Aug 7, 2024
39f6c4d
[feat] : 질문글 등록 리워드 검증 로직 추가
hyun2371 Aug 7, 2024
6ed1a9b
[test] : 질문글 등록 리워드 검증 로직 테스트
hyun2371 Aug 7, 2024
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
Prev Previous commit
Next Next commit
[feat] 페이징 응답 dto 및 변환 함수 추가
hyun2371 committed Aug 6, 2024
commit 3b44b3bf5be1d55c56ec02e9cc8b0c26aa044cf4
19 changes: 19 additions & 0 deletions src/main/java/com/dnd/gongmuin/common/dto/PageMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.dnd.gongmuin.common.dto;

import static lombok.AccessLevel.*;

import org.springframework.data.domain.Slice;

import lombok.NoArgsConstructor;

@NoArgsConstructor(access = PRIVATE)
public class PageMapper {

public static <T> PageResponse<T> toPageResponse(Slice<T> page) {
return new PageResponse<>(
page.getContent(),
page.getNumberOfElements(),
page.hasNext()
);
}
}
10 changes: 10 additions & 0 deletions src/main/java/com/dnd/gongmuin/common/dto/PageResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.dnd.gongmuin.common.dto;

import java.util.List;

public record PageResponse<T> (
List<T> content,
long size,
boolean hasNext
){
}