Skip to content

Commit

Permalink
[merge] 모임 참여 신청 시 기본 상태값 변경
Browse files Browse the repository at this point in the history
[hotfix] 모임 참여 신청 시 기본 상태값 변경
  • Loading branch information
lreowy authored Jul 18, 2024
2 parents 7581ded + 5b5b33d commit e7cacca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.data.repository.query.Param;

public interface MoimSubmissionRepository extends JpaRepository<MoimSubmission, Long> {
boolean existsByMoimAndMoimSubmissionStateAndGuestId(Moim moim, String moimSubmissionState, Long guestId);
boolean existsByMoimAndGuestId(Moim moim, Long guestId);

List<MoimSubmission> findAllByGuestId(Long guestId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public void createMoimSubmission(Long moimId, Long guestId, MoimSubmitRequest re
.moim(moim)
.answerList(request.answerList())
.accountList(request.accountList())
.moimSubmissionState(MoimSubmissionState.PENDING_PAYMENT.getMoimSubmissionState())
.moimSubmissionState(MoimSubmissionState.PENDING_APPROVAL.getMoimSubmissionState())
.build();
isDuplicatedMoimSubmission(moimSubmission);
moimSubmissionRepository.save(moimSubmission);
}

private void isDuplicatedMoimSubmission(MoimSubmission moimSubmission) {
if (moimSubmissionRepository.existsByMoimAndMoimSubmissionStateAndGuestId(moimSubmission.getMoim(),
moimSubmission.getMoimSubmissionState(), moimSubmission.getGuestId())) {
if (moimSubmissionRepository.existsByMoimAndGuestId(moimSubmission.getMoim(),
moimSubmission.getGuestId())) {
throw new BadRequestException(ErrorCode.DUPLICATION_MOIM_SUBMISSION);
}
}
Expand Down

0 comments on commit e7cacca

Please sign in to comment.