Skip to content

Commit

Permalink
♻️ [Refactor] voice -> mike 컬럼 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hzee97 committed Aug 9, 2024
1 parent 82784b7 commit b5d2d96
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/main/generated/com/gamegoo/domain/board/QBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public class QBoard extends EntityPathBase<Board> {

public final com.gamegoo.domain.QMember member;

public final BooleanPath mike = createBoolean("mike");

public final NumberPath<Integer> mode = createNumber("mode", Integer.class);

public final NumberPath<Integer> subPosition = createNumber("subPosition", Integer.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> updatedAt = _super.updatedAt;

public final BooleanPath voice = createBoolean("voice");

public final NumberPath<Integer> wantPosition = createNumber("wantPosition", Integer.class);

public QBoard(String variable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ApiResponse<BoardResponse.boardInsertResponseDTO> boardInsert(
.mainPosition(saveBoard.getMainPosition())
.subPosition(saveBoard.getSubPosition())
.wantPosition(saveBoard.getWantPosition())
.voice(saveBoard.getVoice())
.mike(saveBoard.getMike())
.gameStyles(gameStyles)
.contents(saveBoard.getContent())
.build();
Expand Down Expand Up @@ -89,7 +89,7 @@ public ApiResponse<BoardResponse.boardUpdateResponseDTO> boardUpdate(
.mainPosition(updateBoard.getMainPosition())
.subPosition(updateBoard.getSubPosition())
.wantPosition(updateBoard.getWantPosition())
.voice(updateBoard.getVoice())
.mike(updateBoard.getMike())
.gameStyles(gameStyles)
.contents(updateBoard.getContent())
.build();
Expand All @@ -116,15 +116,15 @@ public ApiResponse<List<BoardResponse.boardListResponseDTO>> boardList(@RequestP
@RequestParam(required = false) Integer mode,
@RequestParam(required = false) String tier,
@RequestParam(required = false) Integer mainPosition,
@RequestParam(required = false) Boolean voice){
@RequestParam(required = false) Boolean mike){

// <포지션 정보> 전체: 0, 탑: 1, 정글: 2, 미드: 3, 바텀:4, 서포터:5
if (mainPosition != null && mainPosition == 0) {
// 전체 포지션 선택 시 필터링에서 제외
mainPosition = null;
}

List<BoardResponse.boardListResponseDTO> result = boardService.getBoardList(mode,tier,mainPosition,voice,pageIdx);
List<BoardResponse.boardListResponseDTO> result = boardService.getBoardList(mode,tier,mainPosition,mike,pageIdx);
return ApiResponse.onSuccess(result);
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/gamegoo/domain/board/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class Board extends BaseDateTimeEntity {
@Column(name = "want_position", nullable = false)
private Integer wantPosition;

@Column(name = "voice")
private Boolean voice = false;
@Column(name = "mike")
private Boolean mike = false;

@Column(name = "content", length = 5000)
private String content;
Expand All @@ -60,12 +60,12 @@ public void setMember(Member member) {
}
}

public void updateBoard(Integer mode, Integer mainPosition, Integer subPosition, Integer wantPosition, Boolean voice, String content, Integer boardProfileImage) {
public void updateBoard(Integer mode, Integer mainPosition, Integer subPosition, Integer wantPosition, Boolean mike, String content, Integer boardProfileImage) {
this.mode = mode;
this.mainPosition = mainPosition;
this.subPosition = subPosition;
this.wantPosition = wantPosition;
this.voice = voice;
this.mike = mike;
this.content = content;
this.boardProfileImage = boardProfileImage;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/gamegoo/dto/board/BoardRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class boardInsertDTO {
Integer wantPosition;

@Schema(description = "마이크 사용 여부", defaultValue = "false")
Boolean voice = false;
Boolean mike = false;
List<Long> gameStyles;
String contents;

Expand All @@ -46,7 +46,7 @@ public static class boardUpdateDTO {
Integer subPosition;

Integer wantPosition;
Boolean voice;
Boolean mike;
List<Long> gameStyles;
String contents;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/gamegoo/dto/board/BoardResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static class boardInsertResponseDTO {
Integer mainPosition;
Integer subPosition;
Integer wantPosition;
Boolean voice;
Boolean mike;
List<Long> gameStyles;
String contents;

Expand All @@ -44,7 +44,7 @@ public static class boardUpdateResponseDTO {
Integer mainPosition;
Integer subPosition;
Integer wantPosition;
Boolean voice;
Boolean mike;
List<Long> gameStyles;
String contents;
}
Expand All @@ -68,7 +68,7 @@ public static class boardListResponseDTO {
List<Long> championList;
Double winRate;
LocalDateTime createdAt;
Boolean voice;
Boolean mike;
}

@Getter
Expand All @@ -85,7 +85,7 @@ public static class boardByIdResponseDTO {
String tag;
Integer mannerLevel;
String tier;
Boolean voice;
Boolean mike;
List<Long> championList;
Integer gameMode;
Integer mainPosition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public interface BoardRepository extends JpaRepository<Board,Long>{
"(:mode IS NULL OR b.mode = :mode) AND " +
"(:tier IS NULL OR m.tier = :tier) AND " +
"(:mainPosition IS NULL OR b.mainPosition = :mainPosition OR b.subPosition = :mainPosition) AND " +
"(:voice IS NULL OR b.voice = :voice)")
"(:mike IS NULL OR b.mike = :mike)")

Page<Board> findByFilters(@Param("mode") Integer mode,
@Param("tier") String tier,
@Param("mainPosition") Integer mainPosition,
@Param("voice") Boolean voice,
@Param("mike") Boolean mike,
Pageable pageable);
}
20 changes: 10 additions & 10 deletions src/main/java/com/gamegoo/service/board/BoardService.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public Board save(BoardRequest.boardInsertDTO request, Long memberId, Member mem
}

// 마이크 설정 (default=false)
if (request.getVoice() == null) {
request.setVoice(false);
if (request.getMike() == null) {
request.setMike(false);
}

// 게임 스타일 길이 검증.
Expand Down Expand Up @@ -94,7 +94,7 @@ public Board save(BoardRequest.boardInsertDTO request, Long memberId, Member mem
.mainPosition(request.getMainPosition())
.subPosition(request.getSubPosition())
.wantPosition(request.getWantPosition())
.voice(request.getVoice())
.mike(request.getMike())
.boardGameStyles(new ArrayList<>())
.content(request.getContents())
.boardProfileImage(boardProfileImage)
Expand Down Expand Up @@ -168,8 +168,8 @@ public Board update(BoardRequest.boardUpdateDTO request, Long memberId, Long boa
}

// 마이크 설정 (null인 경우 기본값 false)
if (request.getVoice() == null) {
request.setVoice(false);
if (request.getMike() == null) {
request.setMike(false);
}

// 게시판 글 데이터 수정
Expand All @@ -178,7 +178,7 @@ public Board update(BoardRequest.boardUpdateDTO request, Long memberId, Long boa
request.getMainPosition(),
request.getSubPosition(),
request.getWantPosition(),
request.getVoice(),
request.getMike(),
request.getContents(),
boardProfileImage
);
Expand Down Expand Up @@ -238,7 +238,7 @@ public void delete(Long boardId, Long memberId) {

// 게시판 글 목록 조회
@Transactional(readOnly = true)
public List<BoardResponse.boardListResponseDTO> getBoardList(Integer mode, String tier, Integer mainPosition, Boolean voice, int pageIdx){
public List<BoardResponse.boardListResponseDTO> getBoardList(Integer mode, String tier, Integer mainPosition, Boolean mike, int pageIdx){
// pageIdx 값 검증.
if (pageIdx <= 0) {
throw new PageHandler(ErrorStatus.PAGE_INVALID);
Expand All @@ -247,7 +247,7 @@ public List<BoardResponse.boardListResponseDTO> getBoardList(Integer mode, Strin
// 사용자로부터 받은 pageIdx를 1 감소 -> pageIdx=1 일 때, 1 페이지.
Pageable pageable = PageRequest.of(pageIdx - 1, PAGE_SIZE, Sort.by(Sort.Direction.DESC, "createdAt"));

List<Board> boards = boardRepository.findByFilters(mode, tier, mainPosition, voice, pageable).getContent();
List<Board> boards = boardRepository.findByFilters(mode, tier, mainPosition, mike, pageable).getContent();

return boards.stream().map(board -> {

Expand All @@ -267,7 +267,7 @@ public List<BoardResponse.boardListResponseDTO> getBoardList(Integer mode, Strin
.championList(member.getMemberChampionList().stream().map(MemberChampion::getId).collect(Collectors.toList()))
.winRate(member.getWinRate())
.createdAt(board.getCreatedAt())
.voice(board.getVoice())
.mike(board.getMike())
.build();

}).collect(Collectors.toList());
Expand All @@ -291,7 +291,7 @@ public BoardResponse.boardByIdResponseDTO getBoardById(Long boardId) {
.mannerLevel(member.getMannerLevel())
.tier(member.getTier())
.championList(member.getMemberChampionList().stream().map(MemberChampion::getId).collect(Collectors.toList()))
.voice(board.getVoice())
.mike(board.getMike())
.gameMode(board.getMode())
.mainPosition(board.getMainPosition())
.subPosition(board.getSubPosition())
Expand Down

0 comments on commit b5d2d96

Please sign in to comment.