-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/15: 회원 관리 기능 DB와 연동 #17
Conversation
KanuBang
commented
Jan 10, 2025
- 회원가입
- 프로필 조회
- 프로필 수정 위 기능을 DB와 연동했습니다.
- 회원가입 - 프로필 조회 - 프로필 수정 위 기능을 DB와 연동했습니다.
Quality Gate passedIssues Measures |
@@ -9,12 +9,16 @@ | |||
@Configuration | |||
@Profile("!test") | |||
public class WebMvcConfig implements WebMvcConfigurer { | |||
|
|||
/* |
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.
사용하지 않는 기능은 주석처리를 하지않고, 지우는 것이 좋은 것 같아요. 나중에 필요하면, 다시 넣으면 되지 않을까요? :-)
Member savedMember = memberService.addMember(memberForm); | ||
return ResponseEntity.status(201).body(savedMember); | ||
MemberDTO memberDTO = MemberDTO.createMemberDTO(savedMember); | ||
return ResponseEntity.status(201).body(memberDTO); |
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.
// 사용자 프로필 수정 | ||
@PutMapping("/{user_id}/edit") | ||
public ResponseEntity<Member> memberModify(@PathVariable(value = "user_id") Long user_id, @Valid @RequestBody MemberEditForm memberEditForm) { | ||
public ResponseEntity<MemberDTO> memberModify(@PathVariable(value = "user_id") Long user_id, @Valid @RequestBody MemberEditForm memberEditForm) { |
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.
경우에 따라 다를 수도 있지만, 이 컨트롤러에서는 DTO를 하나로 통일하는 것도 괜찮은 아이디어 같습니다.
@@ -11,23 +13,27 @@ | |||
@Slf4j | |||
@Repository | |||
public class MemberRepository { | |||
private ConcurrentHashMap<Long, Member> store = new ConcurrentHashMap<>(); | |||
|
|||
@PersistenceContext |
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를 안쓰는 이유가 특별히 있는 것인가요? 아니면, 아직 JPA는 공부중이라 다른 걸 먼저 시도해 보신건가요?
// 회원가입 | ||
public Member addMember(MemberForm memberForm){ | ||
return memberRepository.save(Member.createMember(memberForm)); | ||
@Transactional |
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.
save 할 때도 @transactional이 필요한 것인가요?
@@ -38,14 +48,21 @@ public Member findMember(Long user_id){ | |||
|
|||
// 사용자 프로필 수정 | |||
@PutMapping("/{user_id}/edit") |
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.
이 annotation은 여기에 적절하진 않은 것 같네요. :-)
private int following; | ||
private int point; | ||
|
||
public static MemberDTO createMemberDTO(Member member) { |
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.
MemberDTO를 생성하는 방법은 createMemberDTO인가요? Builder인가요?
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.
몇몇 코멘트를 달긴했습니다만, 전반적으로는 어떤 의도의 코드인지 알 수 있는 것 같아서, 좋은 것 같습니다. 고생하셨습니다! 👍