diff --git a/api/src/main/java/hexagonal/api/member/adapter/out/persistence/MemberPersistenceAdapter.java b/api/src/main/java/hexagonal/api/member/adapter/out/persistence/MemberPersistenceAdapter.java index 8f548c7..c1b58a6 100644 --- a/api/src/main/java/hexagonal/api/member/adapter/out/persistence/MemberPersistenceAdapter.java +++ b/api/src/main/java/hexagonal/api/member/adapter/out/persistence/MemberPersistenceAdapter.java @@ -2,6 +2,7 @@ import hexagonal.api.member.application.port.out.FindMemberPort; import hexagonal.api.member.application.port.out.SaveMemberPort; +import hexagonal.api.member.application.port.out.UpdateMemberPort; import hexagonal.core.domain.jpa.MemberJpaEntity; import hexagonal.core.repository.MemberRepository; import lombok.RequiredArgsConstructor; @@ -11,21 +12,31 @@ @RequiredArgsConstructor @Component -class MemberPersistenceAdapter implements FindMemberPort, SaveMemberPort { +class MemberPersistenceAdapter implements FindMemberPort, SaveMemberPort, UpdateMemberPort { private final MemberRepository memberRepository; @Override - public MemberJpaEntity findMember(String email) { - MemberJpaEntity member = memberRepository.findByEmail(email) + public MemberJpaEntity findMemberById(Long id) { + return memberRepository.findById(id) .orElseThrow(EntityNotFoundException::new); - return member; } + @Override + public MemberJpaEntity findMemberByEmail(String email) { + return memberRepository.findByEmail(email) + .orElseThrow(EntityNotFoundException::new); + } @Override public Long saveMember(MemberJpaEntity memberJpaEntity) { MemberJpaEntity saved = memberRepository.save(memberJpaEntity); return saved.getId(); } + + @Override + public Long updateMember(MemberJpaEntity memberJpaEntity) { + memberRepository.save(memberJpaEntity); + return null; + } } diff --git a/api/src/main/java/hexagonal/api/member/application/service/RegisterMemberService.java b/api/src/main/java/hexagonal/api/member/application/service/RegisterMemberService.java index eea9849..c17ec02 100644 --- a/api/src/main/java/hexagonal/api/member/application/service/RegisterMemberService.java +++ b/api/src/main/java/hexagonal/api/member/application/service/RegisterMemberService.java @@ -24,14 +24,12 @@ public Long registerMember(RegisterMemberCommand command) { } MemberJpaEntity memberJpaEntity = command.toJpaEntity(); // 모델 상태 조작 - Long memberId = saveMemberPort.saveMember(memberJpaEntity); - // 출력 값 반환 - return memberId; + return saveMemberPort.saveMember(memberJpaEntity); } private boolean checkMemberEmailExists(String email) { try { - findMemberPort.findMember(email); + findMemberPort.findMemberByEmail(email); } catch (EntityNotFoundException e) { return true; }