package cn.reghao.tnb.search.app.blog.model.vo;

import cn.reghao.tnb.search.app.blog.model.po.Article;
import cn.reghao.jutil.jdk.converter.DateTimeConverter;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @author reghao
 * @date 2023-04-13 17:22:04
 */
@NoArgsConstructor
@Setter
@Getter
public class UserArticle {
    private Integer id;
    private String articleId;
    private String title;
    private String category;
    private String summary;
    private String publishAt;
    private int views;

    public UserArticle(Article article, int viewCount, String category) {
        this.id = article.getId();
        this.articleId = article.getArticleId();
        this.title = article.getTitle();
        this.category = category;
        this.summary = article.getExcerpt();
        this.publishAt = DateTimeConverter.format(article.getPublishAt());
        this.views = viewCount;
    }
}
