-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 개표 결과 저장 기능 구현 * feat: 개표 결과 조회 기능 구현
- Loading branch information
1 parent
2f9c6bf
commit d324223
Showing
7 changed files
with
133 additions
and
17 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
src/main/java/com/studentvote/domain/user/domain/repository/GovernanceRepository.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,7 +1,9 @@ | ||
package com.studentvote.domain.user.domain.repository; | ||
|
||
import com.studentvote.domain.user.domain.Governance; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface GovernanceRepository extends JpaRepository<Governance, Long> { | ||
Optional<Governance> findByVoteHeadquaterUserId(Long voteHeadquaterUserId); | ||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/studentvote/domain/vote/domain/repository/VoteResultRepository.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,14 @@ | ||
package com.studentvote.domain.vote.domain.repository; | ||
|
||
import com.studentvote.domain.user.domain.Governance; | ||
import com.studentvote.domain.vote.domain.VoteResult; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
public interface VoteResultRepository extends JpaRepository<VoteResult, Long> { | ||
Optional<VoteResult> findByGovernance(Governance governance); | ||
|
||
@Query("select count(v) > 0 from VoteResult v where v.governance = :governance") | ||
Boolean ExistsByGovernance(Governance governance); | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/studentvote/domain/vote/dto/response/GetResultResponse.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,15 @@ | ||
package com.studentvote.domain.vote.dto.response; | ||
|
||
import lombok.Builder; | ||
|
||
public record GetResultResponse( | ||
String departmentName, | ||
String resultImageUrl | ||
) { | ||
|
||
@Builder | ||
public GetResultResponse(String departmentName, String resultImageUrl) { | ||
this.departmentName = departmentName; | ||
this.resultImageUrl = resultImageUrl; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/studentvote/domain/vote/exception/AlreadyExistVoteResultException.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,7 @@ | ||
package com.studentvote.domain.vote.exception; | ||
|
||
public class AlreadyExistVoteResultException extends RuntimeException { | ||
public AlreadyExistVoteResultException() { | ||
super("이미 등록된 개표 결과 이미지가 존재합니다."); | ||
} | ||
} |
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