diff --git a/src/main/java/com/soptie/server/api/controller/MemberApi.java b/src/main/java/com/soptie/server/api/controller/MemberApi.java index bf7960e1..a55a0413 100644 --- a/src/main/java/com/soptie/server/api/controller/MemberApi.java +++ b/src/main/java/com/soptie/server/api/controller/MemberApi.java @@ -17,6 +17,7 @@ import com.soptie.server.api.controller.dto.response.SuccessResponse; import com.soptie.server.api.controller.dto.response.member.GetHomeInfoResponse; import com.soptie.server.api.controller.dto.response.member.GiveMemberCottonResponse; +import com.soptie.server.api.controller.dto.response.member.MemberProfileResponse; import com.soptie.server.api.controller.generic.SuccessMessage; import com.soptie.server.domain.member.CottonType; import com.soptie.server.domain.member.MemberService; @@ -60,4 +61,13 @@ public SuccessResponse getMemberHomeInfo(Principal principa val response = memberService.getMemberHomeInfo(memberId); return SuccessResponse.success(SuccessMessage.GET_MEMBER_HOME.getMessage(), response); } + + @ResponseStatus(HttpStatus.OK) + @GetMapping("/profile") + public SuccessResponse getMemberProfile(Principal principal) { + val memberId = Long.parseLong(principal.getName()); + val response = memberService.getMemberProfile(memberId); + return SuccessResponse.success(SuccessMessage.GET_MEMBER_PROFILE.getMessage(), response); + } + } diff --git a/src/main/java/com/soptie/server/api/controller/docs/MemberApiDocs.java b/src/main/java/com/soptie/server/api/controller/docs/MemberApiDocs.java index bfa8ed51..7fbba897 100644 --- a/src/main/java/com/soptie/server/api/controller/docs/MemberApiDocs.java +++ b/src/main/java/com/soptie/server/api/controller/docs/MemberApiDocs.java @@ -10,6 +10,7 @@ import com.soptie.server.api.controller.dto.response.SuccessResponse; import com.soptie.server.api.controller.dto.response.member.GetHomeInfoResponse; import com.soptie.server.api.controller.dto.response.member.GiveMemberCottonResponse; +import com.soptie.server.api.controller.dto.response.member.MemberProfileResponse; import com.soptie.server.domain.member.CottonType; import io.swagger.v3.oas.annotations.Operation; @@ -20,7 +21,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; -@Tag(name = "members", description = "회원 API") +@Tag(name = "[Member] 회원 API", description = "회원 관련 api 입니다.") public interface MemberApiDocs { @Operation( @@ -118,4 +119,22 @@ SuccessResponse giveCotton( SuccessResponse getMemberHomeInfo( @Parameter(hidden = true) Principal principal ); + + @Operation( + summary = "회원 정보 조회", + description = "회원의 정보를 조회합니다.", + responses = { + @ApiResponse(responseCode = "200", description = "성공"), + @ApiResponse( + responseCode = "4xx", + description = "클라이언트(요청) 오류", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)))} + ) + SuccessResponse getMemberProfile( + @Parameter(hidden = true) Principal principal + ); } diff --git a/src/main/java/com/soptie/server/api/controller/dto/response/member/MemberProfileResponse.java b/src/main/java/com/soptie/server/api/controller/dto/response/member/MemberProfileResponse.java new file mode 100644 index 00000000..3ca7f569 --- /dev/null +++ b/src/main/java/com/soptie/server/api/controller/dto/response/member/MemberProfileResponse.java @@ -0,0 +1,22 @@ +package com.soptie.server.api.controller.dto.response.member; + +import java.time.LocalDateTime; + +import com.soptie.server.domain.member.Member; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AccessLevel; +import lombok.Builder; + +@Builder(access = AccessLevel.PRIVATE) +public record MemberProfileResponse( + @Schema(description = "회원가입 일자", example = "2024-08-28T15:34:05.272309") + LocalDateTime createdAt +) { + + public static MemberProfileResponse from(Member member) { + return MemberProfileResponse.builder() + .createdAt(member.getCreatedAt()) + .build(); + } +} diff --git a/src/main/java/com/soptie/server/api/controller/generic/SuccessMessage.java b/src/main/java/com/soptie/server/api/controller/generic/SuccessMessage.java index 14e197a4..f6fb3bd5 100644 --- a/src/main/java/com/soptie/server/api/controller/generic/SuccessMessage.java +++ b/src/main/java/com/soptie/server/api/controller/generic/SuccessMessage.java @@ -14,6 +14,7 @@ public enum SuccessMessage { /* member */ CREATE_MEMBER_PROFILE("회원 프로필 등록 성공"), + GET_MEMBER_PROFILE("회원 프로필 조회 성공"), GIVE_COTTON("솜뭉치 주기 성공"), GET_MEMBER_HOME("홈화면 정보 조회 성공"), diff --git a/src/main/java/com/soptie/server/domain/member/Member.java b/src/main/java/com/soptie/server/domain/member/Member.java index d7875992..eb1f8e16 100644 --- a/src/main/java/com/soptie/server/domain/member/Member.java +++ b/src/main/java/com/soptie/server/domain/member/Member.java @@ -1,5 +1,7 @@ package com.soptie.server.domain.member; +import java.time.LocalDateTime; + import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -13,6 +15,7 @@ public class Member { private Social socialInfo; private String refreshToken; private MemberCotton cottonInfo; + private LocalDateTime createdAt; public Member(SocialType socialType, String socialId) { this.socialInfo = new Social(socialType, socialId); diff --git a/src/main/java/com/soptie/server/domain/member/MemberService.java b/src/main/java/com/soptie/server/domain/member/MemberService.java index 40cda857..036a6044 100644 --- a/src/main/java/com/soptie/server/domain/member/MemberService.java +++ b/src/main/java/com/soptie/server/domain/member/MemberService.java @@ -8,6 +8,7 @@ import com.soptie.server.api.controller.dto.request.member.CreateProfileRequest; import com.soptie.server.api.controller.dto.response.member.GetHomeInfoResponse; import com.soptie.server.api.controller.dto.response.member.GiveMemberCottonResponse; +import com.soptie.server.api.controller.dto.response.member.MemberProfileResponse; import com.soptie.server.common.exception.ExceptionCode; import com.soptie.server.common.exception.SoftieException; import com.soptie.server.domain.conversation.Conversation; @@ -77,4 +78,9 @@ private void createMemberDoll(long memberId, DollType dollType, String name) { memberDollAdapter.save(new MemberDoll(name, dollType, memberId, doll.getId())); } } + + public MemberProfileResponse getMemberProfile(long memberId) { + val member = memberAdapter.findById(memberId); + return MemberProfileResponse.from(member); + } } diff --git a/src/main/java/com/soptie/server/persistence/entity/MemberEntity.java b/src/main/java/com/soptie/server/persistence/entity/MemberEntity.java index fcd0854b..677085da 100644 --- a/src/main/java/com/soptie/server/persistence/entity/MemberEntity.java +++ b/src/main/java/com/soptie/server/persistence/entity/MemberEntity.java @@ -56,6 +56,7 @@ public Member toDomain() { .socialInfo(toSocialInfo()) .refreshToken(this.refreshToken) .cottonInfo(toCottonInfo()) + .createdAt(this.createdAt) .build(); }