Skip to content

Commit

Permalink
fix 전적 검색 KR_ 안붙여줘서 발생할 수 있는 버그 수정 #25
Browse files Browse the repository at this point in the history
  • Loading branch information
rookedsysc committed Mar 17, 2024
1 parent f707442 commit c3f848a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/gamemoonchul/application/BoardService.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public class BoardService {
private final LolSearchAdapter lolSearchAdapter;

public MatchGameResponse searchMatch(String gameId) {
Optional<MatchGame> optionalEntity = matchGameService.findById(gameId);
Optional<MatchGame> savedEntity = matchGameService.findByGameId(gameId);
MatchGame matchGame;


if (optionalEntity.isPresent()) {
matchGame = optionalEntity.get();
if (savedEntity != null && savedEntity.isPresent()) {
matchGame = savedEntity.get();
} else {
MatchRecord vo = lolSearchAdapter.searchMatch(gameId);
matchGame = matchGameService.save(vo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MatchGameService {
private final MatchGameRepository matchGameRepository;
private final MatchGameConverter matchConverter;

public Optional<MatchGame> findById(String gameId) {
public Optional<MatchGame> findByGameId(String gameId) {
return matchGameRepository.findByGameId(gameId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class BoardApiController {

@GetMapping("/search-match/{gameId}")
public MatchGameResponse searchMatch(@PathVariable String gameId) {
return boardService.searchMatch(gameId);
return boardService.searchMatch("KR_" + gameId);
}

@PostMapping("/video-upload")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void setMatchGameService() {
List<MatchUser> matchUsers = matchUserService.saveAll(dummyVO.info().participants(), matchGame);

// when
Optional<MatchGame> optionalMatchGame = matchGameService.findById(matchGame.getGameId());
Optional<MatchGame> optionalMatchGame = matchGameService.findByGameId(matchGame.getGameId());
MatchGame result = optionalMatchGame.get();

// then
Expand Down

0 comments on commit c3f848a

Please sign in to comment.