-
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.
RoomService, init.sql 및 일부 테스트 데이터 변경
- Loading branch information
Showing
83 changed files
with
1,328 additions
and
171 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,10 +1,7 @@ | ||
FROM openjdk:17-jdk-slim | ||
|
||
ARG JAR_FILE=build/libs/*.jar | ||
ARG SPRING_PROFILE | ||
|
||
ENV SPRING_PROFILE=${SPRING_PROFILE} | ||
|
||
COPY ${JAR_FILE} app.jar | ||
|
||
ENTRYPOINT [ "java", "-jar", "-Duser.timezone=Asia/Seoul", "-Dspring.profiles.active=${SPRING_PROFILE}", "app.jar" ] | ||
ENTRYPOINT [ "java", "-jar", "-Duser.timezone=Asia/Seoul", "-Dspring.profiles.active=dev", "app.jar" ] |
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
9 changes: 9 additions & 0 deletions
9
...d/src/main/java/ddangkong/controller/balance/content/dto/BalanceContentGroupResponse.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,9 @@ | ||
package ddangkong.controller.balance.content.dto; | ||
|
||
import ddangkong.controller.balance.option.dto.BalanceOptionGroupResponse; | ||
|
||
public record BalanceContentGroupResponse( | ||
BalanceOptionGroupResponse firstOption, | ||
BalanceOptionGroupResponse secondOption | ||
) { | ||
} |
9 changes: 9 additions & 0 deletions
9
...d/src/main/java/ddangkong/controller/balance/content/dto/BalanceContentTotalResponse.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,9 @@ | ||
package ddangkong.controller.balance.content.dto; | ||
|
||
import ddangkong.controller.balance.option.dto.BalanceOptionTotalResponse; | ||
|
||
public record BalanceContentTotalResponse( | ||
BalanceOptionTotalResponse firstOption, | ||
BalanceOptionTotalResponse secondOption | ||
) { | ||
} |
26 changes: 26 additions & 0 deletions
26
...end/src/main/java/ddangkong/controller/balance/option/dto/BalanceOptionGroupResponse.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,26 @@ | ||
package ddangkong.controller.balance.option.dto; | ||
|
||
import ddangkong.domain.balance.option.BalanceOption; | ||
import ddangkong.domain.balance.vote.BalanceVote; | ||
import java.util.List; | ||
|
||
public record BalanceOptionGroupResponse( | ||
Long optionId, | ||
String name, | ||
List<String> members, | ||
int memberCount, | ||
int percent | ||
) { | ||
public static BalanceOptionGroupResponse of(BalanceOption balanceOption, | ||
List<BalanceVote> balanceVotes, | ||
int totalSize) { | ||
List<String> members = balanceVotes.stream() | ||
.map(BalanceVote::getMemberNickname) | ||
.toList(); | ||
return new BalanceOptionGroupResponse(balanceOption.getId(), | ||
balanceOption.getName(), | ||
members, | ||
balanceVotes.size(), | ||
(int) Math.round(balanceVotes.size() * 1.0 / totalSize * 100)); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...end/src/main/java/ddangkong/controller/balance/option/dto/BalanceOptionTotalResponse.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,17 @@ | ||
package ddangkong.controller.balance.option.dto; | ||
|
||
import ddangkong.domain.balance.option.BalanceOption; | ||
|
||
public record BalanceOptionTotalResponse( | ||
Long optionId, | ||
String name, | ||
int percent | ||
) { | ||
public static BalanceOptionTotalResponse of(BalanceOption balanceOption, | ||
Long totalSize, | ||
Long optionSize) { | ||
return new BalanceOptionTotalResponse(balanceOption.getId(), | ||
balanceOption.getName(), | ||
(int) Math.round(optionSize * 1.0 / totalSize * 100)); | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
backend/src/main/java/ddangkong/controller/balance/vote/dto/BalanceVoteResultResponse.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.controller.balance.vote.dto; | ||
|
||
import ddangkong.controller.balance.content.dto.BalanceContentGroupResponse; | ||
import ddangkong.controller.balance.content.dto.BalanceContentTotalResponse; | ||
|
||
public record BalanceVoteResultResponse( | ||
BalanceContentGroupResponse group, | ||
BalanceContentTotalResponse total | ||
) { | ||
} |
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/ddangkong/domain/balance/content/BalanceContentRepository.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,13 @@ | ||
package ddangkong.domain.balance.content; | ||
|
||
import ddangkong.domain.balance.option.BalanceOption; | ||
import ddangkong.exception.BadRequestException; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface BalanceContentRepository extends JpaRepository<BalanceContent, Long> { | ||
|
||
default BalanceContent getById(Long id) { | ||
return findById(id) | ||
.orElseThrow(() -> new BadRequestException("해당 질문 컨텐츠가 존재하지 않습니다.")); | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
backend/src/main/java/ddangkong/domain/balance/vote/BalanceVoteRepository.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,6 +1,12 @@ | ||
package ddangkong.domain.balance.vote; | ||
|
||
import ddangkong.domain.balance.option.BalanceOption; | ||
import ddangkong.domain.balance.room.Room; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface BalanceVoteRepository extends JpaRepository<BalanceVote, Long> { | ||
Long countByBalanceOption(BalanceOption balanceOption); | ||
|
||
List<BalanceVote> findByMemberRoomAndBalanceOption(Room room, BalanceOption balanceOption); | ||
} |
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
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
Oops, something went wrong.