-
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.
Browse files
Browse the repository at this point in the history
Comment, UploadedMusic에 인증 및 user 정보 리팩토링 완료
- Loading branch information
Showing
16 changed files
with
112 additions
and
43 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
16 changes: 11 additions & 5 deletions
16
src/main/java/com/munecting/api/domain/comment/dto/response/CommentResponseDto.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,26 +1,32 @@ | ||
package com.munecting.api.domain.comment.dto.response; | ||
|
||
import com.munecting.api.domain.comment.entity.Comment; | ||
import com.munecting.api.domain.user.dto.response.UserResponseDto; | ||
import com.munecting.api.domain.user.entity.User; | ||
import java.time.LocalDateTime; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record CommentResponseDto ( | ||
Long userId, | ||
UserResponseDto userDto, | ||
String trackId, | ||
String content, | ||
LocalDateTime createdAt, | ||
LocalDateTime updatedAt | ||
// 내가 쓴 댓글인지 판별하는 필드 필요 -> 인증 부분 완성되면 추가 예정 | ||
LocalDateTime updatedAt, | ||
Boolean isOwner | ||
) { | ||
|
||
public static CommentResponseDto of(Comment comment) { | ||
public static CommentResponseDto of(User user, Comment comment, Boolean isOwner) { | ||
UserResponseDto userDto = UserResponseDto.of( | ||
user.getId(), user.getNickname(), user.getProfileImageUrl()); | ||
|
||
return CommentResponseDto.builder() | ||
.userId(comment.getUserId()) | ||
.userDto(userDto) | ||
.trackId(comment.getTrackId()) | ||
.content(comment.getContent()) | ||
.createdAt(comment.getCreatedAt()) | ||
.updatedAt(comment.getUpdatedAt()) | ||
.isOwner(isOwner) | ||
.build(); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
src/main/java/com/munecting/api/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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.munecting.api.domain.user.dto.response; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record UserResponseDto( | ||
Long id, | ||
String nickname, | ||
String imageUrl | ||
) { | ||
public static UserResponseDto of(Long id, String nickname, String imgUrl) { | ||
return UserResponseDto.builder() | ||
.id(id) | ||
.nickname(nickname) | ||
.imageUrl(imgUrl) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.