98 lines
1.6 KiB
JavaScript
98 lines
1.6 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,
|
|
categorieName,
|
|
categorieID,
|
|
slug;
|
|
|
|
class Article {
|
|
constructor(id, title, author, date, img, slug, categorieID, content = null){
|
|
this.setId(id);
|
|
this.setTitle(title);
|
|
this.setAuthor(author);
|
|
this.setDate(date);
|
|
this.setImg(img);
|
|
this.setSlug(slug);
|
|
this.setCategorieID(categorieID);
|
|
(content !== null)?this.setContent(content):'';
|
|
}
|
|
|
|
setId(id){
|
|
this.id = id;
|
|
}
|
|
|
|
setTitle(title){
|
|
this.title = title;
|
|
}
|
|
|
|
setAuthor(author){
|
|
this.author = author;
|
|
}
|
|
|
|
setContent(content){
|
|
this.content = markdown.toHTML(content);
|
|
}
|
|
|
|
setImg(img){
|
|
this.img = img;
|
|
}
|
|
|
|
setDate(date){
|
|
this.date = date;
|
|
}
|
|
|
|
setSlug(slug){
|
|
this.slug = slug;
|
|
}
|
|
|
|
setCategorieID(categorieID){
|
|
this.categorieID = categorieID;
|
|
}
|
|
|
|
setCategorieName(name){
|
|
this.categorieName = name;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
getcategorieID(){
|
|
return this.categorieID;
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Article;
|