Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
refactor :: Article.java
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Apr 25, 2024
1 parent cdcf6d2 commit ad5bb5d
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.daemawiki.domain.article.model;

import lombok.Builder;
import lombok.Getter;
import org.daemawiki.domain.user.model.Writer;
import org.springframework.data.annotation.CreatedDate;
Expand All @@ -14,32 +15,35 @@ public class Article {

@Id
private String id;

private String title;

private String content;

private Writer writer;

@CreatedDate
private LocalDateTime createdAt;
private Long recommend = 0L;
private Long view = 0L;

public void increaseView() {
view++;
}
private Long recommend = 0L;

public void increaseRecommend() {
recommend++;
}
private Long view = 0L;

protected Article() {}

protected Article(String title, String content, Writer writer) {
@Builder
public Article(String title, String content, Writer writer) {
this.title = title;
this.content = content;
this.writer = writer;
}

public static Article create(String title, String content, Writer writer) {
return new Article(title, content, writer);
public void increaseView() {
view++;
}

public void increaseRecommend() {
recommend++;
}

}

0 comments on commit ad5bb5d

Please sign in to comment.