-
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.
글쓴이가 ADMIN일경우만 글 작성 가능, post CRUD 확인, 유저 조회할때 dto로 내려주게 수정.
- Loading branch information
Showing
8 changed files
with
70 additions
and
51 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
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
31 changes: 0 additions & 31 deletions
31
src/main/java/certis/CertisHomepage/web/dto/project/ProjectDto.java
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/main/java/certis/CertisHomepage/web/dto/project/ProjectResponse.java
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
src/main/java/certis/CertisHomepage/web/dto/user/UserDto.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,50 @@ | ||
package certis.CertisHomepage.web.dto.user; | ||
|
||
import certis.CertisHomepage.domain.UserEntity; | ||
import certis.CertisHomepage.service.UserService; | ||
import certis.CertisHomepage.web.dto.post.PostDto; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Getter | ||
@Builder | ||
public class UserDto { | ||
|
||
private Long id; | ||
private String account; | ||
private String username; | ||
private String nickname; | ||
private String email; | ||
private LocalDateTime registeredAt; | ||
private LocalDateTime modifiedAt; | ||
private Long exp; | ||
private Long level; | ||
private String roleType; | ||
private String status; | ||
private List<PostDto> posts; | ||
|
||
|
||
public static UserDto convertToDto(UserEntity user) { | ||
return UserDto.builder() | ||
.id(user.getId()) | ||
.account(user.getAccount()) | ||
.username(user.getUsername()) | ||
.nickname(user.getNickname()) | ||
.email(user.getEmail()) | ||
.registeredAt(user.getRegisteredAt()) | ||
.modifiedAt(user.getModifiedAt()) | ||
.exp(user.getExp()) | ||
.level(user.getLevel()) | ||
.roleType(user.getRoleType().toString()) // Enum to String | ||
.status(user.getStatus().toString()) // Enum to String | ||
.posts(user.getPosts().stream() | ||
.map(PostDto::toDto) | ||
.collect(Collectors.toList())) | ||
.build(); | ||
|
||
} | ||
} |