Skip to content

Commit

Permalink
[STYLE] 코드 정리 및 고칠 코드 주석 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
happyjamy committed Mar 20, 2024
1 parent 74abc12 commit a92ba80
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public ResponseEntity<CursorPaginationResult<ProjectInfoAPIRes>> getProjectsByCr
.body(projectService.getByCreatorId(userId, creatorId, pageable));
}

@GetMapping("{projectId}/{id}")
// TODO: 유저 id 따로 받는 이유?
@GetMapping("/{projectId}/{id}")
public ResponseEntity<ProjectDetailAPIRes> getById(
@UserId Long userId, @PathVariable Long projectId, @PathVariable Long id
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ public Long accept(Long userId, Long projectRequestId) {
// TODO: 로그 처리
}

// TODO: 무한 대기로 인해 Batch로 일괄 거절 처리되는 경우, 이벤트 발행 어떻게 할 것인지?
List<ProjectJoinRequest> rejectedList = projectJoinRequestRepository
.findRejectedRequestByProjectId(projectJoinRequest.getProject().getId());

fcmNotificationService.sendNotification(projectJoinRequest.getSender().getId(),
MATCHING_SUCCESS_MESSAGE.getTitle(), MATCHING_SUCCESS_MESSAGE.getMessage(),
MATCHING_SUCCEEDED);
Expand All @@ -114,16 +110,6 @@ public Long accept(Long userId, Long projectRequestId) {
return matchingId;
}

private void cancelMyPendingProjectJoinRequest(User sender) {
projectJoinRequestRepository.findPendingBySenderId(sender.getId())
.ifPresent(pendingProjectJoinRequest -> pendingProjectJoinRequest.cancel(sender));
}

private ProjectJoinRequest getProjectJoinRequestWithProject(Long projectRequestId) {
return projectJoinRequestRepository.findByIdWithProject(projectRequestId)
.orElseThrow(() -> new ProjectJoinRequestException(PROJECT_JOIN_REQUEST_NOT_FOUND));
}

public CursorPaginationResult<ProjectJoinRequestDetailAPIRes> getBySenderIdWithPagination(
Long userId, Long senderId, CursorPaginationInfoReq pageable
) {
Expand All @@ -136,6 +122,16 @@ public CursorPaginationResult<ProjectJoinRequestDetailAPIRes> getBySenderIdWithP
);
}

private void cancelMyPendingProjectJoinRequest(User sender) {
projectJoinRequestRepository.findPendingBySenderId(sender.getId())
.ifPresent(pendingProjectJoinRequest -> pendingProjectJoinRequest.cancel(sender));
}

private ProjectJoinRequest getProjectJoinRequestWithProject(Long projectRequestId) {
return projectJoinRequestRepository.findByIdWithProject(projectRequestId)
.orElseThrow(() -> new ProjectJoinRequestException(PROJECT_JOIN_REQUEST_NOT_FOUND));
}

private User validateToken(Long userId) {
return userRepository.findById(userId)
.orElseThrow(() -> new UserException(USER_NOT_FOUND));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class ProjectJoinRequestRepositoryCustomImpl implements ProjectJoinReques
public CursorPaginationResult<ProjectJoinRequestRes> findByConditionWithPagination(
Long senderId, Long projectId, RequestStatus requestStatus, CursorPaginationInfoReq pageable
) {
// 배치 사이즈가 작동하지 않는 이슈로 인해 주석 처리
// List<projectJoinRequestRes> result = jpaQueryFactory.select(
// Projections.constructor(
// projectJoinRequestRes.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ProjectJoinRequestDetailAPIRes {
@NotNull
private final Long projectId;

// TODO: creatorAvatorUrl -> creatorAvatarUrl
@Schema(description = "프로젝트 생성자 아바타 URL", example = "https://avatars.githubusercontent.com/u/85854384?v=4")
private final String creatorAvatorUrl;

Expand Down

0 comments on commit a92ba80

Please sign in to comment.