-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [스티치] 체스 스프링 실습 1단계 미션 제출입니다 (#37) * feat : 기존 Chess 코드 추가 * refactor : 기존 Chess 코드의 Application과 Controller 명명 수정 * refactor : JdbcTemplate 명명 수정 및 Spring Bean 등록 - 기존 JdbcTemplate 라이브러리와 충돌로 인한 명명 수정 - Dao, Service, ConnectionManager를 Spring Bean 등록 * feat : SpringChessController 추가 * feat : SpringChessController 구현 * refactor : controller 피드백 리팩토링 * refactor : database package 리팩토링 - ConnectionManager를 DataSource로 명명 수정. - CustomJdbcTemplate을 JdbcTemplate으로 명명 수정, 별칭 지정. - MySqlConnectionManager를 MySqlDataSource로 명명 수정, 별칭 지정. * refactor : 접근 지정자 수정 및 상수 추출 * refactor : BlackPawnStrategy와 WhitePawnStrategy를 PawnStrategy로 추상화 * [스티치] 체스 스프링 실습 2단계 미션 제출입니다 (#87) * feat : Spring Data JDBC 적용 - Spring Data JDBC 적용을 위한 GameRoomRepository 구현 - schema.sql 구현 * feat : GameHistory, GameRoom Entity 구현 * refactor : 게임방 생성과 새로운 방을 생성할 수 있도록 index.hbs 수정 * refactor : 종료된 게임 표시 및 왕이 잡히면 게임이 종료 되도록 수정 * refactor : ConsoleApplication 관련 패키지 및 클래스 삭제 * refactor : Service 흐름에 따라 메서드 순서 변경 * feat : DB에 GameRoom이 존재하지 않는 경우 예외 발생 기능 구현 * feat: MockMvc를 활용한 컨트롤러 테스트 * chore : 불필요한 todo 주석 제거 Co-authored-by: Junyoung Lee <[email protected]>
- Loading branch information
Showing
26 changed files
with
431 additions
and
70 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
package wooteco.chess.database; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.jdbc.repository.query.Query; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.query.Param; | ||
import wooteco.chess.entity.GameRoom; | ||
|
||
import java.util.List; | ||
import wooteco.chess.entity.GameRoom; | ||
|
||
public interface GameRoomRepository extends CrudRepository<GameRoom, Long> { | ||
|
||
@Override | ||
List<GameRoom> findAll(); | ||
|
||
@Query("SELECT * FROM game_room WHERE name = :name") | ||
GameRoom findByName(@Param("name") final String name); | ||
Optional<GameRoom> findByName(@Param("name") final String name); | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package wooteco.chess.service.dto; | ||
|
||
import wooteco.chess.entity.GameRoom; | ||
|
||
import java.util.Objects; | ||
|
||
public class GameRoomDto { | ||
|
||
private Long id; | ||
private String name; | ||
private Boolean state; | ||
|
||
private GameRoomDto(final Long id, final String name, final Boolean state) { | ||
this.id = id; | ||
this.name = name; | ||
this.state = state; | ||
} | ||
|
||
public static GameRoomDto of(final GameRoom gameRoom) { | ||
Objects.requireNonNull(gameRoom, "게임이 null입니다."); | ||
return new GameRoomDto(gameRoom.getId(), gameRoom.getName(), gameRoom.getState()); | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Boolean getState() { | ||
return state; | ||
} | ||
|
||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.