-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Code Review] 환이 code review #17
Open
KyunghwanChoi
wants to merge
8
commits into
main
Choose a base branch
from
hwany_week9
base: main
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 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
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
Binary file not shown.
This file contains 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 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
|
||
rootProject.name = 'workbook-zero' |
This file contains 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
11 changes: 11 additions & 0 deletions
11
UMC-0-WORKBOOK/src/main/java/umc/study/apiPayload/exception/handler/FoodCategoryHandler.java
This file contains 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,11 @@ | ||
package umc.study.apiPayload.exception.handler; | ||
|
||
import umc.study.apiPayload.code.status.BaseErrorCode; | ||
import umc.study.apiPayload.exception.GeneralException; | ||
|
||
public class FoodCategoryHandler extends GeneralException { | ||
|
||
public FoodCategoryHandler(BaseErrorCode errorCode){ | ||
super(errorCode); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
UMC-0-WORKBOOK/src/main/java/umc/study/apiPayload/exception/handler/MissionHandler.java
This file contains 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,10 @@ | ||
package umc.study.apiPayload.exception.handler; | ||
|
||
import umc.study.apiPayload.code.status.BaseErrorCode; | ||
import umc.study.apiPayload.exception.GeneralException; | ||
|
||
public class MissionHandler extends GeneralException { | ||
public MissionHandler(BaseErrorCode errorCode){ | ||
super(errorCode); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
UMC-0-WORKBOOK/src/main/java/umc/study/apiPayload/exception/handler/RegionHandler.java
This file contains 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,11 @@ | ||
package umc.study.apiPayload.exception.handler; | ||
|
||
import umc.study.apiPayload.code.status.BaseErrorCode; | ||
import umc.study.apiPayload.exception.GeneralException; | ||
|
||
public class RegionHandler extends GeneralException { | ||
|
||
public RegionHandler(BaseErrorCode errorCode){ | ||
super(errorCode); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
UMC-0-WORKBOOK/src/main/java/umc/study/apiPayload/exception/handler/StoreHandler.java
This file contains 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,10 @@ | ||
package umc.study.apiPayload.exception.handler; | ||
|
||
import umc.study.apiPayload.code.status.BaseErrorCode; | ||
import umc.study.apiPayload.exception.GeneralException; | ||
|
||
public class StoreHandler extends GeneralException { | ||
public StoreHandler (BaseErrorCode errorCode){ | ||
super(errorCode); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
UMC-0-WORKBOOK/src/main/java/umc/study/config/SwaggerConfig.java
This file contains 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 |
---|---|---|
@@ -1,4 +1,39 @@ | ||
package umc.study.config; | ||
|
||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
import io.swagger.v3.oas.models.security.SecurityScheme; | ||
import io.swagger.v3.oas.models.servers.Server; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
@Bean | ||
public OpenAPI UMCstudyAPI() { | ||
Info info = new Info() | ||
.title("UMC Server WorkBook API") | ||
.description("UMC Server WorkBook API 명세서") | ||
.version("1.0.0"); | ||
|
||
String jwtSchemeName = "JWT TOKEN"; | ||
// API 요청헤더에 인증정보 포함 | ||
SecurityRequirement securityRequirement = new SecurityRequirement().addList(jwtSchemeName); | ||
// SecuritySchemes 등록 | ||
Components components = new Components() | ||
.addSecuritySchemes(jwtSchemeName, new SecurityScheme() | ||
.name(jwtSchemeName) | ||
.type(SecurityScheme.Type.HTTP) // HTTP 방식 | ||
.scheme("bearer") | ||
.bearerFormat("JWT")); | ||
|
||
return new OpenAPI() | ||
.addServersItem(new Server().url("/")) | ||
.info(info) | ||
.addSecurityItem(securityRequirement) | ||
.components(components); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
UMC-0-WORKBOOK/src/main/java/umc/study/converter/MemberConverter.java
This file contains 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 umc.study.converter; | ||
|
||
import umc.study.domain.Member; | ||
import umc.study.domain.enums.Gender; | ||
import umc.study.web.dto.MemberDTO.MemberRequestDTO; | ||
import umc.study.web.dto.MemberDTO.MemberResponseDTO; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public class MemberConverter { | ||
|
||
public static MemberResponseDTO.JoinResultDTO toJoinResultDTO(Member member){ | ||
return MemberResponseDTO.JoinResultDTO.builder() | ||
.memberId(member.getId()) | ||
.createdAt(LocalDateTime.now()) | ||
.build(); | ||
} | ||
|
||
public static Member toMember(MemberRequestDTO.JoinDto request){ | ||
|
||
Gender gender = null; | ||
|
||
switch(request.getGender()){ | ||
case 1: | ||
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. switch 문을 이렇게 사용하는 것은 가독성 좋지 않은 것 같아요. switch 문을 가독성 좋게 사용하려면 어떻게 할 수 있을까요? |
||
gender = Gender.MALE;; | ||
break; | ||
case 2: | ||
gender = Gender.FEMALE; | ||
break; | ||
} | ||
|
||
return Member.builder() | ||
.address(request.getAddress()) | ||
.gender(gender) | ||
.name(request.getName()) | ||
.age(request.getAge()) | ||
.build(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
UMC-0-WORKBOOK/src/main/java/umc/study/converter/MemberFoodConverter.java
This file contains 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,20 @@ | ||
package umc.study.converter; | ||
|
||
import umc.study.domain.FoodCategory; | ||
import umc.study.domain.mapping.MemberFood; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class MemberFoodConverter { | ||
|
||
public static List<MemberFood> toMemberFoodList(List<FoodCategory> foodCategoryList){ | ||
|
||
return foodCategoryList.stream() | ||
.map(foodCategory -> | ||
MemberFood.builder() | ||
.foodCategory(foodCategory) | ||
.build() | ||
).collect(Collectors.toList()); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
UMC-0-WORKBOOK/src/main/java/umc/study/converter/MemberMissionConverter.java
This file contains 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,20 @@ | ||
package umc.study.converter; | ||
|
||
import umc.study.domain.Mission; | ||
import umc.study.domain.mapping.MemberMission; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class MemberMissionConverter { | ||
|
||
public static List<MemberMission> toMemberMissionList(List<Mission> missionList){ | ||
|
||
return missionList.stream() | ||
.map(mission -> | ||
MemberMission.builder() | ||
.mission(mission) | ||
.build() | ||
).collect(Collectors.toList()); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
UMC-0-WORKBOOK/src/main/java/umc/study/converter/MissionConverter.java
This file contains 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 umc.study.converter; | ||
|
||
import umc.study.domain.Mission; | ||
import umc.study.domain.enums.MissionStatus; | ||
import umc.study.web.dto.MissionDTO.MissionRequestDTO; | ||
import umc.study.web.dto.MissionDTO.MissionResponseDTO; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public class MissionConverter { | ||
|
||
public static MissionResponseDTO.JoinResultDTO toJoinResultDTO(Mission mission){ | ||
return MissionResponseDTO.JoinResultDTO.builder() | ||
.missionId((mission.getId())) | ||
.createdAt(LocalDateTime.now()) | ||
.build(); | ||
} | ||
|
||
public static Mission toMission(MissionRequestDTO.JoinDto request){ | ||
|
||
MissionStatus missionStatus = null; | ||
|
||
switch(request.getMissionStatus()){ | ||
case CHALLENGING: | ||
missionStatus = MissionStatus.CHALLENGING; | ||
break; | ||
case COMPLETED: | ||
missionStatus = MissionStatus.COMPLETED; | ||
break; | ||
} | ||
|
||
return Mission.builder() | ||
.reward(request.getReward()) | ||
.content(request.getContent()) | ||
.missionStatus(missionStatus) | ||
.deadline(request.getDeadline()) | ||
.build(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
UMC-0-WORKBOOK/src/main/java/umc/study/converter/ReviewConverter.java
This file contains 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,26 @@ | ||
package umc.study.converter; | ||
|
||
import umc.study.domain.Review; | ||
import umc.study.web.dto.ReviewDTO.ReviewRequestDTO; | ||
import umc.study.web.dto.ReviewDTO.ReviewResponseDTO; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public class ReviewConverter { | ||
|
||
public static ReviewResponseDTO.JoinResultDTO toJoinResultDTO(Review review){ | ||
return ReviewResponseDTO.JoinResultDTO.builder() | ||
.reviewId(review.getId()) | ||
.createdAt(LocalDateTime.now()) | ||
.build(); | ||
} | ||
|
||
public static Review toReview(ReviewRequestDTO.JoinDto request){ | ||
|
||
return Review.builder() | ||
.content(request.getContent()) | ||
.rating(request.getRating()) | ||
.build(); | ||
|
||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
UMC-0-WORKBOOK/src/main/java/umc/study/converter/StoreConverter.java
This file contains 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,25 @@ | ||
package umc.study.converter; | ||
|
||
import umc.study.domain.Store; | ||
import umc.study.web.dto.StoreDTO.StoreRequestDTO; | ||
import umc.study.web.dto.StoreDTO.StoreResponseDTO; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public class StoreConverter { | ||
public static StoreResponseDTO.JoinResultDTO toJoinResultDTO(Store store){ | ||
return StoreResponseDTO.JoinResultDTO.builder() | ||
.storeId(store.getId()) | ||
.createdAt(LocalDateTime.now()) | ||
.build(); | ||
} | ||
|
||
public static Store toStore(StoreRequestDTO.JoinDto request){ | ||
|
||
|
||
return Store.builder() | ||
.address(request.getAddress()) | ||
.name(request.getName()) | ||
.build(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
UMC-0-WORKBOOK/src/main/java/umc/study/converter/TempConverter.java
This file contains 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 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 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 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
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.
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.
하이버네이트를 명시적으로 설정한 이유가 있을까요?