Skip to content

Commit

Permalink
[fix] 공지사항 전체조회 api 에러수정
Browse files Browse the repository at this point in the history
[fix] 공지사항 전체조회 api 에러수정
  • Loading branch information
bo-ram-bo-ram authored Sep 16, 2024
2 parents f85ee11 + afdb8d3 commit 3a49f33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ ApiResponseDto createNotice(
}
)
ApiResponseDto getNoticeListByMoimId(
@PathVariable Long moimId,
@Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH)
@GuestId Long guestId,
@PathVariable Long moimId
@GuestId Long geustId
);

@Operation(summary = "공지사항 삭제")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.pickple.server.api.notice.service;

import com.pickple.server.api.comment.repository.CommentRepository;
import com.pickple.server.api.guest.repository.GuestRepository;
import com.pickple.server.api.moim.domain.Moim;
import com.pickple.server.api.moim.repository.MoimRepository;
import com.pickple.server.api.moimsubmission.domain.MoimSubmission;
Expand All @@ -25,6 +26,7 @@ public class NoticeQueryService {
private final NoticeRepository noticeRepository;
private final CommentRepository commentRepository;
private final MoimSubmissionRepository moimSubmissionRepository;
private final GuestRepository guestRepository;

public List<NoticeListGetByMoimResponse> getNoticeListByMoimId(Long moimId, Long guestId) {
Moim moim = moimRepository.findMoimByIdOrThrow(moimId);
Expand Down Expand Up @@ -71,7 +73,10 @@ private boolean checkOwner(Long userId, Long moimId) {
}

private boolean isUserAppliedToMoim(Long moimId, Long guestId) {
if (moimSubmissionRepository.existsByMoimIdAndGuestId(moimId, guestId)) {
if ((moimRepository.findMoimByIdOrThrow(moimId).getHost().getUser())
.equals(guestRepository.findGuestByIdOrThrow(guestId).getUser().getId())) {
return true;
} else if (moimSubmissionRepository.existsByMoimIdAndGuestId(moimId, guestId)) {
MoimSubmission moimSubmission = moimSubmissionRepository.findByMoimIdAndGuestId(moimId, guestId);

// 참가한 상태일 경우(승인된 상태 - approved , completed
Expand Down

0 comments on commit 3a49f33

Please sign in to comment.