-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from CodingWasabi/feature-4/member
[FEAT] - 회원 정보 조회
- Loading branch information
Showing
8 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/main/java/com/codingwasabi/trti/domain/member/MemberService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
package com.codingwasabi.trti.domain.member; | ||
|
||
import com.codingwasabi.trti.domain.member.model.entity.Member; | ||
import com.codingwasabi.trti.domain.member.model.response.ResponseMyInfoDto; | ||
|
||
public interface MemberService { | ||
ResponseMyInfoDto getMemberInfo(Member member); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/com/codingwasabi/trti/domain/member/impl/MemberController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
package com.codingwasabi.trti.domain.member.impl; | ||
|
||
import com.codingwasabi.trti.config.auth.security.MemberAdaptor; | ||
import com.codingwasabi.trti.domain.member.MemberService; | ||
import com.codingwasabi.trti.domain.member.model.response.ResponseMyInfoDto; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/my") | ||
public class MemberController { | ||
private final MemberService memberService; | ||
|
||
@GetMapping("/info") | ||
public ResponseEntity<ResponseMyInfoDto> getMyInfo(@AuthenticationPrincipal MemberAdaptor memberAdaptor) { | ||
return ResponseEntity.ok() | ||
.body(memberService.getMemberInfo(memberAdaptor.getMember())); | ||
} | ||
} |
12 changes: 11 additions & 1 deletion
12
src/main/java/com/codingwasabi/trti/domain/member/impl/MemberServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
package com.codingwasabi.trti.domain.member.impl; | ||
|
||
public class MemberServiceImpl { | ||
import com.codingwasabi.trti.domain.member.MemberService; | ||
import com.codingwasabi.trti.domain.member.model.entity.Member; | ||
import com.codingwasabi.trti.domain.member.model.response.ResponseMyInfoDto; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class MemberServiceImpl implements MemberService { | ||
@Override | ||
public ResponseMyInfoDto getMemberInfo(Member member) { | ||
return ResponseMyInfoDto.getEntity(member); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...gwasabi/trti/domain/member/MemberAPI.java → ...er/model/enumValue/MemberAuthMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/com/codingwasabi/trti/domain/member/model/response/ResponseMyInfoDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.codingwasabi.trti.domain.member.model.response; | ||
|
||
import com.codingwasabi.trti.domain.member.model.entity.Member; | ||
import com.codingwasabi.trti.domain.member.model.enumValue.Gender; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
public class ResponseMyInfoDto { | ||
private Long id; | ||
private String nickname; | ||
private String email; | ||
private String image; | ||
private String ageRange; | ||
private Gender gender; | ||
|
||
public static ResponseMyInfoDto getEntity(Member member) { | ||
return ResponseMyInfoDto.builder() | ||
.id(member.getId()) | ||
.nickname(member.getNickname()) | ||
.email(member.getEmail()) | ||
.image(member.getImagePath()) | ||
.ageRange(member.getAgeRange()) | ||
.gender(member.getGender()) | ||
.build(); | ||
} | ||
} |