Skip to content
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

[럿고] 체스- 스프링 실습 2단계 제출합니다. #72

Merged
merged 12 commits into from
Apr 26, 2020

Conversation

ksy90101
Copy link

범블비 감사해요!

Copy link

@ddaaac ddaaac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 럿고! 기존 코드 구현을 잘해주셔서 큰 변경 없이 요구사항을 달성해주셨네요. 💯 깔끔한 코드에 그저 감탄만 납니다! 사소한 피드백 몇개 남겼으니 확인해주세요 :)

return GSON.toJson(from + " " + to);
}

@ResponseStatus(value = HttpStatus.CONFLICT)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

409 에러 👍

import wooteco.chess.domain.piece.Piece;
import wooteco.chess.domain.piece.PieceFactory;
import wooteco.chess.domain.piece.Symbol;
import wooteco.chess.domain.position.Column;
import wooteco.chess.domain.position.Position;

@Component
public class BoardDAO {
public void addPieces(String gameId, List<Piece> pieces) {
String query = "INSERT INTO board VALUES (?, ?, ?)";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 쿼리문을 쓸 때 INSERT INTO board (id, name, symbol) VALUES (?, ?, ?) 처럼 컬럼명을 명시해주는 편입니다. 유지보수도 편해지고, 에러가 났을 때 인텔리제이의 지원도 받을 수도 있기 때문입니다(링크).

import wooteco.chess.domain.piece.Team;

@Component
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Component 어노테이션으로 빈 객체 등록 👍

this.name = name;
this.position = position;
}

public Column plus() {
return Arrays.stream(Column.values())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 생각했던 방식은 ordinal()을 사용해서 불필요한 stream까지 제거하는 방식이었습니다!

try {
    return values()[ordinal() + STEP];
} catch (ArrayIndexOutOfBoundsException e) {
    throw new IllegaArgumentException(...);
}

@gracefulBrown gracefulBrown merged commit 68f051f into woowacourse:ksy90101 Apr 26, 2020
ksy90101 added a commit to ksy90101/jwp-chess that referenced this pull request Apr 30, 2020
* [코즈] 체스 - 스프링 실습 1단계 제출합니다. (woowacourse#15)

* Initial Commit

* refactor: DAO try - resource 적용

* refactor: BoardDAO.addPieces(), hasNotGameIn() 추가

* refactor: 방어적 복사 적용

* refactor: Name -> Symbol 변경, BoardFactory -> PiecesFactory 변경

* refactor: 세션 만료시간 추가

* refactor: post -> put method type 변경, ChessController api 분리

* refactor: rs.next NPE 대비, boardDAO.findAll() -> findAllPieces() 네이밍 변경

* refactor: position -> ordinal() 변경

* refactor: 메소드 분리

* docs: Spring 요구 사항 작성

* refactor: html -> hbs 변경, 미사용 테스트 제거

* refactor: SpringChessController.renderStart() 구현

* refactor: SparkChessController - game id, Session -> params 사용

* feat: SpringChessController.renderBoard() 구현

* feat: SpringChessController.updateBoard(), handleException() 구현

* feat: SpringChessController.renderResult() 구현

Co-authored-by: Gyeong-Jun Kim <lastpuzly@gmail.com>
Co-authored-by: Seyun <ksy90101@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants