Skip to content
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

refactor: 어드민 유저 리팩토링 #1068

Merged
merged 11 commits into from
Nov 25, 2024

Conversation

kwoo28
Copy link
Contributor

@kwoo28 kwoo28 commented Nov 20, 2024

🔥 연관 이슈

🚀 작업 내용

  1. 유저패키지를 학생과 사장님 패키지로 분리했습니다.

💬 리뷰 중점사항

@github-actions github-actions bot added the 리팩터링 리팩터링을 위한 이슈입니다 label Nov 20, 2024
Copy link
Contributor

@Soundbar91 Soundbar91 left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다.
혹시 테스트 코드는 따로 작업을 진행하시지 않으신건가요 ?? 관련해서 진행하면 좋을 것 같아요 !
코멘트 남겼습니당

Copy link
Contributor

@duehee duehee left a comment

Choose a reason for hiding this comment

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

관규님이 꼼꼼히 잘 해주셔서 저는 간단한 거 정리해봤어요~!
고생하셨습니다!

@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true))),
}
)
@Operation(summary = "회원 정보 수정")
Copy link
Contributor

Choose a reason for hiding this comment

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

A

간단한 거긴한데, 학생 정보 수정으로 하면 좋을 거 같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오,, 그부분을 캐치하시다니

Comment on lines +49 to +59
@Transactional
public AdminStudentUpdateResponse updateStudent(Integer id, AdminStudentUpdateRequest adminRequest) {
Student student = adminStudentRepository.getById(id);
User user = student.getUser();
validateNicknameDuplication(adminRequest.nickname(), id);
validateDepartmentValid(adminRequest.major());
user.update(adminRequest.nickname(), adminRequest.name(),
adminRequest.phoneNumber(), UserGender.from(adminRequest.gender()));
user.updateStudentPassword(passwordEncoder, adminRequest.password());
student.update(adminRequest.studentNumber(), adminRequest.major());
adminStudentRepository.save(student);
Copy link
Contributor

Choose a reason for hiding this comment

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

A

제가 이번에 User와 Student를 수정하면서, 메소드 수정할 사항이 좀 생겼어요!!! 리팩토링 끝나고 한 번 다시 정리해도 될까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵!

Comment on lines +63 to +76

private void validateNicknameDuplication(String nickname, Integer userId) {
if (nickname != null &&
adminUserRepository.existsByNicknameAndIdNot(nickname, userId)) {
throw DuplicationNicknameException.withDetail("nickname : " + nickname);
}
}

private void validateDepartmentValid(String department) {
if (department != null && !StudentDepartment.isValid(department)) {
throw StudentDepartmentNotValidException.withDetail("학부(학과) : " + department);
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

A

이번에 User팀에서는 ValidationService를 분리했는데, 어떻게 생각하시나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하겠습니다!

@@ -26,10 +26,10 @@

import in.koreatech.koin.AcceptanceTest;
import in.koreatech.koin.admin.user.model.Admin;
import in.koreatech.koin.admin.user.repository.AdminOwnerRepository;
import in.koreatech.koin.admin.user.repository.AdminOwnerShopRedisRepository;
import in.koreatech.koin.admin.owner.repository.AdminOwnerRepository;
Copy link
Contributor

Choose a reason for hiding this comment

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

C

테스트 관련 수정 소요는 없으셨나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

깜빡했습니다..ㅎ 수정하겠습니다

@kwoo28 kwoo28 merged commit 109de38 into refactor/1006-user-team-refactor Nov 25, 2024
1 check passed
@kwoo28 kwoo28 deleted the refactor/1051-user-admin branch November 25, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
리팩터링 리팩터링을 위한 이슈입니다
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants