Skip to content

Commit

Permalink
[Chore] 사소한 수정 (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
PHS00 authored Nov 27, 2023
2 parents 06ab1cc + 082fc3b commit bb91c8d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CloseVoteService {

public void execute(Long voteId, Long userId) {
VoteEntity voteEntity =
voteRepository.findById(voteId).orElseThrow(() -> new NotFoundVoteException());
voteRepository.findById(voteId).orElseThrow(NotFoundVoteException::new);
if (!voteEntity.isOwner(userId)) {
throw new NotWriterException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GetVoteDetailService {

public GetVoteDetailResponse execute(Long voteId, Long userId) {
VoteEntity voteEntity =
voteRepository.findById(voteId).orElseThrow(() -> new NotFoundVoteException());
voteRepository.findById(voteId).orElseThrow(NotFoundVoteException::new);

VoteDto voteDto = getVoteService.execute(voteEntity, userId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ public Active checkActive() {
}

public boolean isOn() {
if (checkActive() == Active.CONTINUE) {
return true;
}
return false;
return checkActive() == Active.CONTINUE;
}

public static VoteEntity create(CreateVoteRequest request, Long userId) {
Expand All @@ -75,14 +72,11 @@ public static VoteEntity create(CreateVoteRequest request, Long userId) {
}

public boolean isOwner(Long userId) {
return userId == this.getUserId();
return userId.equals(this.getUserId());
}

public boolean isComplete() {
if (checkActive().equals(Active.COMPLETE)) {
return true;
}
return false;
return checkActive().equals(Active.COMPLETE);
}

public void updateCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface VoteRepository extends JpaRepository<VoteEntity, Integer> {
public interface VoteRepository extends JpaRepository<VoteEntity, Long> {

@Query(
"select v from VoteEntity v"
Expand Down Expand Up @@ -85,7 +85,6 @@ Slice<VoteEntity> findAllFinishVotesByCategoryOrderByVoteTotalCount(
"select v from VoteEntity v where v.deleted = false and v.userId = :userId order by v.createdDate desc ")
List<VoteEntity> findAllByUserId(@Param("userId") Long userId);

Optional<VoteEntity> findById(Long id);

// 검색 기능
@Query(
Expand Down

0 comments on commit bb91c8d

Please sign in to comment.