-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat : 유저등급별 페이지 및 관리자 페이지 API 설계(SJB-step2) #3
base: develop-SJB
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
살짝만 더 수정해보세요~
|
||
|
||
public List<Member> findMembers() { | ||
return memberRepository.findAll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어떤 추가적인 Validation 작업이 필요할 수도 있지 않을까요?
(데이터가 없다거나, 조회가 불가능한 권한이 있다거나...)
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface MemberRepository { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
개발하는 입장에서, 사실 메모리/JPA를 나눌 필요가 있나 싶어요.
이후 다른 스텝 할 때도 두개 다 하기 힘드니까, 그냥 하나만 하세요 ㅋㅋㅋ
return Arrays.stream(request.getCookies()) | ||
.filter(cookie -> cookie.getName().equals(cookieName)) | ||
.findAny() | ||
.orElse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어디에서는 Optional을 쓰고, 어디에서는 null을 쓰는데, 사실 하나로 로직을 통합하는게 나을 것 같아요.
|
||
//if-else문의 문제점 존재 -> 더 나은 방식 없을까? | ||
public String RoleDistributor(MEMBER_ROLE member_role) { | ||
if (member_role == MEMBER_ROLE.ROLE_ADMIN) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch 방식으로 변경하시거나, enum안에 property를 넣고 그 값을 반환하는 방식으로 처리해 주세요.
public String acceptRoleChange(@RequestParam("memberId") String memberId, | ||
@RequestParam("member_role") MEMBER_ROLE member_role) { | ||
System.out.println("memberId = " + memberId); | ||
System.out.println("member_role = " + member_role); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System.out.println 은 좋지 않아요.
로거로 바꿔주세요.
넵 확인했습니다! 감사합니다 ㅎㅎ |
Filter를 사용한 로그인 회원 체크 로직 리팩터링
RoleMypageController와 MEMER_ROLE enum domain을 통한 유저 등급별 접근 페이지 설계
Filter를 사용한 관리자 페이지 설정 및 관리자 페이지에서 유저 등급 권한 조작 가능
IntelliJ Actions On Save기능을 사용한 코드 스타일 정리