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

Feature/15: 회원 관리 기능 DB와 연동 #17

Merged
merged 1 commit into from
Jan 14, 2025
Merged

Feature/15: 회원 관리 기능 DB와 연동 #17

merged 1 commit into from
Jan 14, 2025

Conversation

KanuBang
Copy link
Collaborator

  • 회원가입
  • 프로필 조회
  • 프로필 수정 위 기능을 DB와 연동했습니다.

- 회원가입
- 프로필 조회
- 프로필 수정
위 기능을 DB와 연동했습니다.
@@ -9,12 +9,16 @@
@Configuration
@Profile("!test")
public class WebMvcConfig implements WebMvcConfigurer {

/*
Copy link
Collaborator

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);
Copy link
Collaborator

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) {
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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")
Copy link
Collaborator

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

MemberDTO를 생성하는 방법은 createMemberDTO인가요? Builder인가요?

Copy link
Collaborator

@f-lab-lyan f-lab-lyan left a comment

Choose a reason for hiding this comment

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

몇몇 코멘트를 달긴했습니다만, 전반적으로는 어떤 의도의 코드인지 알 수 있는 것 같아서, 좋은 것 같습니다. 고생하셨습니다! 👍

@KanuBang KanuBang changed the base branch from feature/13 to main January 14, 2025 06:45
@KanuBang KanuBang merged commit 5fcad63 into main Jan 14, 2025
3 checks passed
KanuBang added a commit that referenced this pull request Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants