-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor - request dto에서 validation을 진행할 수 있도록 변경 #165
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6fcdd21
fix - #155 챌린지 최소 시간 수정
kseysh 94d9c4d
refactor - #164 챌린지 기간 및 목표시간 validate request dto에서 진행하도록 변경
kseysh fbe6f92
refactor - #164 challenge 기간을 List로 관리하여 contain 메서드를 통해 validation을 …
kseysh ee2e7f7
refactor - #164 appcode validation을 DTO생성시에 진행하도록 변경
kseysh fa5529d
refactor - #164 app 목표 시간 validation을 DTO 생성 로직에서 진행하도록 변경
kseysh 4110639
refactor - #164 request dto 제약조건 추가
kseysh 2602926
refactor - #164 사용하지 않는 Error constants 제거
kseysh 017e953
refactor - #164 사용하지 않는 Error constants 제거
kseysh 3f66596
refactor - #164 app time validation에서 어노테이션에서 상수만을 사용해야하여 생성자에서 valid…
kseysh 35d0fda
refactor - #164 addChallenge의 매개변수 수정
kseysh 715ee75
Merge branch 'refactor/#164-validation-use-annotation' of https://git…
kseysh d1c6094
merge - #164 깃에서 꼬인 AppError 다시 복구
kseysh bfc6325
refactor - #166 사용되지 않는 상수 값 삭제
kseysh 9742bda
refactor - #166 요구사항에 맞도록 App 최대 시간을 2시간으로 변경
kseysh 113f53c
refactor - #166 GOAL TIME ERROR 문구 변경
kseysh 1a4a98d
refactor - #166 잘못 정의된 challenge constants 변경
kseysh 1f3062a
refactor - #166 AuthController valid 어노테이션 적용
kseysh 38cc570
refactor - #166 ChallengeController valid 어노테이션 적용
kseysh b433262
refactor - #166 DailyChallengeController valid 어노테이션 적용
kseysh 2ed097e
refactor - #166 PointController @Valid 적용
kseysh fd415d3
merge - #166 충돌 병합 해
kseysh 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 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
3 changes: 3 additions & 0 deletions
3
src/main/java/sopt/org/hmh/domain/app/dto/request/AppRemoveRequest.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,6 +1,9 @@ | ||
package sopt.org.hmh.domain.app.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record AppRemoveRequest( | ||
@NotNull(message = "앱 코드는 null일 수 없습니다.") | ||
String appCode | ||
) { | ||
} |
3 changes: 2 additions & 1 deletion
3
src/main/java/sopt/org/hmh/domain/app/dto/request/ChallengeAppArrayRequest.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,8 +1,9 @@ | ||
package sopt.org.hmh.domain.app.dto.request; | ||
|
||
import jakarta.validation.Valid; | ||
import java.util.List; | ||
|
||
public record ChallengeAppArrayRequest( | ||
List<ChallengeAppRequest> apps | ||
List<@Valid ChallengeAppRequest> apps | ||
) { | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/sopt/org/hmh/domain/app/dto/request/ChallengeAppRequest.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,7 +1,19 @@ | ||
package sopt.org.hmh.domain.app.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import sopt.org.hmh.domain.app.domain.AppConstants; | ||
import sopt.org.hmh.domain.app.domain.exception.AppError; | ||
import sopt.org.hmh.domain.app.domain.exception.AppException; | ||
|
||
public record ChallengeAppRequest( | ||
@NotNull(message = "앱 코드는 null일 수 없습니다.") | ||
String appCode, | ||
@NotNull(message = "앱 시간은 null일 수 없습니다.") | ||
Long goalTime | ||
) { | ||
public ChallengeAppRequest { | ||
if (goalTime > AppConstants.MAXIMUM_APP_TIME || goalTime < AppConstants.MINIMUM_APP_TIME) { | ||
throw new AppException(AppError.INVALID_GOAL_TIME); | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/sopt/org/hmh/domain/app/dto/request/HistoryAppRequest.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,7 +1,11 @@ | ||
package sopt.org.hmh.domain.app.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record HistoryAppRequest( | ||
@NotNull(message = "앱 코드는 null일 수 없습니다.") | ||
String appCode, | ||
@NotNull(message = "앱 사용시간은 null일 수 없습니다.") | ||
Long usageTime | ||
) { | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/main/java/sopt/org/hmh/domain/auth/dto/request/SocialSignUpRequest.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,15 +1,23 @@ | ||
package sopt.org.hmh.domain.auth.dto.request; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import sopt.org.hmh.domain.challenge.dto.request.ChallengeRequest; | ||
import sopt.org.hmh.domain.challenge.dto.request.ChallengeSignUpRequest; | ||
import sopt.org.hmh.global.auth.social.SocialPlatform; | ||
|
||
public record SocialSignUpRequest( | ||
@NotNull(message = "소셜 플랫폼은 null일 수 없습니다.") | ||
SocialPlatform socialPlatform, | ||
String name, | ||
@JsonProperty(value = "onboarding") | ||
OnboardingRequest onboardingRequest, | ||
@Valid | ||
@JsonProperty(value = "challenge") | ||
ChallengeSignUpRequest challengeSignUpRequest | ||
) { | ||
public ChallengeRequest toChallengeRequest() { | ||
return new ChallengeRequest(challengeSignUpRequest.period(), challengeSignUpRequest.goalTime()); | ||
} | ||
} |
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
18 changes: 0 additions & 18 deletions
18
src/main/java/sopt/org/hmh/domain/challenge/domain/ChallengeDay.java
This file was deleted.
Oops, something went wrong.
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
10 changes: 10 additions & 0 deletions
10
src/main/java/sopt/org/hmh/domain/challenge/dto/request/ChallengeDateRequest.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 sopt.org.hmh.domain.challenge.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import java.time.LocalDate; | ||
|
||
public record ChallengeDateRequest( | ||
@NotNull(message = "챌린지 날짜는 null일 수 없습니다.") | ||
LocalDate challengeDate | ||
) { | ||
} |
21 changes: 20 additions & 1 deletion
21
src/main/java/sopt/org/hmh/domain/challenge/dto/request/ChallengeRequest.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,7 +1,26 @@ | ||
package sopt.org.hmh.domain.challenge.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import sopt.org.hmh.domain.app.domain.AppConstants; | ||
import sopt.org.hmh.domain.app.domain.exception.AppError; | ||
import sopt.org.hmh.domain.app.domain.exception.AppException; | ||
import sopt.org.hmh.domain.challenge.domain.ChallengeConstants; | ||
import sopt.org.hmh.domain.challenge.domain.exception.ChallengeError; | ||
import sopt.org.hmh.domain.challenge.domain.exception.ChallengeException; | ||
|
||
public record ChallengeRequest( | ||
@NotNull(message = "챌린지 기간은 null일 수 없습니다.") | ||
Integer period, | ||
@NotNull(message = "챌린지 목표시간은 null일 수 없습니다.") | ||
Long goalTime | ||
) { | ||
} | ||
|
||
public ChallengeRequest { | ||
if (!ChallengeConstants.AVAILABLE_CHALLENGE_PERIODS.contains(period)) { | ||
throw new ChallengeException(ChallengeError.INVALID_PERIOD_NUMERIC); | ||
} | ||
if (goalTime > ChallengeConstants.MAXIMUM_GOAL_TIME || goalTime < ChallengeConstants.MINIMUM_GOAL_TIME) { | ||
throw new ChallengeException(ChallengeError.INVALID_GOAL_TIME); | ||
} | ||
} | ||
} |
14 changes: 13 additions & 1 deletion
14
src/main/java/sopt/org/hmh/domain/challenge/dto/request/ChallengeSignUpRequest.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,12 +1,24 @@ | ||
package sopt.org.hmh.domain.challenge.dto.request; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import sopt.org.hmh.domain.app.dto.request.ChallengeAppRequest; | ||
|
||
import java.util.List; | ||
import sopt.org.hmh.domain.challenge.domain.ChallengeConstants; | ||
import sopt.org.hmh.domain.challenge.domain.exception.ChallengeError; | ||
import sopt.org.hmh.domain.challenge.domain.exception.ChallengeException; | ||
|
||
public record ChallengeSignUpRequest( | ||
@NotNull(message = "챌린지 기간은 null일 수 없습니다.") | ||
Integer period, | ||
@NotNull(message = "챌린지 목표시간은 null일 수 없습니다.") | ||
Long goalTime, | ||
List<ChallengeAppRequest> apps | ||
List<@Valid ChallengeAppRequest> apps | ||
) { | ||
public ChallengeSignUpRequest { | ||
if (goalTime > ChallengeConstants.MAXIMUM_GOAL_TIME || goalTime < ChallengeConstants.MINIMUM_GOAL_TIME) { | ||
throw new ChallengeException(ChallengeError.INVALID_GOAL_TIME); | ||
} | ||
} | ||
} |
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.
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.
👍