-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 선택한 구역에 대한 프로젝트, 프로필 카드 리스트 랜덤 조회 API, 프로젝트 매칭 요청 생성 API 개발 #92
Conversation
…jectTag와의 조인 로직 추가
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit c012a47. ♻️ This comment has been updated with latest results. |
…pen-Eye-Im-Developer/MoGakGo-BE into feat/#30-cards_list_up_by_zone
…into feat/#30-cards_list_up_by_zone # Conflicts: # src/main/java/io/oeid/mogakgo/domain/project_join_req/infrastructure/ProjectJoinRequestJpaRepository.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰 확인해주세요!
@@ -12,7 +12,7 @@ | |||
|
|||
@Schema(description = "회원 프로필 조회 응답") | |||
@Getter | |||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | |||
@AllArgsConstructor(access = AccessLevel.PUBLIC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AllArgsConstructor(access = AccessLevel.PUBLIC) | |
@AllArgsConstructor |
@UserId Long userId, @Valid @RequestBody ProjectJoinCreateReq request | ||
) { | ||
return ResponseEntity.status(201) | ||
.body(ProjectJoinRequestAPIRes.from(projectJoinRequestService.create(userId, request))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엔터가 두개?!
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/project-join-request") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
project-join-request 보다 project/join-request는 어떨까요?
private User validateToken(Long userId) { | ||
return userRepository.findById(userId) | ||
.orElseThrow(() -> new UserException(USER_NOT_FOUND)); | ||
} | ||
|
||
private void validateSender(User tokenUser, Long userId) { | ||
if (!tokenUser.getId().equals(userId)) { | ||
throw new ProjectJoinRequestException(PROJECT_JOIN_REQUEST_FORBIDDEN_OPERATION); | ||
} | ||
} | ||
|
||
private Project validateProjectExist(Long projectId) { | ||
return projectRepository.findById(projectId) | ||
.orElseThrow(() -> new ProjectException(PROJECT_NOT_FOUND)); | ||
} | ||
|
||
private void validateProjectCreator(Project project, Long userId) { | ||
if (project.getCreator().getId().equals(userId)) { | ||
throw new ProjectJoinRequestException(PROJECT_JOIN_REQUEST_FORBIDDEN_OPERATION); | ||
} | ||
} | ||
|
||
private void validateAlreadyExistRequest(Long userId, Long projectId) { | ||
if (projectJoinRequestRepository.findAlreadyExists(userId, projectId).isPresent()) { | ||
throw new ProjectJoinRequestException(PROJECT_JOIN_REQUEST_ALREADY_EXIST); | ||
} | ||
} | ||
|
||
private void validateUserCertRegion(Project project, User tokenUser) { | ||
if (!tokenUser.getRegion().equals(project.getCreatorInfo().getRegion())) { | ||
throw new ProjectJoinRequestException(INVALID_PROJECT_JOIN_REQUEST_REGION); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나중에 유틸로 빼거나 하면 좋을 것 같아요! 👍🏻
private final MeetingInfoResponse meetingInfo; | ||
|
||
|
||
public ProjectDetailAPIRes(Long projectId, UserPublicApiResponse creator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
퍼블릭으로 따로 사용할 이유가 있을까요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QueryDsl에서 Projections.constructor를 사용해서 바인딩받을 때 생성자를 사용하기 때문에 public으로 열어두어야 해서 이렇게 작성했습니다!
@Schema(description = "프로젝트 만남 장소", example = "맥심플랜트 이태원점") | ||
private final String meetDetail; | ||
|
||
public MeetingInfoResponse(LocalDateTime meetStartTime, LocalDateTime meetEndTime, String meetDetail) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
밑에 팩토리 메서드가 있는데 퍼블릭으로 있는 이유가 궁금해요!
// 요청할 때마다 랜덤 정렬 | ||
Collections.shuffle(projects.getData()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
@Valid @ModelAttribute CursorPaginationInfoReq pageable | ||
) { | ||
return ResponseEntity.ok().body( | ||
profileCardService.getRandomOrderedProfileCardsByRegion(userId, region, pageable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엔터가 두번 눌린 것 같습니다!
🚀 개발 사항
이슈 번호
특이 사항 🫶