Skip to content

Commit

Permalink
#8 Fix: add member name
Browse files Browse the repository at this point in the history
  • Loading branch information
5jisoo committed Feb 12, 2024
1 parent 3ff4ca6 commit 7dcc9e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@
@NoArgsConstructor
@AllArgsConstructor
public class PrivateDeclarationElements {
private String memberName;
private Long todayParticipantsCount;
private List<PrivateDeclarationElement> declarationList;

public static PrivateDeclarationElements from(
String memberName,
Long todayParticipantsCount,
List<Declaration> declarationList
) {
final List<PrivateDeclarationElement> declarationElementList = declarationList.stream().map(
PrivateDeclarationElement::new
).collect(Collectors.toList());

return new PrivateDeclarationElements(todayParticipantsCount, declarationElementList);
return new PrivateDeclarationElements(
memberName,
todayParticipantsCount,
declarationElementList
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Declaration> declarationList = declarationRepository.findInRecent7Day(
oneWeekAgo,
loginMemberId
loginMember.getId()
);

final LocalDateTime oneDayAgo = getOneDayAgoDate();
final Long count = declarationRepository.countInRecent1Day(oneDayAgo);

return PrivateDeclarationElements.from(
loginMember.getName(),
count,
declarationList
);
Expand Down

0 comments on commit 7dcc9e1

Please sign in to comment.