-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: 에러 코드 추가 및 코드 이동 (단순 리팩토링) * ✨ 비 유효한 쿠키 삭제 로직 추가 * ✨ feat: 사용자 정보 획득 api 추가 * fix: path 경로에 /me 추가 * fix: 코드 리뷰 기반 수정
- Loading branch information
1 parent
9247186
commit e8623ae
Showing
14 changed files
with
100 additions
and
38 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
19 changes: 19 additions & 0 deletions
19
...nd/baguni-api/src/main/java/baguni/api/application/user/controller/dto/UserApiMapper.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,19 @@ | ||
package baguni.api.application.user.controller.dto; | ||
|
||
import org.mapstruct.InjectionStrategy; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.ReportingPolicy; | ||
|
||
import baguni.api.service.user.dto.UserInfo; | ||
|
||
@Mapper( | ||
componentModel = "spring", | ||
injectionStrategy = InjectionStrategy.CONSTRUCTOR, | ||
unmappedTargetPolicy = ReportingPolicy.ERROR | ||
) | ||
public interface UserApiMapper { | ||
|
||
@Mapping(expression = "java(userInfo.idToken().toString())", target = "idToken") | ||
UserInfoApiResponse toApiResponse(UserInfo userInfo); | ||
} |
20 changes: 20 additions & 0 deletions
20
...uni-api/src/main/java/baguni/api/application/user/controller/dto/UserInfoApiResponse.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,20 @@ | ||
package baguni.api.application.user.controller.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotEmpty; | ||
|
||
public record UserInfoApiResponse( | ||
|
||
@NotEmpty | ||
@Schema(description = "사용자 식별 토큰") | ||
String idToken, | ||
|
||
@NotEmpty | ||
@Schema(description = "사용자 이메일") | ||
String email, | ||
|
||
// Nullable | ||
@Schema(description = "사용자 이름") | ||
String name | ||
) { | ||
} |
4 changes: 3 additions & 1 deletion
4
backend/baguni-api/src/main/java/baguni/api/service/user/dto/UserInfo.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,13 +1,15 @@ | ||
package baguni.api.service.user.dto; | ||
|
||
import baguni.entity.model.user.User; | ||
import baguni.entity.model.util.IDToken; | ||
|
||
public record UserInfo( | ||
Long id, | ||
String name, | ||
IDToken idToken, | ||
String email | ||
) { | ||
public static UserInfo from(User user) { | ||
return new UserInfo(user.getId(), user.getNickname(), user.getEmail()); | ||
return new UserInfo(user.getId(), user.getNickname(), user.getIdToken(), user.getEmail()); | ||
} | ||
} |
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
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
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