-
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.
Merge pull request #82 from SanE-Seo/develop
Develop
- Loading branch information
Showing
14 changed files
with
131 additions
and
71 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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/seoultech/sanEseo/global/exception/UnauthorizedAccessException.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,9 @@ | ||
package com.seoultech.sanEseo.global.exception; | ||
|
||
public class UnauthorizedAccessException extends BusinessException{ | ||
|
||
public UnauthorizedAccessException(String message) { | ||
super(ErrorType.UNAUTHORIZED_ACCESS, message); | ||
} | ||
} | ||
|
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
48 changes: 33 additions & 15 deletions
48
src/main/java/com/seoultech/sanEseo/review/application/service/GetReviewResponse.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,44 @@ | ||
package com.seoultech.sanEseo.review.application.service; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.seoultech.sanEseo.member.domain.Member; | ||
import com.seoultech.sanEseo.review.domain.Review; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
import org.springframework.util.Assert; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public record GetReviewResponse( | ||
Long reviewId, | ||
Long memberId, | ||
Long postId, | ||
String content, | ||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
LocalDateTime createDate | ||
) { | ||
@Builder | ||
public GetReviewResponse { | ||
Assert.notNull(reviewId, "리뷰 ID는 필수입니다."); | ||
Assert.notNull(memberId, "사용자 ID는 필수입니다."); | ||
Assert.notNull(postId, "게시글 ID는 필수입니다."); | ||
Assert.hasText(content, "리뷰 내용은 필수입니다."); | ||
Assert.notNull(createDate, "리뷰 작성일은 필수입니다."); | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class GetReviewResponse { | ||
Long reviewId; | ||
Long authorId; | ||
String authorName; | ||
String authorProfileImageUrl; | ||
Long postId; | ||
String content; | ||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
LocalDateTime createAt; | ||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
LocalDateTime updateAt; | ||
|
||
public static GetReviewResponse fromEntity(Review review) { | ||
Member author = review.getMember(); | ||
return GetReviewResponse.builder() | ||
.reviewId(review.getId()) | ||
.authorId(author.getId()) | ||
.authorName(author.getName()) | ||
.authorProfileImageUrl(author.getProfile()) | ||
.postId(review.getPost().getId()) | ||
.content(review.getContent()) | ||
.createAt(review.getCreateAt()) | ||
.updateAt(review.getUpdateAt()) | ||
.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