mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
refac: remove frontend & clearer DDD
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
"RenewCMS/internal/domain/article"
|
||||
)
|
||||
|
||||
type CreateArticleUseCase struct {
|
||||
articleRepository article.Repository
|
||||
}
|
||||
|
||||
type CreateArticleCommand struct {
|
||||
Title string
|
||||
Body string
|
||||
}
|
||||
|
||||
func NewCreateArticleUseCase(articleRepository article.Repository) *CreateArticleUseCase {
|
||||
return &CreateArticleUseCase{articleRepository}
|
||||
}
|
||||
|
||||
func (g *CreateArticleUseCase) CreateArticle(createArticle CreateArticleCommand) (article.Article, error) {
|
||||
return g.articleRepository.Create(article.FromApi(
|
||||
createArticle.Title,
|
||||
createArticle.Body,
|
||||
))
|
||||
}
|
||||
Reference in New Issue
Block a user