-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/#148 add change request fetch api #149
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ public record ChangeRequestResponseDTO( | |
| @JsonRawValue String newValue, | ||
| String reason, | ||
| Status status, | ||
| String adminComment, | ||
| AdminUserInfo requestedBy, | ||
| LocalDateTime createdAt | ||
| ) { | ||
|
|
@@ -30,6 +31,7 @@ public static ChangeRequestResponseDTO fromEntity(ChangeRequest changeRequest) { | |
| .newValue(changeRequest.getNewValue()) | ||
| .reason(changeRequest.getReason()) | ||
| .status(changeRequest.getStatus()) | ||
| .adminComment(changeRequest.getAdminComment()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 굿! |
||
| .requestedBy(AdminUserInfo.fromEntity(changeRequest.getRequestedBy())) | ||
| .createdAt(changeRequest.getCreatedAt()) | ||
| .build(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -64,4 +64,10 @@ public List<ChangeRequestResponseDTO> getChangeRequests() { | |||||||||||
| .map(ChangeRequestResponseDTO::fromEntity) | ||||||||||||
| .collect(Collectors.toList()); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 일단 페이징은 없이가구 제가 시간 되면 공통 페이징 메서드 추가해보겠습니다! |
||||||||||||
| public List<ChangeRequestResponseDTO> getAllChangeRequests() { | ||||||||||||
| return changeRequestRepository.findAll().stream() | ||||||||||||
|
Comment on lines
+68
to
+69
|
||||||||||||
| public List<ChangeRequestResponseDTO> getAllChangeRequests() { | |
| return changeRequestRepository.findAll().stream() | |
| public List<ChangeRequestResponseDTO> getAllChangeRequests(int page, int size) { | |
| return changeRequestRepository.findAll(org.springframework.data.domain.PageRequest.of(page, size)) | |
| .stream() |
Copilot
AI
Sep 29, 2025
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.
The new getAllChangeRequests() method duplicates the logic from the existing getChangeRequests() method. Consider extracting the common stream processing logic into a private helper method to reduce code duplication.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| package DGU_AI_LAB.admin_be.domain.requests.service; | ||
|
|
||
| import DGU_AI_LAB.admin_be.domain.portRequests.service.PortRequestService; | ||
| import DGU_AI_LAB.admin_be.domain.requests.dto.response.ChangeRequestResponseDTO; | ||
| import DGU_AI_LAB.admin_be.domain.requests.dto.response.ContainerInfoDTO; | ||
| import DGU_AI_LAB.admin_be.domain.requests.dto.response.PortMappingDTO; | ||
| import DGU_AI_LAB.admin_be.domain.requests.dto.response.ResourceUsageDTO; | ||
| import DGU_AI_LAB.admin_be.domain.requests.dto.response.SaveRequestResponseDTO; | ||
| import DGU_AI_LAB.admin_be.domain.requests.entity.Request; | ||
| import DGU_AI_LAB.admin_be.domain.requests.entity.Status; | ||
| import DGU_AI_LAB.admin_be.domain.requests.repository.ChangeRequestRepository; | ||
| import DGU_AI_LAB.admin_be.domain.requests.repository.RequestRepository; | ||
| import DGU_AI_LAB.admin_be.domain.users.repository.UserRepository; | ||
| import DGU_AI_LAB.admin_be.error.ErrorCode; | ||
|
|
@@ -25,6 +27,7 @@ | |
| public class RequestQueryService { | ||
|
|
||
| private final RequestRepository requestRepository; | ||
| private final ChangeRequestRepository changeRequestRepository; | ||
| private final UserRepository userRepository; | ||
| private final PortRequestService portRequestService; | ||
|
|
||
|
|
@@ -79,4 +82,14 @@ public List<SaveRequestResponseDTO> getApprovedRequestsByUserId(Long userId) { | |
| .toList(); | ||
| } | ||
|
|
||
| /** 내 변경 요청 목록 조회 */ | ||
| public List<ChangeRequestResponseDTO> getMyChangeRequests(Long userId) { | ||
| if (!userRepository.existsById(userId)) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 굿! |
||
| throw new BusinessException(ErrorCode.USER_NOT_FOUND); | ||
| } | ||
| return changeRequestRepository.findAllByRequestedBy_UserId(userId).stream() | ||
| .map(ChangeRequestResponseDTO::fromEntity) | ||
| .toList(); | ||
| } | ||
|
|
||
| } | ||
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.
/all 말고 될수있으면 그냥 /로만 가는 게 좋을 거 같아요!