-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
내 정보 조회 API 구현
- Loading branch information
Showing
8 changed files
with
138 additions
and
19 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
23 changes: 20 additions & 3 deletions
23
src/main/java/com/ajou/hertz/domain/user/dto/response/UserResponse.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,35 +1,52 @@ | ||
package com.ajou.hertz.domain.user.dto.response; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
|
||
import com.ajou.hertz.domain.user.constant.Gender; | ||
import com.ajou.hertz.domain.user.dto.UserDto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
public class UserResponse { | ||
|
||
@Schema(description = "Id of user", example = "1") | ||
private Long id; | ||
|
||
@Schema(description = "이메일", example = "[email protected]") | ||
private String email; | ||
|
||
@Schema(description = "프로필 이미지 url", example = "https://user-profile-image") | ||
private String profileImageUrl; | ||
|
||
@Schema(description = "생년월일") | ||
private LocalDate birth; | ||
|
||
@Schema(description = "성별") | ||
private Gender gender; | ||
|
||
@Schema(description = "연락 수단") | ||
private String contactLink; | ||
|
||
@Schema(description = "계정 생성일자 (가입일)") | ||
private LocalDateTime createdAt; | ||
|
||
public static UserResponse from(UserDto userDto) { | ||
return new UserResponse( | ||
userDto.getId(), | ||
userDto.getEmail(), | ||
userDto.getProfileImageUrl(), | ||
userDto.getBirth(), | ||
userDto.getGender(), | ||
userDto.getContactLink() | ||
userDto.getContactLink(), | ||
userDto.getCreatedAt() | ||
); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/com/ajou/hertz/domain/user/dto/response/UserWithLinkedAccountInfoResponse.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,49 @@ | ||
package com.ajou.hertz.domain.user.dto.response; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
|
||
import org.springframework.util.StringUtils; | ||
|
||
import com.ajou.hertz.domain.user.constant.Gender; | ||
import com.ajou.hertz.domain.user.dto.UserDto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
public class UserWithLinkedAccountInfoResponse extends UserResponse { | ||
|
||
@Schema(description = "카카오 계정 연동 여부", example = "true") | ||
private Boolean isKakaoAccountLinked; | ||
|
||
private UserWithLinkedAccountInfoResponse( | ||
Long id, | ||
String email, | ||
String profileImageUrl, | ||
LocalDate birth, | ||
Gender gender, | ||
String contactLink, | ||
LocalDateTime createdAt, | ||
Boolean isKakaoAccountLinked | ||
) { | ||
super(id, email, profileImageUrl, birth, gender, contactLink, createdAt); | ||
this.isKakaoAccountLinked = isKakaoAccountLinked; | ||
} | ||
|
||
public static UserWithLinkedAccountInfoResponse from(UserDto userDto) { | ||
return new UserWithLinkedAccountInfoResponse( | ||
userDto.getId(), | ||
userDto.getEmail(), | ||
userDto.getProfileImageUrl(), | ||
userDto.getBirth(), | ||
userDto.getGender(), | ||
userDto.getContactLink(), | ||
userDto.getCreatedAt(), | ||
StringUtils.hasText(userDto.getKakaoUid()) | ||
); | ||
} | ||
} |
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
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