86 lines
1.3 KiB
JavaScript
86 lines
1.3 KiB
JavaScript
const log = require('color-logs')(true, true, "Article.class.js"),
|
|
markdown = require('markdown').markdown,
|
|
promise = require('promise');
|
|
|
|
var id,
|
|
title,
|
|
author,
|
|
content,
|
|
date,
|
|
img,
|
|
slug;
|
|
|
|
class Article {
|
|
constructor(id, title, author, date, img, slug){
|
|
this.setId(id);
|
|
this.setTitle(title);
|
|
this.setAuthor(author);
|
|
this.setDate(date);
|
|
this.setImg(img);
|
|
this.setSlug(slug);
|
|
}
|
|
|
|
setId(id){
|
|
this.id = id;
|
|
}
|
|
|
|
setTitle(title){
|
|
this.title = title;
|
|
}
|
|
|
|
setAuthor(author){
|
|
this.author = author;
|
|
}
|
|
|
|
setContent(content){
|
|
this.content = content;
|
|
}
|
|
|
|
setImg(img){
|
|
this.img = img;
|
|
}
|
|
|
|
setDate(date){
|
|
this.date = date;
|
|
}
|
|
|
|
setSlug(slug){
|
|
this.slug = slug;
|
|
}
|
|
|
|
getId(){
|
|
return this.id;
|
|
}
|
|
|
|
getTitle(){
|
|
return this.title;
|
|
}
|
|
|
|
getAuthor(){
|
|
return this.author;
|
|
}
|
|
|
|
getContent(){
|
|
return this.content;
|
|
}
|
|
|
|
getDate(){
|
|
return this.date;
|
|
}
|
|
|
|
getImg(){
|
|
return this.img;
|
|
}
|
|
|
|
getSlug(){
|
|
return this.slug;
|
|
}
|
|
|
|
getCompiledContent(){
|
|
return markdown.toHTML(this.getContent());
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Article;
|