Skip to content

Commit

Permalink
feat: requestInfo에 senderId 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kmer1024 committed Dec 10, 2024
1 parent 44349a9 commit 0ea0ec4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public record RequestInfoResponse(
List<String> receivers,
String sender,
String title,
String content
String content,
Boolean isSender
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public RequestNumberResponse getNumberOfRequests(Long userId) {
public RequestInfoResponse getRequestInfo(Long requestId, Long userId) {
requestReceiveRepository.updateReadOrNot(requestId, userId);

User tempUser = userRepository.findById(userId)
.orElseThrow(() -> new RuntimeException("User Not Found"));

List<Object[]> results = requestRepository.getRequestInfo(requestId);

Object[] result = results.get(0);
Expand All @@ -54,6 +57,10 @@ public RequestInfoResponse getRequestInfo(Long requestId, Long userId) {

List<String> receivers = Arrays.asList(receiverNames.split(","));
Long id = (Long)result[8];
Boolean isSender = false;
if (tempUser.getName().equals(senderName)) {
isSender = true;
}
return RequestInfoResponse.builder()
.id(id)
.project(projectName)
Expand All @@ -64,6 +71,7 @@ public RequestInfoResponse getRequestInfo(Long requestId, Long userId) {
.endDate(endDate)
.receivers(receivers)
.sender(senderName)
.isSender(isSender)
.build();
}

Expand Down

0 comments on commit 0ea0ec4

Please sign in to comment.