Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

기술 블로그 하이퍼링크 기능 추가 완료 #322

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/page/clab/api/domain/blog/domain/Blog.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ public class Blog extends BaseEntity {

private String imageUrl;

private String hyperlink;

public void update(BlogUpdateRequestDto requestDto) {
Optional.ofNullable(requestDto.getTitle()).ifPresent(this::setTitle);
Optional.ofNullable(requestDto.getSubTitle()).ifPresent(this::setSubTitle);
Optional.ofNullable(requestDto.getContent()).ifPresent(this::setContent);
Optional.ofNullable(requestDto.getImageUrl()).ifPresent(this::setImageUrl);
Optional.ofNullable(requestDto.getHyperlink()).ifPresent(this::setHyperlink);
}

public boolean isOwner(Member member) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ public class BlogRequestDto {
@Schema(description = "이미지 URL", example = "https://www.clab.page/assets/logoWhite-fc1ef9a0.webp")
private String imageUrl;

@Schema(description = "하이퍼링크", example = "https://www.clab.page")
private String hyperlink;

public static Blog toEntity(BlogRequestDto requestDto, Member member) {
return Blog.builder()
.member(member)
.title(requestDto.getTitle())
.subTitle(requestDto.getSubTitle())
.content(requestDto.getContent())
.hyperlink(requestDto.getHyperlink())
.imageUrl(requestDto.getImageUrl())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ public class BlogUpdateRequestDto {
@Schema(description = "이미지 URL", example = "https://www.clab.page/assets/logoWhite-fc1ef9a0.webp")
private String imageUrl;

@Schema(description = "하이퍼링크", example = "https://www.clab.page")
private String hyperlink;

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class BlogDetailsResponseDto {

private String imageUrl;

private String hyperlink;

@JsonProperty("isOwner")
private Boolean isOwner;

Expand All @@ -39,6 +41,7 @@ public static BlogDetailsResponseDto toDto(Blog blog, boolean isOwner) {
.subTitle(blog.getSubTitle())
.content(blog.getContent())
.imageUrl(blog.getImageUrl())
.hyperlink(blog.getHyperlink())
.isOwner(isOwner)
.createdAt(blog.getCreatedAt())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class BlogResponseDto {

private String imageUrl;

private String hyperlink;

private LocalDateTime createdAt;

public static BlogResponseDto toDto(Blog blog) {
Expand All @@ -26,6 +28,7 @@ public static BlogResponseDto toDto(Blog blog) {
.title(blog.getTitle())
.subTitle(blog.getSubTitle())
.imageUrl(blog.getImageUrl())
.hyperlink(blog.getHyperlink())
.createdAt(blog.getCreatedAt())
.build();
}
Expand Down
Loading