Skip to content

Commit

Permalink
[merge] 모임 종료 시 모임 참여 신청 상태값 completed로 변경
Browse files Browse the repository at this point in the history
[hotfix] 모임 종료 시 모임 참여 신청 상태값 completed로 변경
  • Loading branch information
lreowy authored Oct 17, 2024
2 parents ef0a93e + 9384c68 commit fdd37d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.pickple.server.api.moim.dto.request.MoimCreateRequest;
import com.pickple.server.api.moim.dto.response.MoimCreateResponse;
import com.pickple.server.api.moim.repository.MoimRepository;
import com.pickple.server.api.moimsubmission.domain.MoimSubmission;
import com.pickple.server.api.moimsubmission.repository.MoimSubmissionRepository;
import com.pickple.server.global.util.DateUtil;
import java.time.LocalDate;
import java.time.LocalTime;
Expand All @@ -23,6 +25,7 @@ public class MoimCommandService {

private final HostRepository hostRepository;
private final MoimRepository moimRepository;
private final MoimSubmissionRepository moimSubmissionRepository;

public MoimCreateResponse createMoim(Long hostId, MoimCreateRequest request) {
Host host = hostRepository.findHostByIdOrThrow(hostId);
Expand Down Expand Up @@ -57,6 +60,11 @@ public void changeMoimStateOfDday() {
for (Moim moim : moimList) {
if (moim.getDateList().getEndTime().isBefore(LocalTime.now())) {
moim.updateMoimState("completed");
List<MoimSubmission> moimSubmissionList = moimSubmissionRepository.findApprovedMoimSubmissionsByMoimId(
moim.getId());
for (MoimSubmission moimSubmission : moimSubmissionList) {
moimSubmission.updateMoimSubmissionState("completed");
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,10 @@ default MoimSubmission findMoimSubmissionByIdOrThrow(Long id) {
boolean existsByMoimIdAndGuestIdAndMoimSubmissionState(Long moimId, Long guestId, String MoimSubmissionState);

@Query("SELECT ms FROM MoimSubmission ms WHERE ms.guestId = :guestId AND ms.moimSubmissionState IN ('pendingPayment','pendingApproval', 'approved', 'rejected','refunded')")

@Query("SELECT ms FROM MoimSubmission ms WHERE ms.moim.id = :moimId AND ms.moimSubmissionState = 'approved'")
List<MoimSubmission> findApprovedMoimSubmissionsByMoimId(@Param("moimId") Long moimId);

List<MoimSubmission> findSubmittedMoimSubmissions(@Param("guestId") Long guestId);

}

0 comments on commit fdd37d4

Please sign in to comment.