-
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.
- Loading branch information
Showing
3 changed files
with
31 additions
and
15 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
16 changes: 11 additions & 5 deletions
16
src/main/java/sungdong29/backend/domain/user/dto/response/TokenResponseDTO.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,18 +1,24 @@ | ||
package sungdong29.backend.domain.user.dto.response; | ||
|
||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class TokenResponseDTO { | ||
private Long id; | ||
private String token; | ||
|
||
@Builder | ||
private TokenResponseDTO(Long id, String token) { | ||
this.id=id; | ||
this.token=token; | ||
} | ||
|
||
public static TokenResponseDTO of(Long id, String token) { | ||
return new TokenResponseDTO(id, token); | ||
return TokenResponseDTO.builder() | ||
.id(id) | ||
.token(token) | ||
.build(); | ||
} | ||
} |
22 changes: 13 additions & 9 deletions
22
src/main/java/sungdong29/backend/domain/user/dto/response/UserResponseDTO.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,23 +1,27 @@ | ||
package sungdong29.backend.domain.user.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import sungdong29.backend.domain.user.domain.User; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class UserResponseDTO { | ||
private Long id; | ||
private String username; | ||
private String nickname; | ||
|
||
@Builder | ||
private UserResponseDTO(Long id, String username, String nickname) { | ||
this.id=id; | ||
this.username=username; | ||
this.nickname=nickname; | ||
} | ||
|
||
public static UserResponseDTO from(User user) { | ||
return new UserResponseDTO( | ||
user.getId(), | ||
user.getUsername(), | ||
user.getNickname() | ||
); | ||
return UserResponseDTO.builder() | ||
.id(user.getId()) | ||
.username(user.getUsername()) | ||
.nickname(user.getNickname()) | ||
.build(); | ||
} | ||
} |