-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 구분을 쉽게 하기 위해 일부 테이블 및 컬럼 이름 변경 #28
- BalanceQuestion -> BalanceContent로 변경 - 필드명 content, title 등을 name으로 바꿈
- Loading branch information
1 parent
31e3543
commit 06b3dba
Showing
17 changed files
with
120 additions
and
117 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
backend/src/main/java/ddangkong/controller/content/BalanceContentController.java
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,22 @@ | ||
package ddangkong.controller.content; | ||
|
||
import ddangkong.controller.content.dto.BalanceContentResponse; | ||
import ddangkong.service.content.BalanceContentService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
@RequiredArgsConstructor | ||
public class BalanceContentController { | ||
|
||
private final BalanceContentService balanceContentService; | ||
|
||
@GetMapping("/balances/rooms/{roomId}/question") | ||
public BalanceContentResponse getBalanceContent(@PathVariable Long roomId) { | ||
return balanceContentService.findRecentBalanceContent(roomId); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/ddangkong/controller/content/dto/BalanceContentResponse.java
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,27 @@ | ||
package ddangkong.controller.content.dto; | ||
|
||
import ddangkong.controller.option.dto.BalanceOptionResponse; | ||
import ddangkong.domain.content.BalanceContent; | ||
import ddangkong.domain.content.Category; | ||
import ddangkong.domain.option.BalanceOption; | ||
import lombok.Builder; | ||
|
||
public record BalanceContentResponse( | ||
Long questionId, | ||
Category category, | ||
String title, | ||
BalanceOptionResponse firstOption, | ||
BalanceOptionResponse secondOption | ||
) { | ||
|
||
@Builder | ||
private BalanceContentResponse(BalanceContent balanceContent, | ||
BalanceOption firstOption, | ||
BalanceOption secondOption) { | ||
this(balanceContent.getId(), | ||
balanceContent.getCategory(), | ||
balanceContent.getName(), | ||
BalanceOptionResponse.from(firstOption), | ||
BalanceOptionResponse.from(secondOption)); | ||
} | ||
} |
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
22 changes: 0 additions & 22 deletions
22
backend/src/main/java/ddangkong/controller/question/BalanceQuestionController.java
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
backend/src/main/java/ddangkong/controller/question/dto/BalanceQuestionResponse.java
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
...a/ddangkong/domain/question/Category.java → ...va/ddangkong/domain/content/Category.java
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,4 +1,4 @@ | ||
package ddangkong.domain.question; | ||
package ddangkong.domain.content; | ||
|
||
public enum Category { | ||
EXAMPLE, | ||
|
10 changes: 10 additions & 0 deletions
10
backend/src/main/java/ddangkong/domain/content/RoomContentRepository.java
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,10 @@ | ||
package ddangkong.domain.content; | ||
|
||
import ddangkong.domain.room.RoomContent; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface RoomContentRepository extends JpaRepository<RoomContent, Long> { | ||
|
||
Optional<RoomContent> findTopByRoomIdOrderByCreatedAtDesc(Long roomId); | ||
} |
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
4 changes: 2 additions & 2 deletions
4
backend/src/main/java/ddangkong/domain/option/BalanceOptionRepository.java
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,10 +1,10 @@ | ||
package ddangkong.domain.option; | ||
|
||
import ddangkong.domain.question.BalanceQuestion; | ||
import ddangkong.domain.content.BalanceContent; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface BalanceOptionRepository extends JpaRepository<BalanceOption, Long> { | ||
|
||
List<BalanceOption> findByBalanceQuestion(BalanceQuestion balanceQuestion); | ||
List<BalanceOption> findByBalanceContent(BalanceContent balanceContent); | ||
} |
10 changes: 0 additions & 10 deletions
10
backend/src/main/java/ddangkong/domain/question/RoomQuestionRepository.java
This file was deleted.
Oops, something went wrong.
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
8 changes: 4 additions & 4 deletions
8
.../question/RoomQuestionRepositoryTest.java → ...in/content/RoomContentRepositoryTest.java
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
Oops, something went wrong.