-
Notifications
You must be signed in to change notification settings - Fork 0
Builder를 클래스가 아닌 생성자 단위로 변경, 테스트 작성 #40
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
Open
DFDRDODM95
wants to merge
10
commits into
dev
Choose a base branch
from
feature/review
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d6c95fc
Exception 관련 파일 추가
DFDRDODM95 6ac2fbb
exception 코드 반영과 관련 변경 사항
DFDRDODM95 a94d206
사용 실수 가능성이 높은 initDb 클래스 삭제
DFDRDODM95 95c2dab
Merge branch 'dev' into feature/review
DFDRDODM95 1c1197d
objectMapper 수정
DFDRDODM95 c3802d8
swagger-ui 반영 및 Exception 클래스 수정
DFDRDODM95 6ca3917
리뷰 DTO 수정
DFDRDODM95 6e243ec
잘못된 코드 추가로 인한 json 순환 참조 문제 해결
DFDRDODM95 cba1f85
변경 사항들에 따른 테스트 작성
DFDRDODM95 0aff0aa
서비스 테스트 일부 소형 테스트 작성
DFDRDODM95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/com/kidsqueue/kidsqueue/config/objectMapper/ObjectMapperConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package com.kidsqueue.kidsqueue.config.objectMapper; | ||
|
|
||
| import com.fasterxml.jackson.databind.DeserializationFeature; | ||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | ||
| import com.fasterxml.jackson.databind.SerializationFeature; | ||
| import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; | ||
| import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
|
|
||
| @Configuration | ||
| public class ObjectMapperConfig { | ||
|
|
||
| @Bean | ||
| public ObjectMapper objectMapper() { | ||
| ObjectMapper objectMapper = new ObjectMapper(); | ||
|
|
||
| objectMapper.registerModule(new Jdk8Module()) | ||
| .registerModule(new JavaTimeModule()) | ||
| .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) | ||
| .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) | ||
| .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) | ||
| .setPropertyNamingStrategy(new PropertyNamingStrategy.SnakeCaseStrategy()); | ||
|
|
||
| return objectMapper; | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/kidsqueue/kidsqueue/config/swagger/SwaggerConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.kidsqueue.kidsqueue.config.swagger; | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import io.swagger.v3.core.jackson.ModelResolver; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
| @Configuration | ||
| public class SwaggerConfig { | ||
| @Bean | ||
| public ModelResolver modelResolver(ObjectMapper objectMapper) { | ||
| return new ModelResolver(objectMapper); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/kidsqueue/kidsqueue/review/db/Review.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package com.kidsqueue.kidsqueue.review.db; | ||
|
|
||
| import com.kidsqueue.kidsqueue.common.BaseEntity; | ||
| import com.kidsqueue.kidsqueue.hospital.db.Hospital; | ||
| import com.kidsqueue.kidsqueue.parent.db.Parent; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @Entity | ||
| @Table(name = "review") | ||
| public class Review extends BaseEntity { | ||
| private String title; | ||
| private Integer score; | ||
| private String description; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "hospital_id") | ||
| private Hospital hospital; | ||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "parent_id") | ||
| private Parent parent; | ||
|
|
||
| @Builder | ||
| public Review(Long id, Integer isActive, LocalDateTime createdBy, LocalDateTime updatedBy, String title, Integer score, String description, Hospital hospital, Parent parent) { | ||
| super(id, isActive, createdBy, updatedBy); | ||
| this.title = title; | ||
| this.score = score; | ||
| this.description = description; | ||
| this.hospital = hospital; | ||
| this.parent = parent; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
src/main/java/com/kidsqueue/kidsqueue/review/dtos/ReviewCreateDto.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/main/java/com/kidsqueue/kidsqueue/review/dtos/ReviewDto.java
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
src/main/java/com/kidsqueue/kidsqueue/review/dtos/ReviewUpdateDto.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/main/java/com/kidsqueue/kidsqueue/review/exception/ReviewErrorCode.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.kidsqueue.kidsqueue.review.exception; | ||
|
|
||
| import com.kidsqueue.kidsqueue.common.error.ErrorCode; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @AllArgsConstructor | ||
| @Getter | ||
| public enum ReviewErrorCode implements ErrorCode { | ||
| Review_Not_Found(HttpStatus.NOT_FOUND, "No Review"), | ||
| Hospital_Not_Found(HttpStatus.NOT_FOUND, "No Hospital"), | ||
| Parent_Not_Found(HttpStatus.NOT_FOUND, "No Parent"), | ||
| ; | ||
|
Comment on lines
+8
to
+14
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ErrorCode 관련 작업은 이전에 진행한 것으로 변경 가능성이 남아있는 상태입니다. |
||
|
|
||
| private final HttpStatus httpStatusCode; | ||
| private final String description; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data 어노테이션의 위험성을 경계해서 우선 주석으로 남겨 놓았고
실무에서 Lombok 사용법
builder의 이름 중복 문제는 SuperBuilder의 것을 변경하도록 했습니다.
또한 기본 생성자 어노테이션의 접근 범위를 지정하여 보호 수준을 만들었습니다.