Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ResponseEntity<ApiResponse<List<PotMemberAppealResponseDto>>> addPotMembe
return ResponseEntity.ok(ApiResponse.onSuccess(response));
}

@Operation(summary = "팟 어필 API")
@Operation(summary = "여기서 저는요 작성 및 수정 API")
@PatchMapping("/appeal")
public ResponseEntity<ApiResponse<String>> updateAppealContent(
@PathVariable("pot_id") Long potId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import stackpot.stackpot.pot.repository.PotApplicationRepository;
import stackpot.stackpot.pot.repository.PotCommentRepository;
import stackpot.stackpot.pot.repository.PotRepository;
import stackpot.stackpot.pot.repository.PotSaveRepository;
import stackpot.stackpot.user.entity.User;
import stackpot.stackpot.user.repository.UserRepository;

Expand All @@ -35,6 +36,7 @@ public class PotApplicationQueryServiceImpl implements PotApplicationQueryServic
private final PotApplicationConverter potApplicationConverter;
private final PotDetailConverter potDetailConverter;
private final AuthService authService;
private final PotSaveRepository potSaveRepository;

@Override
@Transactional(readOnly = true)
Expand Down Expand Up @@ -63,13 +65,15 @@ public PotDetailWithApplicantsResponseDto getPotDetailsAndApplicants(Long potId)
boolean isApplied = pot.getPotApplication().stream()
.anyMatch(application -> application.getUser().getId().equals(user.getId()));

boolean isSaved = potSaveRepository.existsByUserAndPot_PotId(user, potId);

String recruitmentDetails = pot.getRecruitmentDetails().stream()
.map(rd -> RoleNameMapper.mapRoleName(rd.getRecruitmentRole().name()) + "(" + rd.getRecruitmentCount() + ")")
.collect(Collectors.joining(", "));

Long commentCount = potCommentRepository.countByPotId(potId);

PotDetailResponseDto potDetailDto = potDetailConverter.toPotDetailResponseDto(pot.getUser(), pot, recruitmentDetails, isOwner, isApplied, null, commentCount);
PotDetailResponseDto potDetailDto = potDetailConverter.toPotDetailResponseDto(pot.getUser(), pot, recruitmentDetails, isOwner, isApplied, isSaved, commentCount);

List<PotApplicationResponseDto> applicants = Collections.emptyList();
if (isOwner && "RECRUITING".equals(pot.getPotStatus())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public List<PotMemberAppealResponseDto> addMembersToPot(Long potId, PotMemberReq
@Transactional
@Override
public void updateAppealContent(Long potId, String appealContent) {
String email = authService.getCurrentUserEmail();
User user = authService.getCurrentUser();

PotMember potMember = potMemberRepository.findByPot_PotIdAndUser_Email(potId, email)
PotMember potMember = potMemberRepository.findByPotPotIdAndUser(potId, user)
.orElseThrow(() -> new PotHandler(ErrorStatus.POT_MEMBER_NOT_FOUND));

potMember.setAppealContent(appealContent);
Expand Down