Skip to content

Commit

Permalink
Merge pull request #159 from Gamegoo-repo/feat/158
Browse files Browse the repository at this point in the history
[Feat/158] κ²Œμ‹œνŒ κΈ€ μž‘μ„± 및 μˆ˜μ • μ‹œ ν¬μ§€μ…˜ 선택에 전체 ν¬μ§€μ…˜ μΆ”κ°€
  • Loading branch information
hzee97 authored Aug 12, 2024
2 parents 6f8a852 + fa831d2 commit dea7c8f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public enum ErrorStatus implements BaseErrorCode {
BOARD_GAME_STYLE_BAD_REQUEST(HttpStatus.BAD_REQUEST, "BOARD400",
"κ²Œμž„ μŠ€νƒ€μΌ 선택 개수(μ΅œλŒ€ 3개)λ₯Ό μ΄ˆκ³Όν–ˆμŠ΅λ‹ˆλ‹€."),
GAME_MODE_INVALID(HttpStatus.BAD_REQUEST, "BOARD401", "κ²Œμž„λͺ¨λ“œ 값은 1~4만 κ°€λŠ₯ν•©λ‹ˆλ‹€."),
MAIN_POSITION_INVALID(HttpStatus.BAD_REQUEST, "BOARD401", "μ£Όν¬μ§€μ…˜ 값은 1~5만 κ°€λŠ₯ν•©λ‹ˆλ‹€."),
SUB_POSITION_INVALID(HttpStatus.BAD_REQUEST, "BOARD401", "λΆ€ν¬μ§€μ…˜ 값은 1~5만 κ°€λŠ₯ν•©λ‹ˆλ‹€."),
WANT_POSITION_INVALID(HttpStatus.BAD_REQUEST, "BOARD401", "μƒλŒ€ν¬μ§€μ…˜ 값은 1~5만 κ°€λŠ₯ν•©λ‹ˆλ‹€."),
MAIN_POSITION_INVALID(HttpStatus.BAD_REQUEST, "BOARD401", "μ£Όν¬μ§€μ…˜ 값은 0~5만 κ°€λŠ₯ν•©λ‹ˆλ‹€."),
SUB_POSITION_INVALID(HttpStatus.BAD_REQUEST, "BOARD401", "λΆ€ν¬μ§€μ…˜ 값은 0~5만 κ°€λŠ₯ν•©λ‹ˆλ‹€."),
WANT_POSITION_INVALID(HttpStatus.BAD_REQUEST, "BOARD401", "μƒλŒ€ν¬μ§€μ…˜ 값은 0~5만 κ°€λŠ₯ν•©λ‹ˆλ‹€."),

// κ²Œμ‹œνŒ κΈ€ μˆ˜μ •, 쑰회 κ΄€λ ¨ μ—λŸ¬
BOARD_UNAUTHORIZED(HttpStatus.UNAUTHORIZED, "BOARD401", "κΈ€ μž‘μ„±μžλ§Œ μˆ˜μ • κ°€λŠ₯ν•©λ‹ˆλ‹€."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class BoardController {
private final BoardService boardService;

@PostMapping("")
@Operation(summary = "κ²Œμ‹œνŒ κΈ€ μž‘μ„± API", description = "κ²Œμ‹œνŒμ—μ„œ 글을 μž‘μ„±ν•˜λŠ” API μž…λ‹ˆλ‹€.")
@Operation(summary = "κ²Œμ‹œνŒ κΈ€ μž‘μ„± API", description = "κ²Œμ‹œνŒμ—μ„œ 글을 μž‘μ„±ν•˜λŠ” API μž…λ‹ˆλ‹€. κ²Œμž„ λͺ¨λ“œ 1~4, ν¬μ§€μ…˜ 0~5λ₯Ό μž…λ ₯ν•˜μ„Έμš”. κ²Œμž„μŠ€νƒ€μΌμ€ μ΅œλŒ€ 3κ°œκΉŒμ§€ μž…λ ₯κ°€λŠ₯ν•©λ‹ˆλ‹€.")
public ApiResponse<BoardResponse.boardInsertResponseDTO> boardInsert(
@RequestBody BoardRequest.boardInsertDTO request
) {
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/com/gamegoo/service/board/BoardService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ public Board save(BoardRequest.boardInsertDTO request, Long memberId, Member mem
throw new BoardHandler(ErrorStatus.GAME_MODE_INVALID);
}

// μ£Ό ν¬μ§€μ…˜ κ°’ 검증. (1 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getMainPosition() < 1 || request.getMainPosition() > 5) {
// μ£Ό ν¬μ§€μ…˜ κ°’ 검증. (0 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getMainPosition() < 0 || request.getMainPosition() > 5) {
throw new BoardHandler(ErrorStatus.MAIN_POSITION_INVALID);
}

// λΆ€ ν¬μ§€μ…˜ κ°’ 검증. (1 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getSubPosition() < 1 || request.getSubPosition() > 5) {
// λΆ€ ν¬μ§€μ…˜ κ°’ 검증. (0 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getSubPosition() < 0 || request.getSubPosition() > 5) {
throw new BoardHandler(ErrorStatus.SUB_POSITION_INVALID);
}

// μƒλŒ€ ν¬μ§€μ…˜ κ°’ 검증. (1 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getWantPosition() < 1 || request.getWantPosition() > 5) {
// μƒλŒ€ ν¬μ§€μ…˜ κ°’ 검증. (0 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getWantPosition() < 0 || request.getWantPosition() > 5) {
throw new BoardHandler(ErrorStatus.WANT_POSITION_INVALID);
}

Expand Down Expand Up @@ -140,18 +140,18 @@ public Board update(BoardRequest.boardUpdateDTO request, Long memberId, Long boa
throw new BoardHandler(ErrorStatus.GAME_MODE_INVALID);
}

// μ£Ό ν¬μ§€μ…˜ κ°’ 검증. (1 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getMainPosition() < 1 || request.getMainPosition() > 5) {
// μ£Ό ν¬μ§€μ…˜ κ°’ 검증. (0 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getMainPosition() < 0 || request.getMainPosition() > 5) {
throw new BoardHandler(ErrorStatus.MAIN_POSITION_INVALID);
}

// λΆ€ ν¬μ§€μ…˜ κ°’ 검증. (1 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getSubPosition() < 1 || request.getSubPosition() > 5) {
// λΆ€ ν¬μ§€μ…˜ κ°’ 검증. (0 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getSubPosition() < 0 || request.getSubPosition() > 5) {
throw new BoardHandler(ErrorStatus.SUB_POSITION_INVALID);
}

// μƒλŒ€ ν¬μ§€μ…˜ κ°’ 검증. (1 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getWantPosition() < 1 || request.getWantPosition() > 5) {
// μƒλŒ€ ν¬μ§€μ…˜ κ°’ 검증. (0 ~ 5κ°’λ§Œ κ°€λŠ₯)
if (request.getWantPosition() < 0 || request.getWantPosition() > 5) {
throw new BoardHandler(ErrorStatus.WANT_POSITION_INVALID);
}

Expand Down

0 comments on commit dea7c8f

Please sign in to comment.