feat: articles format option with markdown new default

This commit is contained in:
fsylvain committed 2026-10-04 19:04:12 +02:00
1 parent 68401d66e0
commit 7e9bd9ba30
61 files changed
+2269 -243

No files matched your search

@@ -6,15 +6,17 @@ import (
type CreateArticleUseCase struct {
articleRepository article.Repository
bodyRenderer article.BodyRenderer
}
type CreateArticleCommand struct {
Title string
Body string
Title string
Body string
Format article.BodyFormat
}
func NewCreateArticleUseCase(articleRepository article.Repository) *CreateArticleUseCase {
return &CreateArticleUseCase{articleRepository}
func NewCreateArticleUseCase(articleRepository article.Repository, bodyRenderer article.BodyRenderer) *CreateArticleUseCase {
return &CreateArticleUseCase{articleRepository, bodyRenderer}
}
func (g *CreateArticleUseCase) CreateArticle(createArticle CreateArticleCommand) (article.Article, error) {
@@ -22,9 +24,13 @@ func (g *CreateArticleUseCase) CreateArticle(createArticle CreateArticleCommand)
return article.Article{}, err
}
return g.articleRepository.Create(article.Article{
created, err := g.articleRepository.Create(article.Article{
Title: createArticle.Title,
Body: createArticle.Body,
IsOnline: false,
})
if err != nil {
return article.Article{}, err
}
return renderArticle(g.bodyRenderer, created, createArticle.Format)
}