From 7dcc9e1398ea0abef187044c53cb4b1b015d03fe Mon Sep 17 00:00:00 2001 From: 5jisoo <56earls@gmail.com> Date: Mon, 12 Feb 2024 23:22:42 +0900 Subject: [PATCH] #8 Fix: add member name --- .../dto/response/PrivateDeclarationElements.java | 8 +++++++- .../remine/declaration/service/DeclarationService.java | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gdsc/remine/declaration/dto/response/PrivateDeclarationElements.java b/src/main/java/com/gdsc/remine/declaration/dto/response/PrivateDeclarationElements.java index 96b8e6f..e9747ef 100644 --- a/src/main/java/com/gdsc/remine/declaration/dto/response/PrivateDeclarationElements.java +++ b/src/main/java/com/gdsc/remine/declaration/dto/response/PrivateDeclarationElements.java @@ -12,10 +12,12 @@ @NoArgsConstructor @AllArgsConstructor public class PrivateDeclarationElements { + private String memberName; private Long todayParticipantsCount; private List declarationList; public static PrivateDeclarationElements from( + String memberName, Long todayParticipantsCount, List declarationList ) { @@ -23,6 +25,10 @@ public static PrivateDeclarationElements from( PrivateDeclarationElement::new ).collect(Collectors.toList()); - return new PrivateDeclarationElements(todayParticipantsCount, declarationElementList); + return new PrivateDeclarationElements( + memberName, + todayParticipantsCount, + declarationElementList + ); } } diff --git a/src/main/java/com/gdsc/remine/declaration/service/DeclarationService.java b/src/main/java/com/gdsc/remine/declaration/service/DeclarationService.java index 2a5a75a..20e7d65 100644 --- a/src/main/java/com/gdsc/remine/declaration/service/DeclarationService.java +++ b/src/main/java/com/gdsc/remine/declaration/service/DeclarationService.java @@ -42,18 +42,19 @@ public PrivateDeclarationElement uploadDeclaration( } public PrivateDeclarationElements getDeclarationInWeek() { - final Long loginMemberId = authTokensGenerator.getLoginMemberId(); + final Member loginMember = authTokensGenerator.getLoginMember(); final LocalDateTime oneWeekAgo = getOneWeekAgoDate(); final List declarationList = declarationRepository.findInRecent7Day( oneWeekAgo, - loginMemberId + loginMember.getId() ); final LocalDateTime oneDayAgo = getOneDayAgoDate(); final Long count = declarationRepository.countInRecent1Day(oneDayAgo); return PrivateDeclarationElements.from( + loginMember.getName(), count, declarationList );