Skip to content

Commit

Permalink
hotfix : 모임 신청 시 pendingApproval 상태 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
lreowy committed Jul 18, 2024
1 parent 7581ded commit 5b5b33d
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 5b5b33d

Please sign in to comment.