Skip to content

Commit

Permalink
#1 [refactor] validation.properties refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SeorinY committed Oct 13, 2023
1 parent 057b254 commit dadf8b8
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
public class LoginRequest {

@Schema(description = "로그인 아이디")
@NotNull(message = "{auth.loginId.notNull}")
@NotNull(message = "{notNull.auth.loginId}")
private String loginId;

@Schema(description = "비밀번호")
@NotNull(message = "{auth.password.notNull}")
@NotNull(message = "{notNull.auth.password}")
private String password;

public LoginCommand toLoginInfo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
public class SignUpRequest {

@Schema(description = "로그인 아이디")
@NotNull(message = "{auth.loginId.notNull}")
@NotNull(message = "{notNull.auth.loginId}")
private String loginId;

@Schema(description = "비밀번호")
@NotNull(message = "{auth.password.notNull}")
@NotNull(message = "{notNull.auth.password}")
private String password;

public SignUpCommand toSignUpCommand() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
public class QuitMatchRequest {

@Schema(description = "게임 아이디", example = "1")
@NotNull(message = "{match.matchId.notnull}")
@NotNull(message = "{notNull.match.matchId}")
private Long matchId;

@Schema(description = "게임 종료 시간", example = "01:30:00")
@NotNull(message = "{match.playTime.notnull}")
@NotNull(message = "{notNull.match.playTime}")
private LocalTime playTime;

@Schema(description = "유저 게임 결과")
@Size(min = 1, max = 4, message = "{match.userMatchResults.size.range}")
@Size(min = 1, max = 4, message = "{range.size.match.userMatchResults}")
@Valid
private List<UserMatchResultDto> userMatchResults;

Expand All @@ -49,48 +49,48 @@ public QuitMatchCommand toQuitMatchCommand(Long playerId) {
public static class UserMatchResultDto {

@Schema(description = "유저 아이디", example = "1")
@NotNull(message = "{user.userId.notNull}")
@NotNull(message = "{notNull.user.userId}")
private Long userId;

@Schema(description = "점수", example = "100")
@NotNull(message = "{userMatch.score.notnull}")
@NotNull(message = "{notNull.userMatch.score}")
private Integer score;

@Schema(description = "쿠션 점수", example = "30")
@NotNull(message = "{userMatch.cushionScore.notnull}")
@NotNull(message = "{notNull.userMatch.cushionScore}")
private Integer cushionScore;

@Schema(description = "뱅크샷 점수", example = "30")
@NotNull(message = "{userMatch.bankShotScore.notnull}")
@NotNull(message = "{notNull.userMatch.bankShotScore}")
private Integer bankShotScore;

@Schema(description = "랭킹", example = "1")
@NotNull(message = "{userMatch.rank.notnull}")
@Range(min = 1, max = 4, message = "{userMatch.rank.range}")
@NotNull(message = "{notNull.userMatch.rank}")
@Range(min = 1, max = 4, message = "{range.userMatch.rank}")
private Integer rank;

@Schema(description = "최대 장타 점수", example = "50")
@NotNull(message = "{userMatch.maxHighRun.notnull}")
@NotNull(message = "{notNull.userMatch.maxHighRun}")
private Integer maxHighRun;

@Schema(description = "에버리지", example = "100")
@NotNull(message = "{userMatch.average.notnull}")
@NotNull(message = "{notNull.userMatch.average}")
private Integer average;

@Schema(description = "이닝 수", example = "10")
@NotNull(message = "{userMatch.inningCount.notnull}")
@NotNull(message = "{notNull.userMatch.inningCount}")
private Integer inningCount;

@Schema(description = "성공 이닝 수", example = "7")
@NotNull(message = "{userMatch.succeedInningCount.notnull}")
@NotNull(message = "{notNull.userMatch.succeedInningCount}")
private Integer succeedInningCount;

@Schema(description = "실패 이닝 수", example = "3")
@NotNull(message = "{userMatch.failedInningCount.notnull}")
@NotNull(message = "{notNull.userMatch.failedInningCount}")
private Integer failedInningCount;

@Schema(description = "장타 횟수", example = "5")
@NotNull(message = "{userMatch.sluggingCount.notnull}")
@NotNull(message = "{notNull.userMatch.sluggingCount}")
private Integer sluggingCount;

public QuitMatchCommand.UserMatchResultCommand toUserMatchResultCommand() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@
public class RecordMatchProcessRequest {

@Schema(description = "매치 아이디")
@NotNull(message = "{match.matchId.notnull}")
@NotNull(message = "{notNull.match.matchId}")
private Long matchId;

@Schema(description = "턴 차례인 유저 아이디")
@NotNull(message = "{matchProcess.playerId.notnull}")
@NotNull(message = "{notNull.matchProcess.playerId}")
private Long playerId;

@Schema(description = "턴에 소요한 시간, 00:00:00 ~ 23:59:59", example = "00:00:00")
@NotNull(message = "{matchProcess.duration.notnull}")
@NotNull(message = "{notNull.matchProcess.duration}")
@DateTimeFormat(pattern = "HH:mm:ss")
private LocalTime duration;

@Schema(description = "친 페이스 횟수")
@NotNull(message = "{matchProcess.phaseCount.notnull}")
@NotNull(message = "{notNull.matchProcess.phaseCount}")
private Integer phaseCount;

@Schema(description = "페이스별 친 횟수")
@NotNull(message = "{matchProcess.turnCount.notnull}")
@NotNull(message = "{notNull.matchProcess.turnCount}")
private Integer turnCount;

@Schema(description = "총 기록힌 횟수")
@NotNull(message = "{matchProcess.processCount.notnull}")
@NotNull(message = "{notNull.matchProcess.processCount}")
private Integer processCount;

@Schema(description = "턴에 대한 유저 정보")
@Size(min = 1, max = 4, message = "{matchProcess.turnUserProcessList.size.range}")
@Size(min = 1, max = 4, message = "{range.size.matchProcess.turnUserProcessList}")
List<TurnUserProcessDto> turnUserProcessList;

public RecordMatchProcessCommand toRecordMatchProcessCommand() {
Expand Down Expand Up @@ -89,11 +89,11 @@ public RecordMatchProcessCommand toRecordMatchProcessCommand() {
public static class TurnUserProcessDto {

@Schema(description = "유저 아이디")
@NotNull(message = "{user.userId.notnull}")
@NotNull(message = "{notNull.user.userId}")
private Long userId;

@Schema(description = "점수")
@NotNull(message = "{userMatch.score.notnull}")
@NotNull(message = "{notNull.userMatch.score}")
private Integer score;

@Schema(description = "쿠션 점수")
Expand All @@ -103,43 +103,43 @@ public static class TurnUserProcessDto {
private Integer finishBankShotScore;

@Schema(description = "순위")
@NotNull(message = "{userMatch.rank.notnull}")
@NotNull(message = "{notNull.userMatch.rank}")
private Integer rank;

@Schema(description = "유저 상태", example = "NORMAL, CUSHION, BANK_SHOT, END")
@NotNull(message = "{userMatch.status.notnull}")
@NotNull(message = "{notNull.userMatch.status}")
private UserMatchStatus status;

@Schema(description = "최고 장타")
@NotNull(message = "{userMatch.maxHighRun.notnull}")
@NotNull(message = "{notNull.userMatch.maxHighRun}")
private Integer maxHighRun;

@Schema(description = "현재 장타")
@NotNull(message = "{userMatch.highRun.notnull}")
@NotNull(message = "{notNull.userMatch.highRun}")
private Integer highRun;

@Schema(description = "점수 편차")
@NotNull(message = "{userMatch.deltaScore.notnull}")
@NotNull(message = "{notNull.userMatch.deltaScore}")
private Integer deltaScore;

@Schema(description = "턴 타입", example = "SUCCESS, FAIL")
@NotNull(message = "{userMatch.turnType.notnull}")
@NotNull(message = "{notNull.userMatch.turnType}")
private TurnType turnType;

@Schema(description = "턴 차례 여부", defaultValue = "false")
@NotNull(message = "{userMatch.isMyTurn.notnull}")
@NotNull(message = "{notNull.userMatch.isMyTurn}")
private Boolean isMyTurn;

@Schema(description = "이닝 횟수")
@NotNull(message = "{userMatch.inningCount.notnull}")
@NotNull(message = "{notNull.userMatch.inningCount}")
private Integer inningCount;

@Schema(description = "성공 이닝 횟수")
@NotNull(message = "{userMatch.succeedInningCount.notnull}")
@NotNull(message = "{notNull.userMatch.succeedInningCount}")
private Integer succeedInningCount;

@Schema(description = "실패 이닝 횟수")
@NotNull(message = "{userMatch.failedInningCount.notnull}")
@NotNull(message = "{notNull.userMatch.failedInningCount}")
private Integer failedInningCount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
public class StartMatchRequest {

@Schema(description = "경기 타입")
@NotNull(message = "{match.matchType.notnull}")
@NotNull(message = "{notNull.match.matchType}")
private MatchType matchType;

@Schema(description = "유저 수, 1~4명")
@NotNull(message = "{match.userCount.notnull}")
@Range(min = 1, max = 4, message = "{match.userCount.range}")
@NotNull(message = "{notNull.match.userCount}")
@Range(min = 1, max = 4, message = "{range.match.userCount}")
private Integer userCount;

@Schema(description = "유저 수 크기만큼")
@Size(min = 1, max = 4, message = "{match.matchTargetScoreList.size.range}")
@Size(min = 1, max = 4, message = "{range.size.match.matchTargetScoreList}")
private List<MatchTargetScoreDto> matchTargetScoreList;


Expand Down Expand Up @@ -58,11 +58,11 @@ public StartMatchCommand toStartMatchCommand() {
public static class MatchTargetScoreDto {

@Schema(description = "게임에 참여하는 유저 아이디")
@NotNull(message = "{user.userId.notNull}")
@NotNull(message = "{notNull.user.userId}")
private Long userId;

@Schema(description = "목표 점수")
@NotNull(message = "{userMatch.targetScore.notNull}")
@NotNull(message = "{notNull.userMatch.targetScore}")
private Integer targetScore;

@Schema(description = "쿠션 목표 점수")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
public class PinNoticeBoardRequest {

@Schema(description = "게시판 아이디", example = "1")
@NotNull(message = "{noticeBoard.noticeBoardId.notnull}")
@NotNull(message = "{notNull.noticeBoard.noticeBoardId}")
private Long noticeBoardId;

@Schema(description = "고정 여부", example = "true")
@NotNull(message = "{noticeBoard.pin.notnull}")
@NotNull(message = "{notNull.noticeBoard.pin}")
private Boolean pin;

public PinNoticeBoardCommand toPinNoticeBoardCommand(Long userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class UpdateUserProfileRequest {
private Gender gender;

@Schema(description = "1~5숙련도")
@Range(min = 1, max = 5, message = "{user.proficiency.range}")
@Range(min = 1, max = 5, message = "{range.user.proficiency}")
private Integer proficiency;

public UpdateUserProfileCommand toUpdateUserProfileCommand(Long userId) {
Expand Down
73 changes: 36 additions & 37 deletions adapter-web/src/main/resources/messages/validation.properties
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
# ==Auth== #
auth.loginId.notNull=loginId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
auth.password.notNull=password\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.auth.loginId=loginId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.auth.password=password\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.

# ==User== #
user.userId.notNull=userId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
user.proficiency.range=proficiency\uB294 1~5 \uC0AC\uC774\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
notNull.user.userId=userId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
range.user.proficiency=proficiency\uB294 1~5 \uC0AC\uC774\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.

# ==Match== #
match.matchId.notnull=matchId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
match.matchType.notnull=matchType\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
match.userCount.notnull=userCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
match.userCount.range=userCount\uB294 1~4 \uC0AC\uC774\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
match.matchTargetScoreList.size.range=matchTargetScoreList\uB294 1~4\uAC1C\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
match.endTime.notnull=endTime\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
match.playTime.notnull=playTime\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
match.userMatchResults.size.range=userMatchResults\uB294 1~4\uAC1C\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
notNull.match.matchId=matchId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.match.matchType=matchType\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.match.userCount=userCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
range.match.userCount=userCount\uB294 1~4 \uC0AC\uC774\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
range.size.match.matchTargetScoreList=matchTargetScoreList\uB294 1~4\uAC1C\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
notNull.match.playTime=playTime\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
range.size.match.userMatchResults=userMatchResults\uB294 1~4\uAC1C\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.

# ==UserMatch== #
userMatch.targetScore.notNull=targetScore\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.score.notnull=score\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.cushionScore.notnull=cushionScore\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.bankShotScore.notnull=bankShotScore\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.rank.notnull=rank\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.rank.range=rank\uB294 1~4 \uC0AC\uC774\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
userMatch.status.notnull=status\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.maxHighRun.notnull=maxHighRun\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.highRun.notnull=highRun\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.average.notnull=average\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.deltaScore.notnull=deltaScore\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.turnType.notnull=turnType\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.isMyTurn.notnull=isMyTurn\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.inningCount.notnull=inningCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.succeedInningCount.notnull=succeedInningCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.failedInningCount.notnull=failedInningCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
userMatch.sluggingCount.notnull=sluggingCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.targetScore=targetScore\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.score=score\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.cushionScore=cushionScore\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.bankShotScore=bankShotScore\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.rank=rank\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
range.userMatch.rank=rank\uB294 1~4 \uC0AC\uC774\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
notNull.userMatch.status=status\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.maxHighRun=maxHighRun\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.highRun=highRun\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.average=average\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.deltaScore=deltaScore\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.turnType=turnType\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.isMyTurn=isMyTurn\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.inningCount=inningCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.succeedInningCount=succeedInningCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.failedInningCount=failedInningCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.userMatch.sluggingCount=sluggingCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.

# ==MatchProcess== #
matchProcess.playerId.notnull=playUserId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
matchProcess.duration.notnull=duration\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
matchProcess.phaseCount.notnull=phaseCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
matchProcess.turnCount.notnull=turnCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
matchProcess.processCount.notnull=processCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
matchProcess.turnUserProcessList.size.range=turnUserProcessList\uB294 1~4\uAC1C\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.
notNull.matchProcess.playerId=playUserId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.matchProcess.duration=duration\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.matchProcess.phaseCount=phaseCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.matchProcess.turnCount=turnCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.matchProcess.processCount=processCount\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
range.size.matchProcess.turnUserProcessList=turnUserProcessList\uB294 1~4\uAC1C\uC758 \uB370\uC774\uD130\uB97C \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4.

# == NoticeBoard == #
noticeBoard.noticeBoardId.notnull=noticeBoardId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
noticeBoard.pin.notnull=pin\uC740 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.noticeBoard.noticeBoardId=noticeBoardId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.
notNull.noticeBoard.pin=pin\uC740 \uD544\uC218\uC785\uB2C8\uB2E4.

0 comments on commit dadf8b8

Please sign in to comment.