Skip to content

Commit

Permalink
[feat] 멤버 메일 id api 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
qogustj committed Jul 9, 2024
1 parent 14ca36e commit 7e1a809
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import com.Nunbody.domain.member.dto.SignInRequestDto;
import com.Nunbody.domain.member.dto.SignInResponseDto;
import com.Nunbody.domain.member.dto.ValidateRequestDto;
import com.Nunbody.domain.member.dto.res.MemberMailIdResDto;
import com.Nunbody.domain.member.service.MemberService;
import com.Nunbody.global.common.SuccessResponse;
import com.Nunbody.global.config.auth.MemberId;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/member")
Expand All @@ -21,6 +22,11 @@ public class MemberController {

private final MemberService memberService;

@GetMapping("/mailId")
public ResponseEntity<SuccessResponse<?>> getMemberMailId(@MemberId Long memberId) {
MemberMailIdResDto memberMailId = memberService.getMemberMailId(memberId);
return SuccessResponse.ok(memberMailId);
}

@PostMapping("/signup")
public ResponseEntity<SuccessResponse<?>> create(@RequestBody MemberRegisterRequestDto dto) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.Nunbody.domain.member.dto.res;

public record MemberMailIdResDto(
String GOOGLE,
String NAVER
) {
public static MemberMailIdResDto of(String GOOGLE, String NAVER){
return new MemberMailIdResDto(GOOGLE, NAVER);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.Nunbody.domain.member.domain.Member;
import com.Nunbody.domain.member.dto.MemberRegisterRequestDto;
import com.Nunbody.domain.member.dto.SignInResponseDto;
import com.Nunbody.domain.member.dto.res.MemberMailIdResDto;
import com.Nunbody.domain.member.repository.KeywordRepository;
import com.Nunbody.domain.member.repository.MemberRepository;
import com.Nunbody.global.common.EncoderDecoder;
Expand Down Expand Up @@ -35,8 +36,13 @@ public class MemberService {
private final JwtTokenProvider jwtTokenProvider;
private final PasswordEncoder passwordEncoder;
private final OAuthService oAuthService;
private final MemberReader memberReader;


public MemberMailIdResDto getMemberMailId(Long memberId){
Member member = memberReader.getMemberById(memberId);
return MemberMailIdResDto.of(member.getNaverId(), member.getGmailId());
}
public void register(MemberRegisterRequestDto resource) {

Member member;
Expand Down

0 comments on commit 7e1a809

Please sign in to comment.