Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public GroupCodeResponse createGroup(User user, CreateGroupRequest request, Mult
);

saveGroupImage(profileImage, group);
log.info("success to save study group");
log.info("success to save study group user_id={}", user.getId());
return new GroupCodeResponse(inviteCode);
}

Expand Down Expand Up @@ -154,7 +154,7 @@ public GetGroupIdResponse joinGroupWithCode(User user, String code) {
);

sendNewMemberNotification(studyGroup, member);
log.info("success to join study group");
log.info("success to join study group user_id={} code = {} ", user.getId(), code);

return new GetGroupIdResponse(studyGroup.getId());

Expand All @@ -175,7 +175,7 @@ public void deleteGroup(User user, Long groupId) {

deleteAllAboutGroup(group);

log.info("success to delete study group");
log.info("success to delete study group user_id={}, group_id={}", user.getId(), groupId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런건 target user가 더 중요할까요 아님 탈퇴 시킨 user id가 더 중요할까요?
저는 target user도 들가면 좋긴 할 것 같은데 나중에 하시죠

}

private void deleteAllAboutGroup(StudyGroup group) {
Expand Down Expand Up @@ -216,7 +216,7 @@ public void exitGroup(User user, Long groupId) {
}
}

log.info("success to exit study group");
log.info("success to exit study group user_id = {} , group_id = {}", user.getId(), groupId);
}

@Transactional
Expand All @@ -237,6 +237,7 @@ public void deleteMember(User user, Long userId, Long groupId) {
() -> new GroupMemberValidationException(HttpStatus.BAD_REQUEST.value(), "이미 참여하지 않은 회원입니다."));

studyGroupServiceProvider.getObject().deleteMemberFromStudyGroup(user, groupMember, group);
log.info("success to delete member user_id={} , group_id = {}", user.getId(), groupId);
} else {
throw new UserValidationException("멤버를 삭제 할 권한이 없습니다.");
}
Expand All @@ -250,7 +251,7 @@ public void deleteMemberFromStudyGroup(User user, GroupMember groupMember, Study
solutionRepository.deleteAllByStudyGroupAndUser(studyGroup, user);
noticeReadRepository.deleteAllByStudyGroupAndUser(studyGroup, user);
groupMemberRepository.delete(groupMember);
log.info("success to delete group member");
log.info("success to delete group member user_id = {}, group_id = {}", user.getId(), studyGroup.getId());
}

@Transactional(readOnly = true)
Expand Down Expand Up @@ -336,7 +337,7 @@ public void editGroup(User user, Long groupId, EditGroupRequest request, Multipa
if (request.introduction() != null && !request.introduction().isEmpty())
group.editGroupIntroduction(request.introduction());

log.info("success to edit group info");
log.info("success to edit group info user_id={} , group_id = {}", user.getId(), groupId);
}

private void editGroupImage(MultipartFile inputImage, StudyGroup group, Boolean isDefaultImage) {
Expand Down Expand Up @@ -534,7 +535,7 @@ public void updateGroupMemberRole(User user, Long groupId, UpdateGroupMemberRole
if (RoleOfGroupMember.isOwner(member) && request.role() != null) {
owner.updateRole(RoleOfGroupMember.PARTICIPANT);
}
log.info("success to update group member role");
log.info("success to update group member role user_id={} , group_id = {}", user.getId(), group.getId());
}

@Transactional(readOnly = true)
Expand All @@ -556,7 +557,7 @@ public void editStudyGroupVisibility(User user, Long groupId, EditGroupVisibilit
GroupMember member = groupMemberRepository.findByUserAndStudyGroup(user, group)
.orElseThrow(() -> new GroupMemberValidationException(HttpStatus.FORBIDDEN.value(), "참여하지 않은 그룹입니다."));
member.updateVisibility(request.isVisible());
log.info("success to update group visibility ( userId : {} )", user.getId());
log.info("success to update group visibility user_id = {}, group_id = {}", user.getId(), groupId);
}

@Transactional(readOnly = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public void createComment(User user, Long noticeId, CreateNoticeCommentRequest r
.content(request.content())
.build());

log.info("success to create notice comment. commentId: {}, noticeId: {}", comment.getId(), notice.getId());
log.info("success to create notice comment. comment_id = {}, notice_id = {}", comment.getId(), notice.getId());
}

@Override
@Transactional(readOnly = true)
public List<GetCommentResponse> getCommentList(User user, Long noticeId) {
Notice notice = validateNotice(user, noticeId);
List<NoticeComment> notices = noticeCommentRepository.findAllByNotice(notice);
log.info("success to get notice comment list. noticeId: {}", noticeId);
log.info("success to get notice comment list. notice_id = {}", noticeId);
return notices.stream().map(GetCommentResponse::toDTO).sorted(Comparator.comparing(
GetCommentResponse::createdAt).reversed()).toList();
}
Expand All @@ -70,10 +70,10 @@ public void updateComment(User user, Long commentId, UpdateCommentRequest reques
if (!comment.getUser().getId().equals(user.getId()))
throw new UserValidationException("댓글 작성자만 수정할 수 있습니다.");

if(request.content()!=null){
if (request.content() != null) {
comment.updateComment(request.content());
}
log.info("success to update notice comment. commentId: {}", comment.getId());
log.info("success to update notice comment. comment_id = {}", comment.getId());

}

Expand All @@ -88,7 +88,7 @@ public void deleteComment(User user, Long commentId) {

validateNotice(user, comment.getNotice().getId());
noticeCommentRepository.delete(comment);
log.info("success to delete notice comment. commentId: {}", commentId);
log.info("success to delete notice comment. comment_id = {}", commentId);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public CreateNoticeResponse createNotice(@AuthedUser User user, Long groupId, Cr
.category(request.category())
.createdAt(LocalDateTime.now())
.build());
log.info("success to create notice");
log.info("success to create notice user_id={} , group_id = {}", user.getId(), groupId);
return new CreateNoticeResponse(notice.getId());
}

Expand Down Expand Up @@ -98,7 +98,7 @@ public void markNoticeAsRead(@AuthedUser User user, Long noticeId) {
NoticeRead.builder().notice(notice).user(user).build()
);
}
log.info("success to read notice. userId: {}, noticeId: {}", user.getId(), notice.getId());
log.info("success to read notice. user_id = {}, notice_id = {}", user.getId(), notice.getId());
}

@Transactional(readOnly = true)
Expand Down Expand Up @@ -131,7 +131,7 @@ public void updateNotice(User user, Long noticeId, UpdateNoticeRequest request)
if (request.category() != null) {
notice.updateCategory(request.category());
}
log.info("success to update notice");
log.info("success to update notice user_id={} , notice_id = {}", user.getId(), noticeId);
}

@Transactional
Expand All @@ -147,7 +147,7 @@ public void deleteNotice(User user, Long noticeId) {
noticeReadRepository.deleteAllByNotice(notice);
noticeRepository.delete(notice);

log.info("success to delete notice. userId: {}, noticeId: {}", user.getId(), noticeId);
log.info("success to delete notice. user_id = {}, notice_id = {}", user.getId(), noticeId);
}

private void validateStudyGroupExists(Notice notice) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void readNotification(User user, Long notificationId) {
if (!notification.getUser().getId().equals(user.getId()))
throw new NotificationValidationException(HttpStatus.FORBIDDEN.value(), "알림의 주인이 일치하지 않습니다.");
notification.updateIsRead();
log.info("success to read notification. notificationId : {}", notificationId);
log.info("success to read notification. notification_id = {}", notificationId);
}

@Transactional
Expand All @@ -193,7 +193,7 @@ public void sendNotificationToMembers(StudyGroup group, List<GroupMember> receiv
for (GroupMember member : receiver) {
NotificationSetting setting = notificationSettingRepository.findByMember(member)
.orElseThrow(() -> {
log.error("cannot find notification setting for member. userId : {}, groupId : {}",
log.error("cannot find notification setting for member. user_id = {}, group_id =g {}",
member.getUser().getId(), group.getId());
return new CannotFoundNotificationSettingException("해당 그룹에 가입 되지 않은 유저입니다.");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public void editNotificationSettings(User user, EditNotificationSettingRequest r
request.deadlineReached()
);

log.info("success to edit notification settings");
log.info("success to edit notification settings user_id = {}", user.getId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void createProblem(User user, Long groupId, CreateProblemRequest request)
NotificationCategory.PROBLEM_STARTED.getMessage(title)
);

log.info("success to create problem");
log.info("success to create problem user_id={} , group_id = {}", user.getId(), groupId);
}

@Transactional
Expand All @@ -118,7 +118,7 @@ public void editProblem(User user, Long problemId, EditProblemRequest request) {
problem.editProblemEndDate(request.endDate());
}

log.info("success to edit problem deadline");
log.info("success to edit problem deadline user_id={} , problem_id = {}", user.getId(), problemId);
}

private void checkProblemValidation(Problem problem) {
Expand Down Expand Up @@ -212,7 +212,7 @@ public void deleteProblem(User user, Long problemId) {

solutionRepository.deleteAllByProblem(problem);
problemRepository.delete(problem);
log.info("success to delete problem");
log.info("success to delete problem user_id={} , problem_id = {}", user.getId(), problemId);
}

@Transactional(readOnly = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void createComment(User user, Long solutionId, CreateSolutionCommentReque
.build());

sendCommentNotification(user, solution);
log.info("success to create solution comment. commentId: {}, solutionId: {}", comment.getId(),
log.info("success to create solution comment. comment_id = {}, solution_id = {}", comment.getId(),
solution.getId());
}

Expand Down Expand Up @@ -88,7 +88,7 @@ public List<GetCommentResponse> getCommentList(User user, Long solutionId) {
}
List<GetCommentResponse> result = list.stream().map(GetCommentResponse::toDTO)
.sorted((s1, s2) -> s2.createdAt().compareTo(s1.createdAt())).toList();
log.info("success to get solution comment list. solutionId: {}", solutionId);
log.info("success to get solution comment list. solution_id = {} , user_id = {}", solutionId, user.getId());
return result;
}

Expand All @@ -101,7 +101,7 @@ public void updateComment(User user, Long commentId, UpdateCommentRequest reques
throw new UserValidationException("댓글 작성자가 아닙니다.");

comment.updateComment(request.content());
log.info("success to update solution comment. commentId: {}", commentId);
log.info("success to update solution comment. comment_id = {}, user_id = {}", commentId, user.getId());
}

@Override
Expand All @@ -114,7 +114,7 @@ public void deleteComment(User user, Long commentId) {

checkSolutionValidation(user, comment.getSolution().getId());
commentRepository.delete(comment);
log.info("success to delete solution comment. commentId: {}", commentId);
log.info("success to delete solution comment. comment_id = {}, user_id = {}", commentId, user.getId());
}

private Solution checkSolutionValidation(User user, Long solutionId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public void createSolution(CreateSolutionRequest request) {

sendNewSolutionNotification(studyGroup, member.get(), problem);
}
log.info("success to create solution user_id={}.", user.getId());
}

private void sendNewSolutionNotification(StudyGroup group, GroupMember solver, Problem problem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void register(RegisterRequest request, MultipartFile profileImage) {
.build());

saveProfileImage(profileImage, user);
log.info("success to register");
log.info("success to register user_id={}", user.getId());
}

private void saveProfileImage(MultipartFile profileImage, User user) {
Expand All @@ -113,7 +113,7 @@ public TokenResponse signIn(SignInRequest request) {
throw new UncorrectedPasswordException("비밀번호가 틀렸습니다.");
}
JwtDTO result = tokenProvider.generateTokens(authenticate);
log.info("success to sign in");
log.info("success to sign in identifier = {}", request.identifier());
return new TokenResponse(result.getAccessToken(), result.getRefreshToken());
}

Expand All @@ -139,7 +139,7 @@ public void userUpdate(User user, UpdateUserRequest updateUserRequest, Multipart
}

userRepository.save(user);
log.info("success to update user");
log.info("success to update user user_id={}", user.getId());
}

private void editUserProfileImage(User user, MultipartFile inputImage, Boolean isDefaultImage) {
Expand All @@ -148,7 +148,6 @@ private void editUserProfileImage(User user, MultipartFile inputImage, Boolean i
imageService.deleteImage(user.getProfileImage());
}
saveProfileImage(inputImage, user);
log.info("success to update user profile image. profile image : {}", user.getProfileImage());
return;
}
if (isDefaultImage) {
Expand Down Expand Up @@ -179,6 +178,7 @@ public void deleteUser(User user, DeleteUserRequest deleteUserRequest) {
throw new UncorrectedPasswordException("비밀번호가 틀렸습니다.");
}
userRepository.delete(user);
log.info("success to delete user user_id={}", user.getId());
}

@Transactional
Expand All @@ -199,6 +199,7 @@ public void editPassword(User user, EditUserPasswordRequest request) {
user.editPassword(encodedPassword);

userRepository.save(user);
log.info("success to edit password user_id={}", user.getId());
}

@Transactional(readOnly = true)
Expand All @@ -222,13 +223,14 @@ public void checkBjNickname(String bjNickname) {
log.error("BOJ server error occurred : " + e.getMessage());
throw new BOJServerErrorException("현재 백준 서버 오류가 발생했습니다. 잠시 후 다시 시도해주세요.");
}
log.info("success to check baekjoon nickname validity");
log.info("success to check baekjoon nickname validity nickname={}", bjNickname);
}

@Transactional(readOnly = true)
public void checkEmailDuplication(String email) {
if (userRepository.existsByEmail(email))
throw new UserValidationException("이미 사용 중인 이메일 입니다.");
log.info("success to validity email = {}", email);
}

@Transactional(readOnly = true)
Expand All @@ -243,7 +245,7 @@ public void checkNickname(String nickname) {
if (userRepository.existsByNickname(nickname))
throw new CheckNicknameValidationException(HttpStatus.CONFLICT.value(), "이미 사용 중인 닉네임입니다.");

log.info("success to check nickname validity");
log.info("success to check nickname validity nickname={}", nickname);
}

@Transactional(readOnly = true)
Expand Down Expand Up @@ -284,7 +286,7 @@ public void sendResetPasswordMail(String email) {
log.info("success to create reset password token. Token: {}", resetPassword.getToken());

emailService.sendResetPasswordMail(user.getEmail(), token).thenAccept(unused ->
log.info("success to send reset password mail.")
log.info("success to send reset password mail. mail = {}", email)
);
}

Expand Down