-
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.
Merge pull request #49 from IoTeaTime/refactor/48-kan-103-mapper
refactor: Mapper 구현, 프로필 설정 분리 등
- Loading branch information
Showing
23 changed files
with
183 additions
and
135 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/main/java/org/ioteatime/meonghanyangserver/auth/mapper/AuthEntityMapper.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,14 @@ | ||
package org.ioteatime.meonghanyangserver.auth.mapper; | ||
|
||
import org.ioteatime.meonghanyangserver.user.domain.UserEntity; | ||
import org.ioteatime.meonghanyangserver.user.dto.UserDto; | ||
|
||
public class AuthEntityMapper { | ||
public static UserEntity of(UserDto userDto, String encodedPassword) { | ||
return UserEntity.builder() | ||
.nickname(userDto.getNickname()) | ||
.email(userDto.getEmail()) | ||
.password(encodedPassword) | ||
.build(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/ioteatime/meonghanyangserver/auth/mapper/AuthResponseMapper.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,23 @@ | ||
package org.ioteatime.meonghanyangserver.auth.mapper; | ||
|
||
import org.ioteatime.meonghanyangserver.auth.dto.reponse.LoginResponse; | ||
import org.ioteatime.meonghanyangserver.auth.dto.reponse.RefreshResponse; | ||
import org.ioteatime.meonghanyangserver.user.dto.response.UserSimpleResponse; | ||
|
||
public class AuthResponseMapper { | ||
public static UserSimpleResponse from(Long id, String email) { | ||
return new UserSimpleResponse(id, email); | ||
} | ||
|
||
public static LoginResponse from(Long id, String accessToken, String refreshToken) { | ||
return LoginResponse.builder() | ||
.userId(id) | ||
.accessToken(accessToken) | ||
.refreshToken(refreshToken) | ||
.build(); | ||
} | ||
|
||
public static RefreshResponse from(String newAccessToken) { | ||
return new RefreshResponse(newAccessToken); | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...nyangserver/common/error/TypeCodeIfs.java → ...ghanyangserver/common/error/TypeCode.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
21 changes: 4 additions & 17 deletions
21
src/main/java/org/ioteatime/meonghanyangserver/common/exception/ApiException.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,22 +1,9 @@ | ||
package org.ioteatime.meonghanyangserver.common.exception; | ||
|
||
import lombok.Getter; | ||
import org.ioteatime.meonghanyangserver.common.error.TypeCodeIfs; | ||
import org.ioteatime.meonghanyangserver.common.error.TypeCode; | ||
|
||
@Getter | ||
public class ApiException extends RuntimeException implements ApiExceptionItf { | ||
private final TypeCodeIfs typeCodeIfs; | ||
private final String errorDescription; | ||
public interface ApiException { | ||
TypeCode getTypeCode(); | ||
|
||
public ApiException(TypeCodeIfs typeCodeIfs) { | ||
super(typeCodeIfs.getDescription()); | ||
this.typeCodeIfs = typeCodeIfs; | ||
this.errorDescription = typeCodeIfs.getDescription(); | ||
} | ||
|
||
public ApiException(TypeCodeIfs typeCodeIfs, String errorDescription) { | ||
super(errorDescription); | ||
this.typeCodeIfs = typeCodeIfs; | ||
this.errorDescription = errorDescription; | ||
} | ||
String getErrorDescription(); | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/org/ioteatime/meonghanyangserver/common/exception/ApiExceptionImpl.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,22 @@ | ||
package org.ioteatime.meonghanyangserver.common.exception; | ||
|
||
import lombok.Getter; | ||
import org.ioteatime.meonghanyangserver.common.error.TypeCode; | ||
|
||
@Getter | ||
public class ApiExceptionImpl extends RuntimeException implements ApiException { | ||
private final TypeCode typeCode; | ||
private final String errorDescription; | ||
|
||
public ApiExceptionImpl(TypeCode typeCode) { | ||
super(typeCode.getDescription()); | ||
this.typeCode = typeCode; | ||
this.errorDescription = typeCode.getDescription(); | ||
} | ||
|
||
public ApiExceptionImpl(TypeCode typeCode, String errorDescription) { | ||
super(errorDescription); | ||
this.typeCode = typeCode; | ||
this.errorDescription = errorDescription; | ||
} | ||
} |
9 changes: 0 additions & 9 deletions
9
src/main/java/org/ioteatime/meonghanyangserver/common/exception/ApiExceptionItf.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.